Skip to content

fix(opencode): pass input args to augment hook and allow tool search in subagents - #1933

Open
Chewji9875 wants to merge 1 commit into
DeusData:mainfrom
Chewji9875:fix/opencode-hook-args-and-subagent-permissions
Open

fix(opencode): pass input args to augment hook and allow tool search in subagents#1933
Chewji9875 wants to merge 1 commit into
DeusData:mainfrom
Chewji9875:fix/opencode-hook-args-and-subagent-permissions

Conversation

@Chewji9875

Copy link
Copy Markdown

Summary

This PR resolves two issues affecting OpenCode integration:

  1. Fix output?.args typo in OpenCode plugin adapter (src/cli/client_adapter.c):
    In OpenCode's plugin API for tool.execute.after(input, output), the arguments passed to the executed tool reside in input?.args, while output contains the result (output?.output). Passing output?.args passed undefined, causing hook-augment to receive an empty payload {"tool_input":{}} and silently failing to augment search results with graph context (Closes Generated OpenCode plugin passes output?.args to hook-augment, so augmentation never fires #1737).

  2. Add tool_search and tool_search_regex permissions to OpenCode subagent profiles (src/cli/agent_profiles.c):
    When OpenCode subagents are generated with permission: "*": deny, they were granted read, grep, and glob alongside direct MCP tool permissions. In environments with deferred MCP tool loading (e.g. openstellar-tool-search), OpenCode needs tool_search or tool_search_regex to discover and unlock deferred tools. Adding these permissions enables subagents to unblock graph tools as intended.

Changes

  • src/cli/client_adapter.c: Changed output?.args to input?.args in cbm_client_adapter_opencode.
  • src/cli/agent_profiles.c: Updated CBM_GRAPH_DIALECT_OPENCODE subagent template to allow tool_search and tool_search_regex.
  • tests/test_agent_clients.c: Added assertions verifying input?.args presence and output?.args absence.
  • tests/test_agent_profiles.c: Added agent_profiles_opencode_allows_tool_search_and_subagent_permissions test.

Verification

  • Ran ./scripts/test.sh --suites "agent_clients agent_profiles" — 49/49 tests passing.
  • Verified C binary compilation via ./scripts/build.sh.

…in subagents

- Fix client adapter passing output?.args instead of input?.args in tool.execute.after hook (closes DeusData#1737)
- Add tool_search and tool_search_regex permissions to OpenCode subagent profiles so deferred MCP tools can be discovered and unblocked
- Add regression tests for OpenCode adapter hook args and subagent profile permissions
@Chewji9875
Chewji9875 requested a review from DeusData as a code owner August 30, 2026 10:50
@github-actions

Copy link
Copy Markdown

Thanks for opening this — it has been seen, and it is queued.

This note is automated, but it is not a brush-off: it exists so you know where your PR stands instead of having to guess from silence.

Current review status: working through a backlog. 0.9.1-rc.1 is out, so the release freeze that held reviews is over — but it left a large queue of open pull requests behind it, and we are reading through them oldest-first. The background is in discussion #1144.

What that means for this PR, concretely:

  • It will not be closed for inactivity. No stale bot touches pull requests here.
  • It may still sit a while before a human reads it. That is on us, not on you.
  • Older PRs are read first, so a recent one is not being skipped — it is behind a queue.

Things that will genuinely speed it up whenever review does happen:

  • Keep it rebased on main — the tree is moving quickly right now, and a conflicting branch cannot be reviewed as the diff you intended.
  • Get CI green, or say which failures you believe are pre-existing.
  • Keep the change to one claim. Bundled features and refactors get split before they get merged, which costs you a round trip.
  • Every commit needs a sign-off (git commit -s) — CI enforces DCO.

If this fixes a bug, a reproduction we can run is worth more than a description of the symptom.

Thanks for contributing, and sorry in advance for the wait.

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.

Generated OpenCode plugin passes output?.args to hook-augment, so augmentation never fires

1 participant