Repository navigation
Conversation
There was a problem hiding this comment.
The fix works. With the #57711 reproduction (allow *, deny execute, simulated model), the main request on the base leaves out execute but still carries the tools.opencode.session_move hint. With this change the hint is gone. bun run test test/tool-opencode.test.ts and bun typecheck pass in packages/core.
The guard reads the request's tools keyed by name, the same way other built-in plugins do (patch, websearch, shell). So it covers the primary, compaction and generate requests, and a narrower execute deny still keeps the hint.
Public API: unchanged.
The new test is heavier than this two-line fix needs (see inline).
| closeAll: Effect.void, | ||
| }) | ||
|
|
||
| it.effect("skips the session_move hint when execute is wholly denied", () => |
There was a problem hiding this comment.
This test is large for a two-line guard. It builds SessionModelRequest with a stub transport, a resolved OpenAI model and three permission rulesets just to check that one system part is or isn't there. It can be dropped to keep the change minimal. If you'd like to keep a regression test, please cut it to a single check that the plugin's context hook adds no hint when event.tools has no execute.
There was a problem hiding this comment.
Cut it to one context-hook check. When event.tools has no execute, the hook adds no session_move hint.
Re-ran on Bun 1.4.2. Without the guard the test fails (false received true). With the guard, packages/core bun run test test/tool-opencode.test.ts is 3 pass and bun typecheck passes. With execute on the event, the hint is still added. I left that case out of the test.
There was a problem hiding this comment.
The earlier test comment is addressed. The new test calls the context hook directly with no execute tool and checks that the hint is left out. I ran the #57711 reproduction again on the current base: the main request still carries the session_move hint without offering execute. With this pull request the hint is gone. bun run test test/tool-opencode.test.ts and bun typecheck pass in packages/core.
Public API: unchanged.
No further concerns.
Issue for this PR
Closes #57711
Type of change
What does this PR do?
A deny-all
executerule removes theexecutetool, butopencode.toolsstill tells the model to calltools.opencode.session_movethrough it. The same hint is added on compaction and generate.The hint is skipped when the request does not offer
execute. A narrower deny still offers the tool, so the hint stays.How did you verify your code works?
Bun 1.4.2.
The regression test fires the context hook with no
executetool.Before: without the guard, that hook still added the hint. The test failed at
toBe(false), receivedtrue.After: the hook leaves the hint out. With
executepresent, the hint is still added. That case is not in the test.Passed, from
packages/core:bun run test test/tool-opencode.test.ts: 3 passbun typecheck: passPassed on push:
bun run check(oxlint, ast-grep, sdk docs, turbo typecheck 34/34, cached on push).Passed on this head:
check-compliance,check-standards.add-contributor-labelpassed on the previous head and did not re-run.test,typecheck, andnix-evalare absent and did not fail. Combined status ispendingwith 0 statuses. The issue's opencode-drive script and the fullpackages/coresuite were not run.Screenshots / recordings
Not a UI change.
Checklist
Added by the opencode bot (AI-generated).
Related: #57720, #56038