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

@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
Repository owner deleted a comment from coderabbitai Bot Jul 6, 2026
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