Skip to content

fix(server): threads stay working while Claude starts a wake turn - #15055

Merged
t3dotgg merged 1 commit into
mainfrom
t3code/working-status-flicker
Oct 3, 2026
Merged

t3dotgg merged 1 commit into
mainfrom
t3code/working-status-flicker

Conversation

@t3dotgg

@t3dotgg t3dotgg commented Oct 3, 2026

Copy link
Copy Markdown
Member

Problem

A Claude thread that waits on a background command leaves "working", drops back into the inbox for a few seconds, then returns to "working" when Claude reacts to the finished command.

The adapter started the wake run only at the wake turn's first assistant/user frame. Claude thinks before that frame. In the local provider logs, init to first output took 3 to 49 s (often 5 to 30 s). During that time the roster was already empty and no run existed, so the thread looked done.

From the reported thread (8092e030):

05:38:29.230  task_notification   background command done, roster clears
05:38:29.293  system/init         Claude starts the wake turn
05:38:33.088  first assistant     wake run created (05:38:33.131)

#15029 stops the timer reset on wakes, but not this status gap.

Change

Claude opens every turn with a root system/init frame. With no T3 turn active, that turn is a wake. In 28 out of 28 idle notifications in the local logs, init came 21 to 108 ms after the notification.

  • bufferWakeMessage buffers that init and offers the wake continuation on it.
  • The continuation drain counts a buffered init as a native wake frame. The run stays open for the live output and does not settle at once.

The gate for a notification alone is unchanged: with no init, no run starts.

This also covers a background task that ends while a turn is still running. In that case the wake turn has no buffered notification, and before this change it got a run only at its own result.

Claude only. The other adapters detect wakes in their own way.

Scope and approval

Small, focused fix of a bug Theo reported.

Verification

  • New test starts the wake run when Claude opens the wake turn, before its output. It fails on main (no continuation request after init). It also fails when only the drain change is reverted (the run settles before the output).
  • ClaudeAdapterV2.test.ts, ClaudeReplayFixtures.integration.test.ts, ProviderContinuationService.test.ts, runtimeLayer.test.ts: 204 tests pass. The Orchestrator replay fixture suites pass (129).
  • apps/server typecheck is clean.

Not checked: a live run in the desktop app. The roster still clears about 60 to 150 ms before the new run appears, so a very short blink can remain.

Created with Claude Opus 5.5 in Claude Code (T3 Code).

🤖 Generated with Claude Code

When background work finished while the root was idle, the Claude adapter
started the wake run only at the wake turn's first output. Claude thinks for
3 to 49 s before that, so the thread showed as done, left the Working shelf,
then came back. Claude opens every turn with a root `init` frame about
20-110 ms after the notification. The adapter now starts the wake run on
that frame, and the drain keeps the run open for the output that follows.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added the vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. label Oct 3, 2026
@juliusmarminge juliusmarminge added the macroscope-review Opt PRs made by unvouched contributors in for Macroscope review. Vouched contributors auto-reviews label Oct 3, 2026
@github-actions github-actions Bot added the size:M 30-99 changed lines (additions + deletions). label Oct 3, 2026
Comment thread apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts
@coderabbitai

coderabbitai Bot commented Oct 3, 2026

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

🧰 Additional context used
📚 Code guidelines (1)
docs/internals/effect-services.md — configured

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: pingdotgg/t3code/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Team
  • Run ID: 979396a0-21c1-4429-863c-dd7d04310b17
📥 Commits

Reviewing files that changed from the base of the PR and between d1034d6 and b46ff07.

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

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


📝 Walkthrough

Walkthrough

ClaudeAdapterV2 now recognizes a root init frame as wake-turn evidence and as native wake output during buffered drains. A lifecycle test checks when a continuation is offered and when it completes.

Changes

Claude wake-turn handling

Layer / File(s) Summary
Recognize init frames during wake handling
apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts, apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts
Wake detection and buffered-drain handling now include root init frames. The test verifies that the notification alone does not offer a continuation, that the init frame does, and that the run waits for assistant and result frames before completing.

Priority: ➖ Normal

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

