Skip to content

fix(server): port Claude phantom-turn and Codex queued-follow-up fixes from t3code nightly - #130

Merged
kamo62 merged 5 commits into
mainfrom
feat/upstream-provider-fixes
Aug 9, 2026
Merged

kamo62 merged 5 commits into
mainfrom
feat/upstream-provider-fixes

Conversation

@kamo62

@kamo62 kamo62 commented Aug 9, 2026

Copy link
Copy Markdown
Owner

Summary

Ports two clean upstream fix(server) bug fixes from the latest t3code nightly into neokod. Both bugs were confirmed present in neokod (the affected code was byte-identical to upstream's pre-fix state), and both ports are localized.

  • Claude phantom turns (2c6e4c0ef, ports fix(server): stop Claude resume handshakes from completing turns that never ran pingdotgg/t3code#5710): a Claude SDK result with no local turn state emitted a turn.completed carrying no turnId, which ingestion couldn't attribute — and whenever the projection had no active turn (a pending turn start included) it flipped the session lifecycle for a turn that never ran. Now the token-usage emission is kept, the untargeted lifecycle event is dropped, and a claude.turn.result-without-active-turn log keeps the trigger measurable; ingestion accepts a no-active-turn completion only when it names its turn. This closes neokod's own documented "SDK no-turn-id residual" from the earlier stop-settles-turn work.
  • Codex stop with queued follow-up (d6a20b0b1, ports fix(server): stop Codex threads with queued follow-ups pingdotgg/t3code#5762): Codex accepts a follow-up while the current turn is still running; sendTurn overwrote activeTurnId with the queued turn's id, so a stop request targeted the wrong turn and Codex rejected the interrupt. Now the active id is kept until turn-lifecycle notifications advance it.

Base

Based on main, independent of the #122#127 stack. The buggy lines are not touched by the #112 work (verified against the stack tip), so this merges cleanly regardless of stack ordering.

Verification

  • Server typecheck: 0 errors in the three touched files.
  • Existing suites green: ClaudeAdapter.test.ts, ProviderRuntimeIngestion.test.ts, CodexSessionRuntime.test.ts — 137 tests passed. No test asserted the old (buggy) behavior.
  • Live dev-server boot clean (reaper.started, no Service-not-found).

Follow-up

Upstream shipped regression tests alongside each fix (an ingestion-test dispatch-helper refactor for #5710, a Codex collab integration test for #5762). Those weren't ported here to keep the change surgical; they're worth porting as a follow-up if we want the regressions pinned locally.

Related upstream review

Two more nightly server fixes were assessed and filed as issues rather than ported here: #128 (reaper kills background subagents — needs adaptation to neokod's workerCount signal, sequenced after the stack) and #129 (PR-status rate-limit backoff). Two others (#5774 settle, #5788 OOMPolicy) were found not applicable to neokod.

🤖 Generated with Claude Code

Kamogelo Mashishi added 2 commits August 9, 2026 09:43
Port of upstream pingdotgg/t3code#5710. A Claude SDK result arriving with
no local turn state (the resume handshake system/init + result(num_turns:0),
a late result for a locally-completed turn, or a stream failure with no turn
in flight) emitted a turn.completed carrying no turnId. Ingestion could not
attribute it, and whenever the projection had no active turn — a pending
turn start included — it flipped the session lifecycle for a turn that never
ran. Keep the token-usage emission, drop the untargeted lifecycle event, and
log claude.turn.result-without-active-turn as a field-measurable tripwire.
Ingestion now accepts a no-active-turn completion only when it names its
turn. Closes neokod's documented SDK no-turn-id residual.
Port of upstream pingdotgg/t3code#5762. Codex accepts a follow-up while the
current turn is still running; the turn/start response carries the queued
turn id, but turn/interrupt only accepts the id that is active now. sendTurn
unconditionally overwrote activeTurnId with the queued id, so a stop request
targeted the wrong turn and Codex rejected the interrupt. Keep the existing
active id until turn-lifecycle notifications advance it (updateSession gains
a functional-updater form to read the current session).
@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@kamo62, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 51 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 76a4944a-275a-45b7-9cb7-82982d9c1e2e

📥 Commits

Reviewing files that changed from the base of the PR and between 740a2a9 and d6799f7.

📒 Files selected for processing (7)
  • CHANGELOG.md
  • apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.test.ts
  • apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.ts
  • apps/server/src/provider/Layers/ClaudeAdapter.test.ts
  • apps/server/src/provider/Layers/ClaudeAdapter.ts
  • apps/server/src/provider/Layers/CodexSessionRuntime.test.ts
  • apps/server/src/provider/Layers/CodexSessionRuntime.ts

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 vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:M labels Aug 9, 2026
@kamo62
kamo62 marked this pull request as ready for review August 9, 2026 08:21
Kamogelo Mashishi added 2 commits August 9, 2026 10:26
…r-fixes

# Conflicts:
#	apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.test.ts
@kamo62
kamo62 merged commit c3ca307 into main Aug 9, 2026
10 checks passed
@kamo62
kamo62 deleted the feat/upstream-provider-fixes branch August 9, 2026 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 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