fix(clients): a thread comes back when its subagent needs approval #19630
main fromrefs/pull/19630/head·merged by t3dotgg(GitHub profile, opens in a new tab) View on GitHubProblem#
When a delegated subagent waits on an approval, its parent thread stays in Working. You get no alert and no badge. You can't tell anything is waiting unless you open the subagent.
Subagent rows are hidden in the sidebar, and only the subagent's own thread summary carries its pending request. So the parent's status, the Working section, notifications, and the mobile list all say "working". #16634 already put a subagent's question in the parent's composer banner, but only questions, and only inside the open parent.
Fix#
Each thread above a live subagent now carries what that subagent waits on (pendingSubagentRequest: approval or user_input). client-runtime works this out from the shell summaries clients already have, so nothing new goes over the wire.
- Working section (web and mobile): the parent goes back to the active list.
- Status (web sidebar and pill, mobile list): shows Pending Approval / Awaiting Input.
- Notifications (web and desktop): "Approval needed" / "Input needed" fire on the parent.
- Snooze: a snoozed parent wakes. A parent can't be snoozed while its subagent waits, the same as for its own requests.
- Composer banner (web and mobile): "Subagent needs approval" with "Open approval", in addition to questions.
Nested subagents pass the request up to the visible thread. An approval outranks a question. Provider-native subagents are skipped, because they already ask on their parent. Each environment computes this once per shell change, and unchanged summaries keep their identity, so lists don't re-render.
Not included: mobile push and Live Activity alerts. They come from the server's agent-awareness relay, which also skips subagent threads. That is a separate server change.
Verification#
threadShell.test.ts: a parent leaves Working when a nested subagent asks for a command approval, and goes back when the request clears. Fails without the fix.ThreadNotificationCoordinator.test.tsx: the parent alerts "Approval needed" while its own summary object does not change. Fails without the fix.threadSnoozed.test.ts:canSnoozerefuses a parent whose subagent waits.- Tests for the touched files pass. Typecheck passes for
client-runtime,web, andmobile. - Live check by the original author in a dev client: a Codex parent delegated a task with
runtimeMode: "approval-required", and the child asked for a command approval. Only the client files were swapped betweenmainand this change.
Before (main) | After |
|---|---|
![]() | ![]() |
| "Open approval" opens the child's request | Alert while another thread is open |
|---|---|
![]() | ![]() |
Credit#
Takes over #19614 by @LovelyCodeMonkey. Their commit is kept as is. I added the snooze guard on top.
Reviewed with sol-loop: 1 round with GPT-6.1-Sol.
Written by Claude Opus 5.5 in Claude Code, run from T3 Code.
🤖 Generated with Claude Code
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
juliusmarminge added labelsmacroscope-review
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
Thread transfer impact#
✅ Thread transfer remains within every enforced ceiling.
Provider Metric Main baseline This PR Impact PR ceiling Codex Total thread wire 5.0 KiB 5.0 KiB 0 B (0.0%) 6.8 KiB ✅ Codex Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB ✅ Codex Live turn WebSocket wire 1.2 KiB 1.2 KiB 0 B (0.0%) 2.0 KiB ✅ Codex Live turn WebSocket decoded 20.9 KiB 20.9 KiB 0 B (0.0%) 29.3 KiB ✅ Codex Live turn messages 2 2 0 (0.0%) 8 ✅ Claude Total thread wire 5.0 KiB 5.0 KiB −7 B (−0.1%) 6.8 KiB ✅ Claude Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB ✅ Claude Live turn WebSocket wire 1.2 KiB 1.2 KiB −7 B (−0.6%) 2.0 KiB ✅ Claude Live turn WebSocket decoded 21.2 KiB 21.2 KiB 0 B (0.0%) 29.3 KiB ✅ Claude Live turn messages 2 2 0 (0.0%) 8 ✅ Baseline:
348f217· PR result:7d0f426· Source CI: successScenario and decoded snapshot size
10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
- Codex decoded thread snapshot: 108.5 KiB
- Claude decoded thread snapshot: 108.8 KiB
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
-
⚙️ Run configuration
-
- Configuration used: Path: .coderabbit.config.ts
- Review profile: CHILL
- Plan: Team
- Run ID:
02d00fbc-c6aa-4b3b-9de0-96b608c92db4
📥 Commits
-
Reviewing files that changed from the base of the PR and between 348f217a853dd4a23d7fa4834dedb05f545c2075 and 7d0f426558f7fb7d8ca26f6429a04a6cc0ba20ac.
📒 Files selected for processing: 13
-
apps/mobile/src/features/home/useThreadListActions.tsapps/mobile/src/features/threads/ThreadDetailScreen.tsxapps/mobile/src/features/threads/threadListV2.tsapps/web/src/components/ChatView.tsxapps/web/src/components/Sidebar.logic.tsapps/web/src/components/ThreadNotificationCoordinator.test.tsxapps/web/src/components/ThreadNotificationCoordinator.tsxpackages/client-runtime/src/state/models.tspackages/client-runtime/src/state/threadInbox.tspackages/client-runtime/src/state/threadSettled.tspackages/client-runtime/src/state/threadShell.test.tspackages/client-runtime/src/state/threadShell.tspackages/client-runtime/src/state/threadSnoozed.test.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
-
The runtime now derives pending approval and input requests from eligible subagents and propagates them to parent thread shells. Thread state, notifications, and mobile and web interfaces use these requests to update working status, snooze eligibility, alerts, and displayed labels.
Changes: Subagent request handling
Layer / File(s) Summary Derive and propagate subagent requests
packages/client-runtime/src/state/models.ts,packages/client-runtime/src/state/threadShell.ts,packages/client-runtime/src/state/threadShell.test.tsThe runtime classifies eligible subagent requests, propagates them through parent threads, and includes them in presented shells and child-input lists. Tests cover nested subagent approval state. Apply requests to working and snooze state
packages/client-runtime/src/state/threadInbox.ts,packages/client-runtime/src/state/threadSettled.ts,packages/client-runtime/src/state/threadSnoozed.test.ts,apps/mobile/src/features/home/useThreadListActions.ts,apps/mobile/src/features/threads/threadListV2.tsPending subagent requests affect working status, snooze eligibility, and thread-list status. Snooze tests cover pending approval requests. Show requests in notifications and thread interfaces
apps/web/src/components/ThreadNotificationCoordinator.tsx,apps/web/src/components/ThreadNotificationCoordinator.test.tsx,apps/web/src/components/ChatView.tsx,apps/web/src/components/Sidebar.logic.ts,apps/mobile/src/features/threads/ThreadDetailScreen.tsxThe notification coordinator detects changed requests and emits an approval alert. Mobile and web interfaces display request-specific labels, icons, and status. Priority: ➖ Normal
Estimated code review effort: 3 (Moderate) | ~25 minutes
Change: Bug fix
Sequence Diagram(s)#
sequenceDiagram participant ThreadNotificationCoordinator participant RequestMap participant ThreadShell participant InAppAlert ThreadNotificationCoordinator->>RequestMap: derive pending requests by parent thread RequestMap-->>ThreadNotificationCoordinator: return request kinds ThreadNotificationCoordinator->>ThreadShell: present parent with its request ThreadNotificationCoordinator->>InAppAlert: emit approval alert when request changesSuggested reviewers:
juliusmarminge
Merge Risk: ⚪ Minimal · up to
7d0f4-
Parent threads can surface delegated approval and input requests across the affected status and notification paths. No issue identified here blocks merging after normal checks.
Pre-merge checks:
4-
Passed checks: 4 passed-
Check name Status Explanation Title check The title is concise, uses the conventional commit format, and clearly identifies the main fix: restoring parent-thread visibility when a subagent needs approval. Description check The description clearly covers the problem, implementation, scope boundaries, verification, and UI evidence. It uses a “Fix” heading instead of the template’s “Change” heading and does not include a s… Linked Issues check Check skipped because no linked issues were found for this pull request. Out of Scope Changes check Check skipped because no linked issues were found for this pull request.
-
✨ Finishing Touches
-
📝 Generate docstrings
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
-
t3dotgg(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.




Approvability#
Verdict: Not approved
Macroscope's review found this PR not approvable — This change propagates hidden subagent approval/input state into shared client runtime behavior, affecting inbox placement, statuses, notifications, banners, and snooze behavior across web and mobile. The intent is clear and tested, but the breadth of existing-path changes and nontrivial shared-state logic warrant human review.
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).