Change: Bug fix

Suggested reviewers: juliusmarminge

Merge Risk: ⚪ Minimal · up to b46ff

No actionable issue is established for the Claude wake-turn change; it is ready to merge after normal checks.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the fix: keeping threads working while Claude starts a wake turn.
Description check ✅ Passed The description covers the problem, change, scope and approval rationale, and verification. It also states the live desktop-app check was not performed and notes the remaining status gap.
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.
  • 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

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

@macroscopeapp

macroscopeapp Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at b46ff07

Macroscope's review found this PR approvable — This is a focused Claude wake-status fix with a targeted regression test and no schema, default, infrastructure, or sensitive-path changes. An unresolved High finding identifies a normal-turn init race that can create a phantom continuation, so that correctness risk remains a blocker to merging.

Notes:

  • This verdict was updated automatically after the outstanding correctness findings were resolved. Macroscope did not re-review the code.

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

@github-actions

github-actions Bot commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

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: d1034d6 · PR result: b46ff07 · 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.

@t3dotgg
t3dotgg merged commit 5bf19d1 into main Oct 3, 2026
34 checks passed
@t3dotgg
t3dotgg deleted the t3code/working-status-flicker branch October 3, 2026 06:06
patroza pushed a commit to patroza/t3code that referenced this pull request Oct 3, 2026
…ngdotgg#15055)

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
github-actions Bot added a commit to omarcresp/t3code-flake that referenced this pull request Oct 3, 2026
## What's Changed
* fix(web): thread panel shows the remote machine a thread runs on by @t3dotgg in pingdotgg/t3code#14972
* fix(web): Claude skill calls show the skill name by @t3dotgg in pingdotgg/t3code#14980
* test(server): the fake Claude CLI is a fixture file, not a generated string by @yordis in pingdotgg/t3code#14950
* fix(server): Claude subagents show the model their agent file picks by @t3dotgg in pingdotgg/t3code#14994
* fix(client-runtime): format subagent descriptions as display names by @Yash-Singh1 in pingdotgg/t3code#14999
* fix(web): outdated servers can be updated even when the client can't connect by @juliusmarminge in pingdotgg/t3code#15002
* fix(web): new worktree threads no longer flicker while starting by @t3dotgg in pingdotgg/t3code#15019
* fix(server): subagent threads stop publishing tombstones to the relay by @juliusmarminge in pingdotgg/t3code#15016
* fix(client-runtime): reconnects back off with jitter and keep healthy sockets by @t3dotgg in pingdotgg/t3code#14897
* fix(server): working timers no longer reset on every background wake by @t3dotgg in pingdotgg/t3code#15029
* fix(server): threads settle as soon as an agent merges their PR by @t3dotgg in pingdotgg/t3code#15024
* fix(opencode): fill blank reasoning labels by @Yash-Singh1 in pingdotgg/t3code#14978
* fix(preview): agent browser clicks no longer steal your composer focus by @t3dotgg in pingdotgg/t3code#15008
* fix(web): Woke dismiss syncs, preview mute is back, and subscription retries back off by @t3dotgg in pingdotgg/t3code#15034
* chore: docs, dev scripts and CI catch up with orchestration V2 by @t3dotgg in pingdotgg/t3code#15041
* fix(server): Claude V2 turns start on Windows with the default binary path by @maria-rcks in pingdotgg/t3code#15021
* fix(web): diff panel opens on all branch changes, not just uncommitted by @t3dotgg in pingdotgg/t3code#15005
* fix(server): threads stay working while Claude starts a wake turn by @t3dotgg in pingdotgg/t3code#15055
* feat(web): mod+alt+enter on an existing thread sends and opens a new thread by @maria-rcks in pingdotgg/t3code#15050
* fix(chat): sending on an older thread no longer jumps to the top by @t3dotgg in pingdotgg/t3code#15059
* chore: add bmdavis419 to triage exemptions by @bmdavis419 in pingdotgg/t3code#15062


