Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): ignore replayed Claude resume snapshots #8842

ClosedMichel-Liao(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/8842/headopened View on GitHub

What Changed

  • Preserve the Claude assistant UUID that a session initially resumes from.
  • Ignore any assistant snapshot replayed with that durable UUID instead of appending it to the new turn.
  • Add a regression test covering a successful compact boundary followed by the historical snapshot replay.

Why

Claude can re-emit the assistant snapshot at the persisted resume cursor after a restart or compaction. Treating that snapshot as new output duplicates historical text in the current turn. The native UUID is the durable identity, so filtering the initial cursor replay makes resume ingestion idempotent without suppressing later assistant messages.

Fixes #4930.

Verification

  • vp test run apps/server/src/provider/Layers/ClaudeAdapter.test.ts — 80 tests passed
  • vp run --filter t3 typecheck
  • Changed-file lint and format checks
  • git diff --check

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • No UI changes

Built with GPT-5.6 Sol in T3 Code through the Codex harness.


Note

Medium Risk Changes Claude resume message ingestion in the provider adapter; wrong filtering could hide legitimate assistant output on resumed sessions, but scope is limited to the initial resume UUID match.

Overview Fixes duplicate assistant text when Claude re-emits the assistant snapshot at the persisted resume cursor after restart or compaction (e.g. following /compact).

The adapter now stores resumeAssistantUuid from resumeCursor.resumeSessionAt at session start and skips processing any incoming assistant message whose SDK uuid matches that value, so historical content is not appended as new turn output. Compaction and other handling still run; only the cursor replay is dropped.

A regression test simulates compact boundary + replayed assistant snapshot and asserts no assistant content.delta / item.completed events and an empty turn items list.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 57700355f4eec6a61d389af10026edb374cca9bf. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

Note

Ignore replayed assistant snapshots at Claude resume cursor in handleAssistantMessage

Adds a resumeAssistantUuid field to ClaudeSessionContext in ClaudeAdapter.ts, set from resumeState?.resumeSessionAt during session init. The handleAssistantMessage function now early-returns when an incoming assistant message's message.uuid matches this value, preventing replayed snapshots from being processed into runtime events or thread items.

Macroscope summarized 5770035.
    1. Important

      Review skipped

      Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

      ⚙️ Run configuration

      Configuration used: Repository UI

      Review profile: CHILL

      Plan: Pro Plus

      Run ID: 59e1271d-8f26-4a54-b84b-cfb2cf439074

      You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

      Use the checkbox below for a quick retry:

      • 🔍 Trigger review

      Warning

      Your free Security trial is over. An organization admin can activate Security or dismiss this notice.


      Comment `@coderabbitai help` to get the list of available commands.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    3. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Approved at 5770035

      Macroscope's review found this PR approvable — This is a focused Claude resume bug fix with a narrowly bounded runtime effect and a regression test covering the replay scenario. Existing non-replayed and non-resumed paths remain unchanged, with no schema, deployment, default, or static-analysis configuration changes.

      Notes:

      • Diff unchanged. Approvability was decided on eligibility alone.
      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. juliusmarminge added labelsmacroscope-review

    5. Thanks for working on this. We merged the orchestrator V2 rewrite in #2829, and we are closing this PR as part of that transition.

      This change touches ClaudeAdapter.ts, which the V2 merge removed. Claude execution now runs through ClaudeAdapterV2.

      Sorry for the extra work this creates. If the change is still needed on V2, please rebuild it on current main, verify it there, and open a new PR linking back here. We're closing the current implementation without assuming the underlying request is resolved.

    6. juliusmarminge closed this

Sign in to join this conversation.