Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(client): "Subagent needs input" no longer sticks after the subagent finishes #18996

Mergedshivamhwp(GitHub profile, opens in a new tab)merged 5 commits intomain fromrefs/pull/18996/headmerged by shivamhwp(GitHub profile, opens in a new tab) View on GitHub

Closes #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 videoFull video

Before: the subagent shows Completed, but "Subagent needs input" still shows. After: no pill.

Testing

  • vp test run src/state/threadShell.test.ts in packages/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-runtime pass.

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

    2. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Approved at f726d1c

      Macroscope'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 afe50db. Prior analysis still applies.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    3. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      Review in Change Stack →

      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_status to false in 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.ts
      • packages/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 activityRunStatus when 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.ts
      The 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

      Merge 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 Summary

      Architecture risk: 🟡 Medium · up to f726d

      The change affects 1 system.

      Changed systems: packages/client-runtime

      Architecture 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 RuntimeRequestId import.
      • observed — Modified behavior in packages/client-runtime/src/state/threadShell.test.ts: The test adds the v2Now fixture 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: when activityRunStatus is defined, only a non-null value counts as live; otherwise, the helper checks whether status is preparing, starting, running, or waiting.

      Reliability and maintainability

      • inferred — Risk-relevant change factors for packages/client-runtime: blast_radius_1; direct_dependents_1
      Pre-merge checks: Passed 4
      Passed Passed checks (4 passed)
      Check nameStatusExplanation
      Linked Issues checkPassedIssue #18978 requires the “Subagent needs input” badge to appear only while a subagent is waiting. childThreadInputsAtom now requires a pending user_input request and a live child run. It treats a…
      Out of Scope Changes checkPassedThe 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 checkPassedThe title clearly and concisely describes the main fix: preventing the “Subagent needs input” indicator from remaining after a subagent finishes.
      Description checkPassedThe 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
      Comment `@coderabbitai help` to get the list of available commands.
    4. juliusmarminge added labelsmacroscope-review

Sign in to join this conversation.