**Full Changelog**: pingdotgg/t3code@v0.0.46-nightly.20261003.2610...v0.0.46-nightly.20261003.2623

Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.0.46-nightly.20261003.2623
github-actions Bot added a commit to davidvanderklay/t3code-flake that referenced this pull request Oct 3, 2026
## What's Changed
* fix(web): thread panel shows the remote machine a thread runs on by @t3dotgg in pingdotgg/t3code#14972
* fix(web): Claude skill calls show the skill name by @t3dotgg in pingdotgg/t3code#14980
* test(server): the fake Claude CLI is a fixture file, not a generated string by @yordis in pingdotgg/t3code#14950
* fix(server): Claude subagents show the model their agent file picks by @t3dotgg in pingdotgg/t3code#14994
* fix(client-runtime): format subagent descriptions as display names by @Yash-Singh1 in pingdotgg/t3code#14999
* fix(web): outdated servers can be updated even when the client can't connect by @juliusmarminge in pingdotgg/t3code#15002
* fix(web): new worktree threads no longer flicker while starting by @t3dotgg in pingdotgg/t3code#15019
* fix(server): subagent threads stop publishing tombstones to the relay by @juliusmarminge in pingdotgg/t3code#15016
* fix(client-runtime): reconnects back off with jitter and keep healthy sockets by @t3dotgg in pingdotgg/t3code#14897
* fix(server): working timers no longer reset on every background wake by @t3dotgg in pingdotgg/t3code#15029
* fix(server): threads settle as soon as an agent merges their PR by @t3dotgg in pingdotgg/t3code#15024
* fix(opencode): fill blank reasoning labels by @Yash-Singh1 in pingdotgg/t3code#14978
* fix(preview): agent browser clicks no longer steal your composer focus by @t3dotgg in pingdotgg/t3code#15008
* fix(web): Woke dismiss syncs, preview mute is back, and subscription retries back off by @t3dotgg in pingdotgg/t3code#15034
* chore: docs, dev scripts and CI catch up with orchestration V2 by @t3dotgg in pingdotgg/t3code#15041
* fix(server): Claude V2 turns start on Windows with the default binary path by @maria-rcks in pingdotgg/t3code#15021
* fix(web): diff panel opens on all branch changes, not just uncommitted by @t3dotgg in pingdotgg/t3code#15005
* fix(server): threads stay working while Claude starts a wake turn by @t3dotgg in pingdotgg/t3code#15055
* feat(web): mod+alt+enter on an existing thread sends and opens a new thread by @maria-rcks in pingdotgg/t3code#15050
* fix(chat): sending on an older thread no longer jumps to the top by @t3dotgg in pingdotgg/t3code#15059
* chore: add bmdavis419 to triage exemptions by @bmdavis419 in pingdotgg/t3code#15062


**Full Changelog**: pingdotgg/t3code@v0.0.46-nightly.20261003.2610...v0.0.46-nightly.20261003.2623

Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.0.46-nightly.20261003.2623
BarretoDiego added a commit to BarretoDiego/t3code that referenced this pull request Oct 3, 2026
- Servidor: runs não ficam mais travadas (pingdotgg#15048), com ajustes em ProviderSessionManager, RunExecutionService, EventSink e EffectOutbox na orchestration-v2, além de novos testes de persistência
- Servidor: threads permanecem em estado "working" enquanto o Claude inicia um wake turn (pingdotgg#15055), com mudanças no ClaudeAdapterV2 e no ProviderTurnStartService
- Chat: enviar mensagem em uma thread antiga não faz mais a timeline pular para o topo (pingdotgg#15059), com correção na lógica do MessagesTimeline
- Web: novo atalho mod+alt+enter em uma thread existente envia a mensagem e abre uma nova thread (pingdotgg#15050), incluindo contrato de keybindings, configurações e documentação do usuário
- Mobile: ajustes na lógica de atividade de thread (threadActivity) com cobertura de testes ampliada
- Chore: bmdavis419 adicionado às exceções de triagem (pingdotgg#15062)
- Conflitos: 1 arquivo conflitou e foi resolvido manualmente, mantendo as modificações próprias do fork

Sync automatico t3code-sync em 2026-10-03T06:10:17-03:00
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:M 30-99 changed lines (additions + deletions). 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.

2 participants