Repository navigation
fix(runtime): keep request_sandbox_boundary visible in sandboxed Sessions - #6029
Colafornia merged 2 commits into
Conversation
Astro-Han
left a comment
There was a problem hiding this comment.
Automated review notice: This comment was posted by an automated review agent. It is not an independent human review and does not replace one.
Reviewed range: 560a27c1f..594329d5 (one commit, first review, no prior findings).
The PR adds requiredSandboxBoundaryToolNames(hostTools) and merges its result into the requiredToolNames passed to prepare(). When the Host binds request_sandbox_boundary (Sessions that are not Full access), it is now on the provider tool list from step 0 without a tool_search hop. Full access Sessions, where the tool is unbound, see no change. I checked the parts that could interact:
- Required names are filtered by
knownNames, are added tostep.active, and never write to the activation map. The tool is therefore callable through gating. - Turn-level denial and finalization still remove the tool.
boundaryAwareToolNames()and the code-mode catalog filter run afterprepare(), so a required name does not override the "denied for this Turn" or finalization-step removal. - The set is computed from the step's Host snapshot, not from a live prompt, so it stays fixed for the Session unless the Host binding changes. A permission-mode change alters the tool set anyway.
- The composition test now expects the tool on the step-0 list.
No P0-P2 findings.
P3 - the tool is still listed in the tool_search inventory. request_sandbox_boundary stays searchable, so it remains in the tool_search description, and an exact-name search still "activates" a tool that is already visible. The required orchestration tools behave the same way and this is harmless, but excluding required names from the inventory would save a few tokens and avoid a redundant search. This is optional.
P3 - possible conflict with #6028. Both PRs edit packages/runtime/src/__tests__/deferred-tools-backend.test.ts in the same hunks: this PR adds extraTools to the backend() helper input, #6028 adds loadTurnRuntimeEvents at the same spot, and both insert tests after the same test. A git merge-tree of the two heads (also main+#6028, then this PR) conflicts only in that file. ai-sdk-turn.ts auto-merges because the edits are about 30 lines apart. The runtime behaviors work together: required names do not touch the Session activation map that #6028 introduces. Whichever PR lands second needs a small test-file rebase.
No protocol or persisted-schema files are touched, so there is no epoch impact.
Mergeability: merges cleanly into current main (c11a5336). CI on 594329d5: label and test pass.
| toolAvailability?: ToolAvailabilityConfig; | ||
| fullSurface?: boolean; | ||
| resolveTools?: () => readonly MakaTool[]; | ||
| extraTools?: readonly MakaTool[]; |
There was a problem hiding this comment.
P3: #6028 adds loadTurnRuntimeEvents to this same helper input and inserts tests after the same test, so the two PRs conflict textually in this file. Whichever lands second needs a rebase. The runtime changes themselves do not conflict.
…ions Host binds the widening tool only when the Session is not Full access, but tool_search still deferred it. Models then searched for it, activated neighbors, and missed the prompt cache. Pass it through requiredToolNames whenever it is bound so the schema stays on the provider list for the whole Session, without depending on a live boundary prompt. Refs apache#5879 Generated-by: Cursor
Required names are already on the provider list. Leave them out of the search inventory and ranking so an exact-name search does not activate a tool that is already visible. Align the deferred-tools backend helper with apache#6028 so the two PRs rebase without a test-file conflict. Refs apache#5879 Generated-by: Cursor
594329d to
7fb7985
Compare
Thanks. Required names are now omitted from the tool_search inventory and ranking, so an exact-name search does not activate a tool that is already visible. The deferred-tools helper is aligned with #6028 so the two PRs rebase without a test-file conflict. |
Astro-Han
left a comment
There was a problem hiding this comment.
Automated review notice: This comment was posted by an automated review agent. It is not an independent human review and does not replace one.
Incremental review: 594329d5 (our last reviewed head) to 7fb79850. The branch was rebased onto current main. git range-diff shows the original commit unchanged (594329d5 = 7e3df714), plus one new commit, 7fb79850 "omit required tools from the tool_search inventory".
The new commit addresses our optional P3 (a required tool was still listed in tool_search).
prepare()now computes the required names before building the search connector.buildSearchConnectorpasses them torenderInventory, which omits them from the inventory, and torankDeferredSearchHits, which withholds them from exact-name and fuzzy hits alongside already-active tools.- A search for a required tool now returns
activated: []instead of re-activating something already on the provider list. - The tests cover both
request_sandbox_boundaryand the orchestration-required case: absent from the inventory, and an exact search activates nothing. When the tool is not required, it is still listed and stays deferred.
One small behavioral shift: requiredNames is now filtered against toolsByName instead of the canonicalized provider-tool set. A required tool that canonicalization drops would be omitted from the inventory without being on the provider list. I don't see a path where a bound required tool fails canonicalization, so this is not a finding.
Findings: None at P0-P3 in the delta. The test-file overlap with #6028 is gone: both heads now carry the same extraTools helper field, and git merge-tree of the two heads is clean.
Status: MERGEABLE. The fork CI run on this head was waiting for approval, and I approved it after confirming the PR changes no .github files. Results were pending at posting time. No protocol files, so there is no epoch impact.
Colafornia
left a comment
There was a problem hiding this comment.
Approved.
Making request_sandbox_boundary visible from step 0 removes an unnecessary search hop and avoids tool-loading cache invalidation for this common case, while preserving approval and denial enforcement. This is a focused improvement; cache invalidation when loading other deferred tools remains separate follow-up work. CI passes, and no blocking issues were found.
Summary
Host binds
request_sandbox_boundaryonly when the Session is not Full access, buttool_searchstill deferred it. Models then searched for that name, activated MiniSearch neighbors, and missed the prompt cache.This PR passes the bound widening tool through the existing
requiredToolNameshook. The set follows Host binding for the whole Session and does not depend on a live boundary prompt, which would change the provider prefix per Turn.Full access Sessions still omit the tool. Direction 2 stays with #1382.
Refs #5879
Verification
prepare()does not receive the required name, and passes with it.node --testontool-availability,deferred-tools-backend, and the new sandbox-boundary helper cases passed.npm --workspace @maka/runtime run test:dist: 3752 passed, 13 skipped, 0 failed.production Host executes a canonical ai-sdk Session against a real provider wirepassed withrequest_sandbox_boundaryon the step-0 list.biome format/biome lintclean for the changed files.npm --workspace @maka/runtime run typecheckpassed.npm test, knip, or the Desktop app.AI use
Select exactly one:
Tool(s) and scope: A coding assistant implemented the Session-stable
requiredToolNameswiring and wrote the regression tests.Checklist
Does this PR entail a change in behavior?