fix(tui): propagate permissions from nested subagents and show full subtask tree#24638
Open
michalsalat wants to merge 2 commits into
Open
fix(tui): propagate permissions from nested subagents and show full subtask tree#24638michalsalat wants to merge 2 commits into
michalsalat wants to merge 2 commits into
Conversation
…ubtask tree
When a subagent spawns its own subagents (depth > 1), permission and
question requests from those nested sessions were never displayed in
the root session's TUI. This caused nested subagents to block forever
waiting for approval that no user could see or grant.
The root cause was the children memo only collecting direct children
(depth 1), then using that list to gather permissions and questions.
Changes:
1. Add a descendants memo that performs a full BFS traversal of the
session tree to collect all descendant session IDs. Use this for
permission and question collection while keeping the existing
children memo unchanged for sibling navigation.
2. Show the full subtask tree inline in the conversation view. When a
Task tool call has nested sub-tasks, recursively render them with
indentation, status indicators, and per-session statistics (tool
count, duration, tokens, cost). Child sessions are lazily synced
as they appear in the tree.
3. Improve the permission prompt UX for nested subagents:
- Show the session description (e.g. 'in Research macOS notification
methods') instead of just the agent type
- Display tool parameters for MCP/generic tool permission requests
The web/desktop app already handles descendant traversal correctly via
sessionTreeRequest() in session-request-tree.ts — this aligns the TUI
with that behavior.
Contributor
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
This was referenced May 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Fixes #13715
Fixes #7654
Type of change
What does this PR do?
The
permissionsandquestionsmemos in the TUI session view only collect from direct children viachildren()— any grandchild or deeper descendant is excluded. When a subagent spawns its own subagent that needs permission (e.g. bash), the prompt never appears and the session hangs forever.The fix adds a
descendantsmemo that does a BFS traversal to collect all descendant session IDs, matching what the web/desktop app already does viasessionTreeRequest(). Bothpermissionsandquestionsnow usedescendants()instead ofchildren(). The existingchildren()memo is unchanged since it's still needed for sibling navigation.Additionally, the Task component now recursively renders nested subtasks inline with indentation, status indicators, and per-session stats (duration, tool count, tokens, cost) so you can see what all levels of subagents are doing without clicking into each one.
Permission prompts now show the requesting session's description (e.g. "in Research macOS notification methods") and display tool parameters for MCP/generic tools, addressing the "from parameter" suggestion in #7654.
How did you verify your code works?
bun typecheckpasses (only pre-existing unrelated error)bun test test/session/retry.test.ts— 28/28 passbun test test/session/prompt.test.ts— same pass/fail as dev (pre-existing flaky tests)bun test test/permission/— 85/85 passScreenshots / recordings
Subtask tree rendering:
Checklist