Skip to content

feat(tools): Defer rarely used tools - #2895

Merged
dcramer merged 2 commits into
mainfrom
feat/defer-rare-tools
Nov 7, 2026
Merged

dcramer merged 2 commits into
mainfrom
feat/defer-rare-tools

Conversation

@sentry-junior

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

Copy link
Copy Markdown
Contributor

Every direct tool puts its schema in every Turn, and most direct tools are rarely called. This change moves 31 rarely used tools to the deferred catalog. searchTools finds them and executeTool runs them.

How I picked them. I looked at recent tool-call telemetry. A tool stays direct when many Conversations call it, or when the system prompt or runtime context names it. Everything else is deferred.

Deferred now, grouped by catalog source:

  • sandbox: grep, findFiles, listDir, createPreview. ref(sandbox): Remove grep, findFiles, and listDir tools #2896, stacked on this PR, deletes the 3 search tools because bash covers them.
  • slack: the 4 canvas tools, the 4 slackList* tools, slackChannelJoin, addReaction
  • images: imageGenerate, publishImage, unpublishImage
  • resource-watches: searchEventTypes
  • automations: createAutomation, searchAutomations, updateAutomation, deleteAutomation, runAutomationNow
  • agents: searchAgents, stopAgent
  • workspaces: createWorkspace, updateWorkspace, deleteWorkspace
  • user-customization: updateUserCustomization
  • GitHub: github_commentOnPullRequest, github_submitPullRequestReview

Still direct:

  • Frequent: the bash and file tools, loadSkill, switchWorkspace, listWorkspaces, web search and fetch, Slack thread, channel, and public search reads, userLookup, updatePlan, reportProgress, viewImage, systemTime.
  • GitHub: github_createPullRequest, github_updatePullRequestFeedback, github_resolvePullRequestReviewThread. PR maintenance Turns call these often.
  • Named by the system prompt or runtime context: addReviewItem, watchEvents, loadAttachment.
  • Common behavior that the model skips if it must search first: sendFiles and watchTimer.
  • The modelOnly runtime tools do not change.

Other changes:

  • Each deferred group gets a catalog source, so the searchTools description lists it. Without a source, the model can find a tool only by guessing a query.
  • The executeTool description now says to use it for a tool that is not in the tool list but that a skill, tool result, or error names. Examples are the GitHub egress denials and the github-code skill text. A direct call to a deferred tool fails with "Tool X not found".
  • policies/tool-design.md gets a rule for when a tool is direct.

