# fix\(server\): wait for delegated Claude background wake results · PR \#24391 · pingdotgg/t3code

[View on GitCafe](https://git.cafe/pingdotgg/t3code/pull/24391)

Repository: [pingdotgg/t3code](https://git.cafe/pingdotgg/t3code)

Visibility: public

State: open

Source repository: pingdotgg/t3code

Source branch: fix/issue-24297

Target branch: main

Head commit: 0a26c94c757e685e910fb3df4390efcebfadbc8a

[Discussion and reviews](https://git.cafe/pingdotgg/t3code/pull/24391)

[Commits](https://git.cafe/pingdotgg/t3code/pull/24391/commits?format=markdown)

[Files changed](https://git.cafe/pingdotgg/t3code/pull/24391/diffs?format=markdown)

## Description

---

## Problem

An async delegated Claude child can finish its first turn while a background Bash command runs. When reviewers finish before that command, the command's exit clears the published roster before Claude's wake run is registered. The original task then completes with the stale interim result and never delivers the later final result.

Reproduced on Linux with Claude Opus 5.5: a background `sleep 45`, two delegated reviewers running foreground `sleep 2` and `sleep 3`, and no parent polling or manual follow-ups.

## Change

Keep previously published background tasks visible while the idle Claude session still owes their wake run, covering either ordering of the SDK's roster snapshot and task notification. The internal roster still clears immediately, preserving query replacement and background-work checks. Wake completion and existing process-reset paths release the published hold.

## Scope and approval

Fixes https://github.com/pingdotgg/t3code/issues/24297
GitCafe: https://git.cafe/pingdotgg/t3code/issues/24297

Triaged bug via the automated issue flow. Changes are limited to the Claude server adapter and its existing regression tests.

## Verification

- Red test at [c6008634a5](https://github.com/pingdotgg/t3code/commit/c6008634a5): the adapter publishes an empty roster before the wake run starts. [Failing output](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/beb16c710da56738/red-test.txt).
- `vp test run apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts`: **211/211 passed** on [0a26c94c75](https://github.com/pingdotgg/t3code/commit/0a26c94c757e685e910fb3df4390efcebfadbc8a). Includes notification-only, snapshot-before-notification, and snapshot-after-notification orderings. [Passing output](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/e2829415a763e1b2/green-test.txt).
- Server typecheck: zero errors. Scoped lint: only the existing unused `layer` warning.
- Fresh Codex and Claude reviews passed after fixing the snapshot-ordering finding. Independent proof audit matched the runtime transcript to persisted events and confirmed exactly one automatic final-result delivery.
- Runtime environment: fs-01 Ubuntu Linux, isolated web dev server and browser at 1280×800, Claude Agent with `claude-opus-5-5`; Codex parent. A parent restart before the final delegation is disclosed in the transcript; all four subsequent child runs completed without interruption.

| Evidence | Before — [27e0c684c5](https://github.com/pingdotgg/t3code/commit/27e0c684c585f955252d65f06206dd11a143bff5) | After — [0a26c94c75](https://github.com/pingdotgg/t3code/commit/0a26c94c757e685e910fb3df4390efcebfadbc8a) |
| --- | --- | --- |
| Original delegated task across background exit | Task completes at 10:11:06.026 with `STILL_BACKGROUND`; wake starts at 10:11:06.165 and its final result is orphaned. [Runtime transcript](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/763a360a2b657e29/before-runtime.txt). | Final result at 10:31:56.727; task completes afterward at 10:31:57.357; exactly one parent delivery at 10:31:57.507 contains `FINAL_FINALCHECK_24297`. [Runtime transcript](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/a7c012cea71296a7/final-runtime.txt). |

[Evidence index](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/730cb6a94354f851/final-runtime-index.md), [extraction driver](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/90db0ba476e0396c/final-runtime-driver.py), [proof matrix](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/d31bce7376fd61fd/issue-24297-pass1-proof-audit.md). Server-only change: zero affected render rows; no client or platform-specific code changed.

Implemented with Claude Opus 5.5 in Claude Agent; reviewed with GPT-6.1-Sol in Codex and Claude Opus 5.5 in Claude Agent; issue lead GPT-6.1-Sol in Codex, through T3 Code.

