Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix: checkpoint diffs never resolve (shared PubSub subscription) #595

Mergedeggfriedrice24(GitHub profile, opens in a new tab)merged 7 commits intomain fromrefs/pull/595/headmerged by juliusmarminge View on GitHub

Summary

Fixes #585

  • Stream.fromPubSub() stored as a property meant all consumers shared one subscription queue. Only the first reader got events; CheckpointReactor received nothing and never captured git checkpoints.
  • Changed streamDomainEvents and streamEvents to getters so each consumer gets its own subscription.
  • Added a domain event handler that replaces placeholder checkpoints (status "missing") with real git captures.
  • Extracted shared CWD resolution and capture+diff+dispatch logic to reduce duplication in CheckpointReactor.

Files changed

  • OrchestrationEngine.ts: streamDomainEvents property → getter
  • ProviderService.ts: streamEvents property → getter
  • CheckpointReactor.ts: placeholder handler, dedup fix, shared helpers extracted

Test plan

  • bun lint passes
  • bun typecheck passes
  • Manual: create thread, prompt file change, verify diff panel shows actual file diffs

Note

Fix checkpoint diffs never resolving due to shared PubSub subscriptions

  • Changes streamDomainEvents in OrchestrationEngine.ts and streamEvents in ProviderService.ts from pre-created Stream fields to getters, so each consumer gets an independent subscription.
  • Adds a captureCheckpointFromPlaceholder handler in CheckpointReactor.ts that replaces placeholder (status: 'missing') checkpoints with real git-ref checkpoints when thread.turn-diff-completed events are received, even if no turn.completed runtime event arrived.
  • Fixes captureCheckpointFromTurnCompletion to proceed when only a placeholder checkpoint exists for a turn, reusing its checkpointTurnCount rather than incrementing past it.
  • Guards the thread.turn.diff.complete projector in projector.ts so placeholder checkpoints cannot overwrite an already-captured real checkpoint.
  • Fixes placeholder dispatch in ProviderRuntimeIngestion.ts to skip if a real checkpoint already exists and to compute checkpointTurnCount from the existing max rather than array length.
Macroscope summarized 420c3fa.

before (took like ~2-3 minutes to load checkpoint diff and return error): image

after fix: image

    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      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

      Run ID: d953e99a-fa11-4ad1-b7a0-d8ee41541375

      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
      ✨ Finishing Touches
      🧪 Generate unit tests (beta)
      • Create PR with unit tests
      • Post copyable unit tests in a comment

      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 and usage tips.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    3. Highly appreciated, thanks for fixing that bug!

    4. Ready for review! Just resolving merge conflicts with latest main. @juliusmarminge

    5. turn diffs still broken (i can see the full thread diff, but not the individual turn diffs and i don't see the tree of changed files in the thread activities), you up to debug or should I?

      CleanShot 2026-03-10 at 16 17 26@2x CleanShot 2026-03-10 at 16 17 43@2x
    6. On it, will debug and follow up!

    7. eggfriedrice24(GitHub profile, opens in a new tab)commented

      Found and fixed the individual turn diff issue. Two problems:

      1. ProviderRuntimeIngestion fires multiple turn.diff.updated per turn. Each dispatched a new placeholder that the projector replaced by turnId, overwriting CheckpointReactor's real git capture. Fixed: skip placeholder dispatch if a checkpoint already exists for that turnId.

      2. checkpointTurnCount was computed as thread.checkpoints.length + 1 which produces unstable values after dedup. Fixed: use max(checkpointTurnCount) + 1 instead.

      Also added a guard in the projector so a "missing" placeholder can never overwrite a "ready" checkpoint.

      Tested locally, both "All turns" and individual turn diffs now work correctly on fresh threads.

      @juliusmarminge

      image
    8. yup that's what i also diagnosed it to be. pulling now and testing

    9. create a new thread the old thread has stale placeholder checkpoints from before, should work 100%

    10. juliusmarminge approved these changes

    11. juliusmarminge merged thise8b0126

    12. juliusmarminge closed this

Sign in to join this conversation.