Repository navigation
fix(v2): point models at Code Mode for goal tools - #86
Merged
Merged
Conversation
OpenCode 2 exposes plugin tools only inside the execute tool. The goal prompts name tools bare, so models called goal_status directly and reported the goal tools unavailable. Add a system note when a request offers execute but no direct goal tool. Fixes #85 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ation # Conflicts: # test/v2-bridge.test.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #85
Root cause
The tools are registered. OpenCode 2 runs Code Mode: the model gets one direct tool,
execute, and every plugin tool is listed in a Code Mode catalog and callable only insideexecutecode astools.goal_status(),tools.goal_complete({...})and so on. The plugin's own prompts (the goal block, continuations, thegoalagent) name the tools bare, so some models calledgoal_statusdirectly, got a tool-not-found, and reported the goal tools as unavailable.Reproduced with the reporter's exact setup:
"plugins": ["opencode-goal-plugin@0.11.0"]in an isolated global config, on live OpenCode 2.0.31 and 2.0.16. On both, for both thebuildandgoalagents, the direct tool list wasedit, glob, grep, question, read, shell, skill, subagent, webfetch, websearch, write, execute, and the Code Mode catalog listed all 9 goal tools. This is not a 2.0.31 regression.Change
src/v2-bridge.js: when the core registered its tools and a request offersexecutebut no direct goal tool, append one system note telling the model the goal tools are called insideexecute(e.g.return await tools.goal_status()) with the catalog's signatures. Requests without Code Mode, with direct goal tools, or withregisterTools: falseare unchanged, and host system parts are preserved. The verifier (read/glob/grep only) gets no note.Verification
mainand passes here.npm run release:check: exit 0 (491 tests, mutation 90/90, type/packed contracts, smoke, audit 0 vulns).smoke:v2-hoston 2.0.31 still stops at the completion-audit step from this branch, because that fix is in fix(v2): accept host-added deny rules in verifier ownership check #84 and this branch is based onmain. With fix(v2): accept host-added deny rules in verifier ownership check #84, it passes on 2.0.31.Note: #83, #84 and this PR each add a CHANGELOG "Unreleased" entry, so later merges need small changelog rebases.
🤖 Generated with Claude Code