Not in this PR: the ranking and result-format fixes for searchTools (#2893). With more tools deferred, those fixes matter more, so they come next.

Checks: pnpm typecheck, pnpm lint, the tool checks, skills:check, and the junior and junior-github test suites pass. I did not run the LLM evals locally.

Refs #2893

via @dcramer.

--

View Session [Sentry]

Load only tools that many Conversations use, plus tools the system prompt
names. Move 33 tools to the deferred catalog under sources that
searchTools lists, and tell executeTool callers to use it for any tool a
skill, tool result, or error names.

Refs #2893

Co-Authored-By: David Cramer <[email protected]>
@vercel

vercel Bot commented Nov 7, 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 7, 2026 6:40pm UTC

Request Review

@github-actions github-actions Bot added the risk: high PR risk score: high label Nov 7, 2026
@dcramer

dcramer commented Nov 7, 2026

Copy link
Copy Markdown
Member

One question we should answer: if some of these tools are never used, such as the bash tools, if we need them at all, or if we should just allow the agent to rely on bash

Because part of the core is we want core tools loaded so that it knows to use them and doesn't have to look them up because if it has to look them up for common behavior, it's unlikely to use the tool

@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

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

Review screenshots in Frameshift

Conversation Attachment · Desktop
Conversation Attachment · Desktop
Changed
Conversation Attachment · Mobile
Conversation Attachment · Mobile
Changed
Conversation Attachment Modal · Desktop
Conversation Attachment Modal · 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
Show 10 more changed screenshots
Conversation Captured Memories Popover · Mobile
Conversation Captured Memories Popover · Mobile
Changed
Conversation Details Watched Linked Work · Desktop
Conversation Details Watched Linked Work · Desktop
Changed
Conversation Details Watched Linked Work · Mobile
Conversation Details Watched Linked Work · Mobile
Changed
Conversation Event Log Virtual · Desktop
Conversation Event Log Virtual · Desktop
Changed
Conversation Fork Dialog · Desktop
Conversation Fork Dialog · Desktop
Changed
Conversation Fork Dialog · Mobile
Conversation Fork Dialog · Mobile
Changed
Conversation Long Transcript Touch · Mobile
Conversation Long Transcript Touch · Mobile
Changed
Settings Mcp · Desktop
Settings Mcp · Desktop
Changed
Settings Notifications · Desktop
Settings Notifications · Desktop
Changed
System Cache Share · Desktop
System Cache Share · Desktop
Changed

Sending a file and checking back later are common behaviors. The model
is unlikely to search for them, so keep both direct.

Co-Authored-By: David Cramer <[email protected]>
@sentry-junior

sentry-junior Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor Author

Agreed: a tool for common behavior stays loaded, because the model is unlikely to search for it. I applied that rule to this PR and to a stacked PR:

  • Moved back to direct: sendFiles and watchTimer. Sending a file and "check back later" are common behaviors, and the model skips them if it must search first.
  • Removed instead of deferred: grep, findFiles, and listDir in ref(sandbox): Remove grep, findFiles, and listDir tools #2896. bash is always loaded and covers them with rg, find, and ls.
  • Kept direct: readFile, editFile, and writeFile. They give bounded reads with continuation and exact edits with diffs, which bash does not do well.

The rest of the deferred set has no bash equivalent: Slack canvases and lists, automations, Workspace admin, image publishing, and agent admin. Each is rare and the request usually names it, so a search is cheap there.

@dcramer
dcramer merged commit 8a28f34 into main Nov 7, 2026
48 checks passed
@dcramer
dcramer deleted the feat/defer-rare-tools branch November 7, 2026 19:05
dcramer added a commit that referenced this pull request Nov 7, 2026
Stacked on #2895. Answers the question in [this
comment](#2895 (comment)):
the sandbox search tools duplicate `bash`, so remove them instead of
deferring them.

`bash` is loaded on every Turn and already covers these with `rg`,
`find`, and `ls`. ripgrep stays in the sandbox image. The separate tools
only add tool-list cost and a second search path to maintain.

**Removed**
- `grep`, `findFiles`, `listDir`: tool files, sandbox dispatch, input
normalization, and registration.
- The search-only helpers in `file-utils.ts`, the `commandRunner` on the
file-tool call context, and the `setToolCallSpanAttributes` hook that
only search used.
- `app.sandbox.search.*` span attributes and their `TELEMETRY.md` query.

**Kept**
- `readFile`, `editFile`, `writeFile`. They give bounded reads with
continuation and exact edits with diffs, and `bash` does not do that
well.
- The `sandbox` catalog source now holds only `createPreview`, so its
description covers only preview URLs.

**Tests**
- The sandbox recovery and stream-interruption tests now use `readFile`
instead of `grep`/`findFiles`. They test the same behavior.
- I deleted the ripgrep-specific cancellation test. It tested a path
that no longer exists, and `bash` has its own cancellation coverage.

Unit, component, and integration tests, typecheck, and lint all pass.

<!-- junior-request-attribution:start -->
via @dcramer.
<!-- junior-request-attribution:end -->

<!-- junior-session-footer:start -->
<!-- junior-conversation-id:slack%3AC0B595QDZLL%3A1794073929.368779 -->

--

[View
Session](https://junior-prod.sentry.dev/conversations/slack%3AC0B595QDZLL%3A1794073929.368779)
[[Sentry]](https://sentry.sentry.io/explore/conversations/slack%3AC0B595QDZLL%3A1794073929.368779/?project=4510944073809921)

<!-- junior-session-footer:end -->

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: David Cramer <[email protected]>

This branch was successfully deployed

1 active deployment
Preview – junior-docs — 4e99e1d3 Deployed Nov 7, 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