Skip to content

fix(server): a background Claude subagent no longer looks frozen once its parent goes idle - #82

Merged
yordis merged 1 commit into
mainfrom
yordis/fix-native-subagent-live-items
Oct 6, 2026
Merged

yordis merged 1 commit into
mainfrom
yordis/fix-native-subagent-live-items

Conversation

@yordis

@yordis yordis commented Oct 6, 2026 •

Copy link
Copy Markdown
Member
  • When a parent turn ended while its Claude subagent kept running, the subagent's progress updates were dropped, so its card stayed frozen on whatever it showed at that moment, sometimes for most of an hour of active work.
  • A user watching a busy subagent could not tell it apart from a stuck one, which pushes them to interrupt work that was actually progressing.
  • The child thread view still shows a generic "Thinking" row until the subagent finishes; that is a separate follow-up.

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

… its parent goes idle

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
@cursor

cursor Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

PR Summary

Medium Risk
Changes orchestration event routing and turn-item projection for background subagents; behavior is scoped to idle-root task_progress but affects live UI state users rely on to judge whether work is stuck.

Overview
Background Claude subagents (run_in_background) can keep emitting task_progress after the parent turn settles; those frames were effectively ignored, so the subagent card and its turn item stayed stuck on the last progress shown before the root went idle.

ClaudeAdapterV2 now pins turn attribution on each active subagent (turnItemProviderThreadId / turnItemProviderTurnId) when the card is created or reopened, so updates do not depend on a live turn context. When there is no active turn and a task_progress arrives, a new path applyClaudeSubagentProgressWithoutActiveTurn updates the session subagent registry and emits subagent.updated plus turn_item.updated (still skipping settled or non-running tasks). That path is wired in the idle-root message handler instead of treating progress like wake evidence via bufferWakeMessage.

The claude_background_subagent_after_root fixture now asserts the latest idle-window progress is reflected on both the subagent and the subagent turn item mobile reads.

Reviewed by Cursor Bugbot for commit 62bacd1. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions github-actions Bot added the vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. label Oct 6, 2026
@coderabbitai

coderabbitai Bot commented Oct 6, 2026

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: TrogonStack/t3code/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 545d7059-0b6b-44d6-a5a8-c8e0fe7fc581
📥 Commits

Reviewing files that changed from the base of the PR and between 25a4fce and 62bacd1.

📒 Files selected for processing (2)
  • apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts
  • apps/server/src/orchestration-v2/testkit/fixtures/claude_background_subagent_after_root/output.ts

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The Claude adapter now applies idle task_progress frames to running subagents. It retains provider thread and turn attribution for turn-item updates. The fixture checks that the subagent and its turn item report the latest progress.

Changes

Idle Subagent Progress

Layer / File(s) Summary
Retain subagent provider attribution
apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts
Subagents retain their provider thread and turn attribution. Reopening a terminal subagent as running updates that attribution.
Apply idle progress to running subagents
apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts, apps/server/src/orchestration-v2/testkit/fixtures/claude_background_subagent_after_root/output.ts
Idle task_progress frames update running subagents and emit subagent and turn-item updates using stored attribution. The fixture checks that both report the latest progress.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: juliusmarminge

Merge Risk: ⚪ Minimal · up to 62bac

The idle subagent progress change is mergeable after normal checks; no actionable issue remains.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the problem, but it does not include the required Change, Scope and approval, or Verification sections. It also omits the Problem heading. Add the required sections. Explain how the change fixes the issue, provide the linked issue or maintainer approval (or explain why this focused bug fix needs no prior approval), and describe the focused verification performed and its result…
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: keeping a background Claude subagent’s progress visible after its parent goes idle.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Resolution

Add the required sections. Explain how the change fixes the issue, provide the linked issue or maintainer approval (or explain why this focused bug fix needs no prior approval), and describe the focused verification performed and its results. Include the Problem heading for consistency with the template.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the size:L label Oct 6, 2026
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 4.9 KiB 4.9 KiB 0 B (0.0%) 6.8 KiB ✅
Codex Thread snapshot wire 3.7 KiB 3.7 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.4 KiB 20.4 KiB 0 B (0.0%) 29.3 KiB ✅
Codex Live turn messages 2 2 0 (0.0%) 8 ✅
Claude Total thread wire 4.9 KiB 4.9 KiB 0 B (0.0%) 6.8 KiB ✅
Claude Thread snapshot wire 3.7 KiB 3.7 KiB 0 B (0.0%) 4.9 KiB ✅
Claude Live turn WebSocket wire 1.2 KiB 1.2 KiB 0 B (0.0%) 2.0 KiB ✅
Claude Live turn WebSocket decoded 20.8 KiB 20.8 KiB 0 B (0.0%) 29.3 KiB ✅
Claude Live turn messages 2 2 0 (0.0%) 8 ✅

Baseline: 25a4fce · PR result: 62bacd1 · 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: 106.1 KiB
  • Claude decoded thread snapshot: 106.4 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

@yordis
yordis merged commit cdb3b34 into main Oct 6, 2026
29 of 30 checks passed
@yordis
yordis deleted the yordis/fix-native-subagent-live-items branch October 6, 2026 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant