fix(tui): approval popup disappears when switching b/w agent sessions, subagent hangs forever - #13955
Open
rakshith1928 wants to merge 4 commits into
Open
rakshith1928 wants to merge 4 commits into
rakshith1928 wants to merge 4 commits into
Conversation
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (2 files)
Previous Review Summary (commit 0e66528)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 0e66528)Status: 1 Issue Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
Files Reviewed (4 files)
Reviewed by grok-4.6 · Input: 96K · Output: 10.1K · Cached: 235.3K Review guidance: REVIEW.md from base branch |
5 tasks
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
No existing issue bug reported directly.
Context
In the TUI, when a subagent (Task tool) hit a permission prompt, opening the session list (ctrl+x → down), viewing the subagent, and coming back made the approval popup disappear. The subagent was then stuck forever waiting for an answer that could never be given.
The cause: switching sessions evicts the previous session (and its children) from the sync store, and the eviction deleted pending permission/question asks. These asks are one-shot SSE events — once dropped, nothing ever brought them back.
Implementation
evict()no longer deletesdraft.permission/draft.question. Thepermission.replied/question.repliedhandlers already clean them up on the answer.syncPending()refetches the server's pending lists (permission.list/question.list— both endpoints already existed, nothing used them) whenever a session syncs or the app bootstraps. This also recovers asks missed during an SSE disconnect. It merges instead of overwriting, so asks arriving mid-fetch survive, and answered asks aren't resurrected by a stale list.Also added
/permission+/questiondefault routes to the TUI test fixture and 4 regression tests.Screenshots / Video
subagentsnotworking.mp4
subagentsworking.mp4
How to Test
Manual/local verification
bun test test/cli/cmd/tui/ test/kilocode/frompackages/tui/— 71 pass (agent-executed)bun run script/check-opencode-annotations.ts --worktree— clean (agent-executed)Reviewer test steps
kilo.jsonso tool calls need approval:{ "permission": { "edit": "ask", "bash": "ask" } }(or use the pattern form:
"edit": { "src/**": "ask", "*": "ask" })2. Run
kilo, ask it something that dispatches a subagent which edits a file (e.g. "use a Task subagent to edit src/foo.ts")3. When the approval popup appears, press ctrl+x → down, open the subagent's session, then go back to the parent
4. The approval popup should still be there and answerable(which was not); the subagent should continue after answering
5. Before this fix: the popup is gone and the subagent spins forever
Blocked checks and substitute verification
Checklist
Get in Touch
Discord @TRAVIX26