Skip to content

fix(lead): Declare the Lead's main tools as direct - #4012

Merged
dcramer merged 2 commits into
mainfrom
fix/lead-direct-tools
Nov 22, 2026
Merged

dcramer merged 2 commits into
mainfrom
fix/lead-direct-tools

Conversation

@sentry-junior

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

Copy link
Copy Markdown
Contributor

A Lead Turn called searchConversations directly and got Pi's Tool searchConversations not found. The tool is deferred, so it is only reachable through searchTools/executeTool.

The Lead's tool config in kind-behavior.ts now declares its main tools in a direct list next to only: searchConversations, searchConversationEvents, readConversationEvent, searchInboxItems, searchEventTypes, listWatches, and stopWatchingResources. listedToolExposure in tool-exposure.ts owns the rule: a deferred tool named in direct is in the model tool list. Other exposures do not change, so direct cannot reveal a Code Mode-only or hidden tool. Other kinds declare no direct list and do not change.

createTools and staticToolDefinitions both apply it, so cache warming sends the same tool list as a live Turn. The Lead's prompt prefix changes once with this deploy and is stable after it.

Other Turns still get Pi's bare error for a direct call to a deferred or unknown tool. A separate change replaces that error with a hint.

via @dcramer.

--

View Session [Sentry]

The Lead's only list has 14 tools, and 8 of them were deferred, so the
Lead had to call searchTools to find its own core tools such as
searchConversations. Deferring keeps a long tool list short; an only
list is already short. A Turn with an only list now lists each of its
tools. The registry applies the rule, so cache warming sends the same
tool list.

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

vercel Bot commented Nov 22, 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 22, 2026 8:17am UTC

Request Review

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

@dcramer dcramer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't feel like the right way to build this abstraction. It is hardcoding too much behavior in the wrong places

@sentry-junior

sentry-junior Bot commented Nov 22, 2026

Copy link
Copy Markdown
Contributor Author

Fair. The rule is implicit ("an only list means no deferral"), and it's applied in two places, the registry and createTools. Neither should decide exposure for a conversation kind.

What I'd do instead: the Lead declares its primary tools next to only in kind-behavior.ts, for example direct: [...]. Exposure for a Turn then comes from its tool config in one place, tool-exposure.ts, and the registry stops rewriting definitions. Other kinds don't change.

The other option is to make these conversation tools direct for every Turn and drop the per-kind override. Which do you want, or did you have a different shape in mind?

@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

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

Review screenshots in Frameshift

Replace the implicit only-list rule with a direct list that the Lead
declares next to only in kind-behavior.ts. tool-exposure.ts owns the
rule: a deferred tool named in direct is listed in the model tool list,
and other exposures do not change.

Co-Authored-By: David Cramer <[email protected]>
@github-actions github-actions Bot added risk: high PR risk score: high and removed risk: medium PR risk score: medium labels Nov 22, 2026
@sentry-junior sentry-junior Bot changed the title fix(lead): List every tool on an only list instead of deferring it fix(lead): Declare the Lead's main tools as direct Nov 22, 2026
@dcramer

dcramer commented Nov 22, 2026

Copy link
Copy Markdown
Member

I'm still a little concerned about this. Like, we don't need Guardian blocking these kinds of things. What we need is the Guardian to not allow unsafe operations in general, if that makes sense, which might need some prompt changes, some other structural changes, but we've had a handful of concerns with Guardian. And these kinds of things with it over asking are already a concern. So, if the simple solution for now is just to allow a prove on this, that's probably fine. I think the thing though is we wouldn't want like we don't need the sub agent to treat messages, instructions from the user as unsafe here, but we do need the lead agent, for example, the guardian to run there to make sure like, oh yeah, the request for this tool call is clearly what the user intended and that the agent isn't just spawning off a bunch of random conversations that the user didn't ask for

@sentry-junior

sentry-junior Bot commented Nov 22, 2026

Copy link
Copy Markdown
Contributor Author

Agreed. To be clear, this PR doesn't change Guardian. It only changes which tools the Lead sees without searchTools. Six of the seven are read-only, and stopWatchingResources stops only this Conversation's own watches. Each call still gets the same review as before.

The direction you describe fits the Guardian tracking issue, #3947:

  • A child shouldn't treat its parent's instructions as unsafe.
  • The Lead's review should check that starting or messaging a Conversation is clearly what the person asked for.

@dcramer
dcramer merged commit 8b2a420 into main Nov 22, 2026
63 checks passed
@dcramer
dcramer deleted the fix/lead-direct-tools branch November 22, 2026 21:17

This branch was successfully deployed

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