Skip to content

fix(codemode): Redirect every modelOnly tool from tool exposure - #3230

Merged
thomasjiangcy merged 1 commit into
mainfrom
fix/codemode-derive-redirects
Nov 12, 2026
Merged

thomasjiangcy merged 1 commit into
mainfrom
fix/codemode-derive-redirects

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #3229. That PR kept its own list of the tools to redirect (executeTool, searchTools) in codemode/redirect.ts. Tool exposure already decides which tools a script cannot call, so the list was a second copy of that rule. It also drifts: a new modelOnly tool would get pi's misleading hint again until someone added it by hand.

Now createPiAgentTools passes every model tool that is not a script tool to the bridge as modelOnlyTools. That is the modelOnly registry tools plus searchTools, executeTool, and codemode. The VM declares each one, and a call to one fails with a redirect. redirect.ts owns only the text: the two specific messages for executeTool and searchTools, and "X does not run in a script. Call it directly, outside the script." for the rest. So spawnAgent, handoff, and the other loop-control tools are covered too.

Object.hasOwn(run.tools, name) is still the only check that lets a call run. Names that no tool has still get pi's error, labeled missing_tool.

The codemode tool test now calls tools.executeTool through the real createPiAgentTools wiring, so dropping the derived list fails a test.

via @thomasjiangcy.

--

View Session [Sentry]

@vercel

vercel Bot commented Nov 12, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
junior-docs Ready Ready Preview Nov 12, 2026 4:58am UTC

Request Review

@github-actions github-actions Bot added the risk: medium PR risk score: medium label Nov 12, 2026
@github-actions

Copy link
Copy Markdown
Contributor

9 screenshot changes — 9 changed · 0 added · 0 removed

Review screenshots in Frameshift

Automation Run Details · Desktop
Automation Run Details · Desktop
Changed
Automations Runs Filters · Desktop
Automations Runs Filters · Desktop
Changed
Conversation Attachment Zoom · Desktop
Conversation Attachment Zoom · Desktop
Changed
Conversation Attachment Zoom · Mobile
Conversation Attachment Zoom · Mobile
Changed
Conversation Captured Memories Popover · Desktop
Conversation Captured Memories Popover · Desktop
Changed
Conversation Long Transcript Touch · Mobile
Conversation Long Transcript Touch · Mobile
Changed
Show 3 more changed screenshots
Push Notifications Tip · Desktop
Push Notifications Tip · Desktop
Changed
Settings Mcp · Desktop
Settings Mcp · Desktop
Changed
Settings Notifications · Desktop
Settings Notifications · Desktop
Changed

@thomasjiangcy
thomasjiangcy merged commit 7600391 into main Nov 12, 2026
46 checks passed
@thomasjiangcy
thomasjiangcy deleted the fix/codemode-derive-redirects branch November 12, 2026 05:12

This branch was successfully deployed

1 active deployment
Preview – junior-docs — 99652bfd Deployed Nov 12, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant