# fix\(server\): a Claude wake run settles when Claude never opens the wake turn · PR \#19196 · pingdotgg/t3code

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

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

Visibility: public

State: merged

Source repository: Unavailable fork

Source branch: fix/claude-wake-turn-deadline

Target branch: main

Head commit: 9ae3de2f875d2e29cbd47c5ef650bec453f5a3a4

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

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

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

## Description

---

A Claude continuation can remain running indefinitely when it receives only a background subagent completion and Claude never opens a wake turn. This blocks later messages until the server restarts.

The continuation now completes after two minutes without root wake activity. Root messages and streaming keep an active wake turn open; child progress and child messages do not. Deadline settlement shares the SDK-message lock, checks the owning query and turn, and preserves pending Stop requests.

Maintainer takeover of the fix by @AdEx-Partners-DE in [#19196](https://github.com/pingdotgg/t3code/pull/19196). The contributor commits are preserved and current main is merged. The session-wide frame counter was replaced with per-turn wake evidence.

Verification on head [bfe0d93122](https://github.com/AdEx-Partners-DE/t3code/commit/bfe0d9312285d5cfb63ef6041eec61a2147b6d14):

- Existing test file: original 3 PR tests replaced with 3 deterministic regressions; 2 additional regressions cover child-only buffered output and root streaming. No new test files.
- Before: reverting the fix reproduces the missing deadline completion. The original PR also fails pending-Stop, child-only-buffer and root-streaming regressions.
- After: all 291 tests in `ClaudeAdapterV2.test.ts` pass, including all 5 wake-deadline regressions.
- Targeted lint, formatting, server typecheck, and diff whitespace checks pass.
- Maintainer integration pass: all 15 tests in `ClaudeReplayFixtures.integration.test.ts` and `BackgroundWorkStop.integration.test.ts` pass.

One independent review round (Claude Opus 5.5 and GPT-6 Sol) found no blockers. Both noted that existing query-exit cleanup remains asynchronous; the exact deadline/process-exit overlap was not reproduced.

This is server behavior shared by web, desktop and mobile, with no wire or client changes. Proof uses deterministic adapter events and the virtual clock; screenshots are not applicable. The rare real-Claude timing sequence was not reproduced live. macOS, Windows, Electron desktop, iOS and Android were not run on this headless Linux machine.

Model and harness: GPT-6 Astra (tests), GPT-6.1 Sol (implementation and maintainer integration), Claude Opus 5.5 and GPT-6 Sol (independent reviews), through T3 Code.

