fix(client): "Subagent needs input" no longer sticks after the subagent finishes #18996
main fromrefs/pull/18996/head·merged by shivamhwp(GitHub profile, opens in a new tab) View on GitHubCloses #18978
Problem#
A subagent can leave an async question pending after its run ends (Codex does this on purpose so the question stays answerable). The parent's "Subagent needs input" pill counted any pending question on a child, so after the subagent finished, the parent kept showing the pill forever, even when it was just waiting on a plain reply from the user.
Fix#
The shared childThreadInputsAtom now only counts a subagent's question while that subagent still has a live run (its activityRunStatus is set). A finished subagent stops lighting up the parent. A follow-up queued behind a run that is blocked on a question doesn't hide it. Older servers that don't send activityRunStatus fall back to the latest run's status. The question is still on the subagent's own thread if someone opens it.
This is in packages/client-runtime, so web, desktop and mobile all get it. It's client-only, so it also clears questions that are already stuck in existing databases.
Related: #18459 closes these questions on the server when a Codex task ends. That helps going forward, but questions that are already stuck stay pending. This PR fixes the pill either way.
Evidence#
Android, POCO F4, dev client. Test data: a parent Claude thread delegated a tiny task, the subagent finished, and the parent ended with a plain question. A pending async question was left on the finished subagent (what a Codex subagent leaves behind).
| Before (main) | After (this PR) |
|---|---|
| Full video | Full video |
Before: the subagent shows Completed, but "Subagent needs input" still shows. After: no pill.
Testing#
vp test run src/state/threadShell.test.tsinpackages/client-runtime: new test covers running, queued-behind-a-blocked-run, completed and older-server shells. It fails without the fix, and the queued case fails with a status-only check.- Lint and typecheck for
packages/client-runtimepass.
Fixed with Claude Opus 5.5 in Claude Code, run through T3 Code.
🤖 Generated with Claude Code
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XS
Approvability#
Verdict: Approved at
f726d1cMacroscope's review found this PR approvable — The change is a narrowly scoped client-side bug fix that removes a stale “Subagent needs input” indicator while preserving active and queued-question cases. It adds targeted coverage and has no schema, server-processing, product-default, or static-analysis implications.
No code changes detected at
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).afe50db. Prior analysis still applies.Important
Review skipped#
Review was skipped as selected files did not have any reviewable changes.
⚙️ Run configuration
-
- Configuration used: Path: .coderabbit.config.ts
- Review profile: CHILL
- Plan: Advanced
- Run ID:
496c0053-254f-45cb-ab26-0b957b1fafa8
📥 Commits
-
Reviewing files that changed from the base of the PR and between afe50dbbf88362c6b043465a430f61809ea44066 and 62c88e2b66abca2bd13f4b341a64ea8afcd3bf4a.
You can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
- 🔍 Trigger review
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
-
⚙️ Run configuration
-
- Configuration used: Path: .coderabbit.config.ts
- Review profile: CHILL
- Plan: Advanced
- Run ID:
b79d7e19-4ae8-4295-812b-8bfcf1c86bfd
📥 Commits
-
Reviewing files that changed from the base of the PR and between a53e4a8ffa5abbe688764cc44f0e71a3e283f31f and f726d1c61eca4a8a64b5401d8a65583966a44b56.
📒 Files selected for processing (2)
-
packages/client-runtime/src/state/threadShell.test.tspackages/client-runtime/src/state/threadShell.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
-
📝 Walkthrough
-
Child-thread input summaries now include pending user-input requests only when the child run is live and the child is not a provider-native subagent. The live-status check uses
activityRunStatuswhen present and overall status for legacy snapshots.Changes: Child-thread input summaries
Layer / File(s) Summary Live child-run filtering
packages/client-runtime/src/state/threadShell.ts,packages/client-runtime/src/state/threadShell.test.tsThe child-input list now filters pending user-input requests by whether the child run is live. Tests cover running and queued children, completed children, and a completed legacy snapshot without activityRunStatus.Priority: ➖ Normal
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix · Severity of issue fixed: Low
Suggested reviewers:
juliusmarminge
### Architecture SummaryMerge Risk: ⚪ Minimal · up to
f726d-
The parent badge should clear when a subagent finishes while still appearing for live pending questions. No merge-blocking issue is identified.
Architecture risk: 🟡 Medium · up to
f726dThe change affects 1 system.
Changed systems:
packages/client-runtimeArchitecture concerns No architecture-level concerns identified.
Review details
-
Systems and components
- observed — packages/client-runtime (library) was modified; 2 changed files map to changed impact.
Before / after behavior
- observed — Modified behavior in packages/client-runtime/src/state/threadShell.test.ts: The test adds the
RuntimeRequestIdimport. - observed — Modified behavior in packages/client-runtime/src/state/threadShell.test.ts: The test adds the
v2Nowfixture import. - observed — Modified behavior in packages/client-runtime/src/state/threadShell.test.ts: A test is added for parent child-input aggregation: a running subagent with a pending user-input request is included, remains included when queued, and is excluded when completed. The test also checks exclusion for a completed legacy snapshot without
activityRunStatus. - observed — Modified behavior in packages/client-runtime/src/state/threadShell.ts: Adds
isChildRunLive: whenactivityRunStatusis defined, only a non-null value counts as live; otherwise, the helper checks whetherstatusispreparing,starting,running, orwaiting.
Reliability and maintainability
- inferred — Risk-relevant change factors for packages/client-runtime: blast_radius_1; direct_dependents_1
Pre-merge checks:
4-
Passed checks (4 passed)-
Check name Status Explanation Linked Issues check Issue #18978requires the “Subagent needs input” badge to appear only while a subagent is waiting.childThreadInputsAtomnow requires a pendinguser_inputrequest and a live child run. It treats a…Out of Scope Changes check The pull request changes only the client-runtime child-input filter and its focused test. The live-run filter directly addresses issue #18978. The test supports that behavior and no unrelated change i…Title check The title clearly and concisely describes the main fix: preventing the “Subagent needs input” indicator from remaining after a subagent finishes. Description check The description explains the problem, expected behavior, implementation, scope, linked issues, evidence, focused tests, lint, typecheck, and manual verification. It uses “Fix” and “Testing” headings i…
-
✨ Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
-
juliusmarminge added labelsmacroscope-review
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:XS
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:S
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes
shivamhwp(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.
macroscopeapp[bot](GitHub profile, opens in a new tab) reviewed