Skip to content

fix(server): Claude subagents resumed after a missed launch get their child thread - #18362

Open
Gigioxx wants to merge 1 commit into
pingdotgg:mainfrom
Gigioxx:fix/claude-recovered-subagent-child-thread
Open

Gigioxx wants to merge 1 commit into
pingdotgg:mainfrom
Gigioxx:fix/claude-recovered-subagent-child-thread

Conversation

@Gigioxx

@Gigioxx Gigioxx commented Oct 11, 2026

Copy link
Copy Markdown
Contributor

Problem

If T3 misses a Claude subagent's launch (in #18319 the disk filled up mid-run) and a later turn resumes that subagent with SendMessage, its card shows as Working but opening it shows "Thread unavailable". The subagent's childThreadId points at a thread that was never created.

recoverResumedClaudeSubagent registers the unknown subagent with childThread: null, assuming the child thread already exists from before a restart. The reopen then skips app_thread.created, because that event is only sent for subagents seen for the first time.

Change

  • The reopen of a recovered subagent now sends app_thread.created with a new createOnly flag.
  • The ingestor drops a createOnly event when the thread already exists. The normal restart case keeps the child thread's title and model, and the missed-launch case gets its thread created.

Scope and approval

Fixes #18319. Triaged and accepted by @juliusmarminge, who confirmed the cause and the create-only fix shape in the issue comments. Separate from #16261 and #17596.

Verification

  • ClaudeAdapterV2.test.ts > "projects workflow member threads after resuming a restarted session" resumes a subagent through the recovery path. It now expects one create-only app_thread.created for the recovered subagent's child thread. Fails on main (expected [] to deeply equal [ true ]), passes with this change.
  • ProviderEventIngestor.test.ts > "updates provider child metadata without recreating its saved thread" now also checks that a create-only event with a different title leaves the existing thread alone. Fails without the ingestor change, passes with it.
  • vp test run on ProviderEventIngestor.test.ts, ClaudeAdapterV2.test.ts, RunExecutionService.test.ts, and ClaudeAutomaticDelivery.integration.test.ts: 298 passed.
  • tsc --noEmit in apps/server and packages/provider-core: no errors. Targeted lint and format are clean.
  • Not checked: a live run where T3 misses a real launch (needs a full disk or a dropped ingestion).
  • Independent review: Codex (GPT-6 Astra, medium) reviewed the diff against main and found no issues.

Created with Claude Opus 5.5 in Claude Code (T3 Code), reviewed by GPT-6 Astra in Codex CLI.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Oct 11, 2026
@juliusmarminge juliusmarminge added the macroscope-review Opt PRs made by unvouched contributors in for Macroscope review. Vouched contributors auto-reviews label Oct 11, 2026 — with ChatGPT Codex Connector
@macroscopeapp

macroscopeapp Bot commented Oct 11, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at c87221f

Macroscope's review found this PR approvable — This is a localized Claude resume bug fix that restores missing child-thread creation while preserving existing thread metadata. The optional event field is backwards-compatible and the recovery behavior is covered by targeted tests.

You can add or adjust custom eligibility rules. Learn more.

@coderabbitai

coderabbitai Bot commented Oct 11, 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: Path: .coderabbit.config.ts
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b3e9cfe0-7a00-45e4-83e8-43471d9f4929

📥 Commits

Reviewing files that changed from the base of the PR and between c0c495e and c87221f.


📒 Files selected for processing (5)
  • apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts
  • apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts
  • apps/server/src/orchestration-v2/ProviderEventIngestor.test.ts
  • apps/server/src/orchestration-v2/ProviderEventIngestor.ts
  • packages/provider-core/src/server/ProviderAdapter.ts

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



📝 Walkthrough

Walkthrough

When a resumed Claude subagent reopens, ClaudeAdapterV2 emits a child-thread creation event marked createOnly. The event ingestor does not store that event when the child thread already exists, so its metadata remains unchanged.

Changes

Claude subagent child-thread recovery

Layer / File(s) Summary
Create-only event handling
packages/provider-core/src/server/ProviderAdapter.ts, apps/server/src/orchestration-v2/ProviderEventIngestor.ts, apps/server/src/orchestration-v2/ProviderEventIngestor.test.ts
The app_thread.created event accepts optional createOnly. For an existing thread, the ingestor stores no event when createOnly is true, even if title or model selection differs. A test covers this case.
Recovered subagent thread creation
apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts, apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts
ClaudeAdapterV2 emits a child-thread creation event for recovered subagents with createOnly: true. Newly discovered subagents continue to omit the flag. The workflow-resume test checks for the flag.

Priority: ➖ Normal

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

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: juliusmarminge


Merge Risk | ⚪ Minimal · up to c8722

Merge Risk: ⚪ Minimal · up to c8722

Recovery creates the child thread referenced by the subagent card when it is missing, while preserving existing thread metadata. No concrete merge-blocking risk remains.

Security Architecture Review

Security architecture risk: 🔵 Low · up to c8722

The change is narrowly scoped and preserves existing threads. Recovery after another interrupted or failed save has not been fully established.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The evidenced effect is bounded to creating recovered child-thread records and preserving existing thread metadata in the server persistence path. Deployment-wide or cross-repository exposure was not established.

Trust Boundaries and Controls

  • inferred — On the inspected path, createOnly narrows metadata mutation rather than introducing an authorization bypass. Recovery uses existing task-history and registry checks, and the exported contract is consumed through internal event routing rather than a newly introduced external endpoint.

Resilience and Maintainability Implications

  • observed — Per-thread ingestion serialization and transactional event/projection writes contain duplicate delivery and partial database writes. These controls do not acknowledge persistence back to the adapter: it records childThread after queue emission, and the existing ingestion-failure handler attempts run finalization rather than explicitly retrying the announcement.

Hardening Proposals

  • proposed — If stronger interruption guarantees are required, consider acknowledged persistence or safely re-offering the create-only announcement on later resumes. This would strengthen recovery delivery; it is not a verified PR-introduced security finding.

Pre-merge checks | Passed 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description check Passed The description includes complete Problem, Change, Scope and approval, and Verification sections. It explains the failure mode, implementation, issue approval, focused test coverage, observed results,…
Title check Passed The title clearly identifies the main fix: resumed Claude subagents receive their missing child thread after a missed launch. It uses a concise conventional commit format and is specific to the change…
Linked Issues check Passed Issue #18319 requires a child thread for a Claude subagent recovered after T3 missed its launch. ClaudeAdapterV2.ts now emits app_thread.created during the recovered subagent reopen with `createOn…
Out of Scope Changes check Passed The changes stay within #18319. The adapter change triggers recovery-time thread creation, the ingestor change preserves existing thread metadata, the provider event schema carries the new flag, and t…

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

AdEx-Partners-DE added a commit to AdEx-Partners-DE/t3code that referenced this pull request Oct 12, 2026
… child thread (adopts upstream pingdotgg#18362)

Own diff of pingdotgg#18362 at c87221f, applied on stark/main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

macroscope-review Opt PRs made by unvouched contributors in for Macroscope review. Vouched contributors auto-reviews size:S 10-29 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: A Claude subagent resumed after T3 missed its launch never gets a child thread, so opening it shows "Thread unavailable"

2 participants