Repository navigation
Conversation
|
The following comment was made by an LLM, it may be inaccurate: |
There was a problem hiding this comment.
The fix looks right. With your test file on the base, the four session-override cases fail; with this change all 17 tests in tool-subagent.test.ts pass. permission.test.ts and session-create.test.ts also pass, and the core typecheck is clean. Combining the rules with Permission.merge(selected.permissions, session.permissions ?? []) matches how SessionContext.select already narrows tool discovery, so the list of subagents now matches what the session can actually call.
Public API: unchanged.
One request: the new test is large for a 4-line fix (see the inline comment).
| expect(tool).toBeDefined() | ||
| expect(tool?.description?.includes("- reviewer:")).toBe(item.visible) | ||
| } | ||
| const result = yield* permissions.ask({ |
There was a problem hiding this comment.
This part checks things that already worked before this change: the permissions.ask result, and that running a denied subagent is rejected and creates no child session. The fix is only about the description. Could you cut the test down to the description check for the session-override cases? It would shrink a lot and still fail on the base.
Issue for this PR
Closes #48106
Type of change
What does this PR do?
Merge the current session's permissions into the V2 subagent description filter, matching tool discovery and execution. Session-denied targets disappear from the advertised list; session allow/ask overrides make targets visible.
This replaces the legacy implementation in #48107, whose target package was removed. The change applies to the shared context, compaction, and generate hook.
How did you verify your code works?
Using Bun 1.4.2:
bun run script/test.ts test/tool-subagent.test.ts test/permission.test.ts test/session-create.test.ts— 165 pass. The four description-only session-override cases fail on the unmodified base and pass with this fix.tool-subagent.test.ts --rerun-each 10— 150 pass.bun run check— lint and all 34 typecheck tasks pass..hg/branchwatcher failure passes in isolation on both trees.Screenshots / recordings
No UI changes.
Checklist