Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(clients): a thread comes back when its subagent needs approval #19630

Mergedt3dotgg(GitHub profile, opens in a new tab)merged 2 commits intomain fromrefs/pull/19630/headmerged by t3dotgg(GitHub profile, opens in a new tab) View on GitHub

Problem

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: canSnooze refuses a parent whose subagent waits.
  • Tests for the touched files pass. Typecheck passes for client-runtime, web, and mobile.
  • 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 between main and this change.
Before (main)After
Before: parent stays in WorkingAfter: parent shows Approval and the banner
"Open approval" opens the child's requestAlert while another thread is open
Open approval goes to the child's approval cardApproval needed toast for the parent

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

    2. juliusmarminge added labelsmacroscope-review

    3. 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).
    4. Thread transfer impact

      ✅ Thread transfer remains within every enforced ceiling.

      ProviderMetricMain baselineThis PRImpactPR ceiling
      CodexTotal thread wire5.0 KiB5.0 KiB0 B (0.0%)6.8 KiB✅
      CodexThread snapshot wire3.8 KiB3.8 KiB0 B (0.0%)4.9 KiB✅
      CodexLive turn WebSocket wire1.2 KiB1.2 KiB0 B (0.0%)2.0 KiB✅
      CodexLive turn WebSocket decoded20.9 KiB20.9 KiB0 B (0.0%)29.3 KiB✅
      CodexLive turn messages220 (0.0%)8✅
      ClaudeTotal thread wire5.0 KiB5.0 KiB−7 B (−0.1%)6.8 KiB✅
      ClaudeThread snapshot wire3.8 KiB3.8 KiB0 B (0.0%)4.9 KiB✅
      ClaudeLive turn WebSocket wire1.2 KiB1.2 KiB−7 B (−0.6%)2.0 KiB✅
      ClaudeLive turn WebSocket decoded21.2 KiB21.2 KiB0 B (0.0%)29.3 KiB✅
      ClaudeLive turn messages220 (0.0%)8✅

      Baseline: 348f217 · PR result: 7d0f426 · Source CI: success

      Scenario 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.

    5. Review in Change Stack →

      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.ts
      • apps/mobile/src/features/threads/ThreadDetailScreen.tsx
      • apps/mobile/src/features/threads/threadListV2.ts
      • apps/web/src/components/ChatView.tsx
      • apps/web/src/components/Sidebar.logic.ts
      • apps/web/src/components/ThreadNotificationCoordinator.test.tsx
      • apps/web/src/components/ThreadNotificationCoordinator.tsx
      • packages/client-runtime/src/state/models.ts
      • packages/client-runtime/src/state/threadInbox.ts
      • packages/client-runtime/src/state/threadSettled.ts
      • packages/client-runtime/src/state/threadShell.test.ts
      • packages/client-runtime/src/state/threadShell.ts
      • packages/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.ts
      The 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.ts
      Pending 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.tsx
      The 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 changes

      Suggested 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: Passed 4
      Passed Passed checks: 4 passed
      Check nameStatusExplanation
      Title checkPassedThe title is concise, uses the conventional commit format, and clearly identifies the main fix: restoring parent-thread visibility when a subagent needs approval.
      Description checkPassedThe 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 checkPassedCheck skipped because no linked issues were found for this pull request.
      Out of Scope Changes checkPassedCheck 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
      Comment `@coderabbitai help` to get the list of available commands.

Sign in to join this conversation.