Skip to content

feat(tools): Add codemode exposure and give modelOnly its meaning - #2529

Merged
thomasjiangcy merged 2 commits into
mainfrom
codemode/tool-exposure
Nov 2, 2026
Merged

thomasjiangcy merged 2 commits into
mainfrom
codemode/tool-exposure

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Prep for Code Mode (#1987). This change sets who may call each tool. It does not add the bridge or the codemode tool.

Exposure Model tool list Tool catalog (searchTools/executeTool) Code Mode script
direct yes yes yes
deferred no yes yes
modelOnly yes no no
codemode (new) no no yes
hidden no no no
  • planToolExposure now returns scriptTools (direct + deferred + codemode) for the bridge. excludedTools had no runtime reader, so this PR removes it.
  • codemode tools are not in the catalog. This matches pi. The catalog is a model-facing path, so a codemode tool in it would let the model run it through executeTool.
  • handoff, finishAutomationRun, reportBlocked, spawnAgent, messageAgent, searchTools, and executeTool are now modelOnly. These tools control the agent loop, start or steer agent invocations, or dispatch other tools. spawnAgent and messageAgent tie the agent invocation to the model's own tool call id. The model still sees these tools and calls them directly. On main, executeTool could also run handoff. A local CLI run showed that this switched the profile, but the loop's handoff handling did not run, and the model got "No result provided". Now executeTool refuses it.
  • callMcpTool and searchMcpTools stay direct. Raw MCP tools (mcp.allowed-tools) have no exposure of their own and no registry entry. callMcpTool does its own dispatch and has its own action review metadata, so it is the only path that scripts have to those tools. Wrapped MCP tools are plugin JS tools, so they can already use exposure: "codemode".

No repo or getsentry org code (including junior-prod) sets modelOnly. Plugin plugin.yaml has no exposure field, and the public docs do not list exposure values.

Open questions for the bridge track:

  • Should loadSkill also be modelOnly?
  • Should scripts reach raw MCP tools only through callMcpTool?

via @thomasjiangcy.

--

View Session [Sentry]

modelOnly tools are now in the model tool list but not in the tool catalog
or the script tool set. Add a codemode exposure for tools that only Code
Mode scripts may call, and plan scriptTools for the Code Mode bridge.

Mark handoff, finishAutomationRun, reportBlocked, searchTools, and
executeTool as modelOnly. executeTool could run handoff before, which
bypassed the agent loop's handoff handling.

Refs #1987

Co-Authored-By: Thomas Jiang <[email protected]>
@vercel

vercel Bot commented Nov 2, 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 2, 2026 10:53am UTC

Request Review

Both tools tie the agent invocation to the model's own tool call id, so
only the model calls them directly. executeTool and Code Mode scripts
cannot run them.

Refs #1987

Co-Authored-By: Thomas Jiang <[email protected]>
@github-actions github-actions Bot added the risk: high PR risk score: high label Nov 2, 2026
@thomasjiangcy
thomasjiangcy merged commit 0c68077 into main Nov 2, 2026
45 checks passed
@thomasjiangcy
thomasjiangcy deleted the codemode/tool-exposure branch November 2, 2026 11:05

This branch was successfully deployed

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

Labels

risk: high PR risk score: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant