fix(tui): label only detached subagents as background#37306
Merged
Conversation
Contributor
Author
|
Durable reproduction from the reported local session
The persisted tool input has no background flag; its outer state remained running until 11:27:45 while structured child metadata was |
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.
What
Stop foreground running subagents from receiving a misleading
Backgroundbadge.Before / After
Before: Any child with structured
status: "running"was labeledBackground, even while its outer tool call was still running in the foreground. The card therefore claimed the child was backgrounded while the validctrl+bhint said it was still blocking.After:
Backgroundappears only when the outer tool call has completed while the child remains running. This is the shared state produced by eitherctrl+bdetachment or an immediatebackground: truelaunch. Foreground and failed calls are not mislabeled.How
packages/tui/src/routes/session/index.tsxderives the badge from the outer tool lifecycle plus structured child status and reuses normalized tool input/metadata.packages/tui/test/cli/tui/inline-tool-wrap-snapshot.test.tsxcovers foreground, detached/async, failed, and completed-child states.Scope
This does not change subagent execution, backgrounding lifecycle, notification icons, or keyboard behavior. Async-only hint suppression remains covered by #37088, subagent-picker presentation by #36480, and narrow footer action layout by #37180.
Testing
bun test test/cli/tui/inline-tool-wrap-snapshot.test.tsx(11 pass)bun run typecheckfrompackages/tuibun run lint packages/tui/src/routes/session/index.tsx packages/tui/test/cli/tui/inline-tool-wrap-snapshot.test.tsx(0 errors; existing warnings insession/index.tsx)bun turbo typecheck --concurrency=3(32/32 tasks)ses_099291c64ffep0rHSS1Yl4mq42confirms the reported card was foreground/running despite its false badgeDemo
Both recordings use the same Effect program, simulated model responses, 110×34 viewport, and held child-completion gates. Each run shows all three valid lifecycle paths:
ctrl+bavailable.ctrl+bdetaches that child, the card becomesBackground, and the parent continues before the child is released.background: true, immediately showsBackground, and the parent continues before that child is released.Before
The first foreground child is incorrectly labeled
Backgroundbeforectrl+bis pressed.recording-43f39979-7783-4f41-a4ec-2f700c36eef8.mp4
After
The first foreground child has no badge. The badge appears only after
ctrl+b, and still appears immediately for the explicit background launch.recording-700b759a-71f5-4997-8e11-1639adfacf38.mp4
The MP4s were exported with OpenCode Drive #12, which renders the intended
↳completion icon without the prior missing-glyph artifact.