Skip to content

Fix duplicate write handling in opencode mode#111

Merged
Nomadcxx merged 1 commit into
mainfrom
fix/issue-83-write-contract
Jun 27, 2026
Merged

Fix duplicate write handling in opencode mode#111
Nomadcxx merged 1 commit into
mainfrom
fix/issue-83-write-contract

Conversation

@Nomadcxx

Copy link
Copy Markdown
Owner

Summary

  • Stop registering the native write hook in opencode tool-loop mode, so opencode owns native write execution.
  • Keep oc_write available, and keep native write registration for proxy-exec and off modes.
  • Add one shared write-tool contract that points targeted existing-file changes to edit.

Notes

Issue #83 started around missing oc_* hooks. The current failure traced to duplicate native write handling after aliases existed: opencode completed write, then the plugin guard could return a partial-overwrite error and keep the model looping.

Manual Composer checks against the dev plugin did not reproduce the duplicate-write guard loop. Separate prompts stalled after read or produced malformed edit args; those need a separate patch if we can isolate a plugin-side cause.

Fixes #83

Testing

  • bun test tests/integration/opencode-loop.integration.test.ts tests/tools/defaults.test.ts tests/unit/plugin-tool-resolution.test.ts tests/unit/plugin-tools-hook.test.ts
  • bun run test:ci:unit
  • bun run build

@coderabbitai

coderabbitai Bot commented Jun 27, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 6f766cb9-1154-42ab-b2c8-dc3fc9c098aa

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Nomadcxx Nomadcxx merged commit eae08c3 into main Jun 27, 2026
3 checks passed
@Nomadcxx Nomadcxx deleted the fix/issue-83-write-contract branch June 27, 2026 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

oc_edit / oc_write not registered in tool hook despite system prompt instructing model to use them

1 participant