feat(runtime): guide Auto tool selection by final tool surface - #3705
feat(runtime): guide Auto tool selection by final tool surface#3705testikun wants to merge 1 commit into
Conversation
Generated-by: Codex
18a5aba to
191282e
Compare
yunaremaia
left a comment
There was a problem hiding this comment.
Nice, clean slice — the eligibility matrix is well chosen (bypass needs no anti-bypass guidance, explore has no mutation tools to name), the fragment is deterministic and pure, and the tests cover both the positive path and every exclusion branch including the partial-tool-surface case. The bump of INTERACTIVE_RUN_COMPOSER_REVISION for the prompt-shape change is also the right call.
One coupling worth making explicit while this is fresh:
The Bash gate lives two checks away from its supporting fact. In interactive-run-composer.ts you compute
shellAvailable: input.shell?.setupError === undefined,which maps an absent shell to undefined rather than false. The resolver then only treats literal false as disqualifying, so a session with no shell at all still passes the shellAvailable check — it survives solely because a missing shell also removes 'Bash' from tools, and resolveAutoToolGuidance independently requires toolNames.includes('Bash'). That's correct today, but the safety of the first check depends on an invariant maintained by a different subsystem (whatever guarantees "no shell ⇒ no Bash tool entry"). If that ever drifts — say a future surface exposes a remote-shell Bash entry without a local input.shell — the guidance would advertise shell-first workflows into a session that cannot run them, and nothing here would fail loudly.
Two cheap ways to pin it down; either works:
- Treat absence as absence: pass
shellAvailable: input.shell !== undefined && input.shell.setupError === undefinedand keep the resolver's=== falsecheck (or switch both to truthiness). One expression, no cross-module assumption. - Keep the current wiring but add one line to the resolver doc comment stating that
shellAvailable === undefinedmeans "unknown" and eligibility then rests entirely on thetoolNamesgate — so the next reader knows the pairing is intentional.
Not blocking — behavior is correct as written — but I'd sleep better with option 1.
Closes #3507
What changed
packages/runtime/src/system-prompt/auto-tool-guidance.ts.Scope
This changes prompt guidance only. It does not change permission classification, sandbox or approval execution, Bash schema/implementation, persistence protocols, or the
headless-coding-v1contract.Verification
git diff --checkpassed.AI use
Tool: OpenAI Codex assisted with issue analysis, implementation, tests, and verification.