Skip to content

Stabilize checkpoint diffs for sparse turns and improve unavailable-diff UX#1078

Open
Meetpatel006 wants to merge 3 commits intopingdotgg:mainfrom
Meetpatel006:fix/fix-checkpoint-diff-dedupe-upstream
Open

Stabilize checkpoint diffs for sparse turns and improve unavailable-diff UX#1078
Meetpatel006 wants to merge 3 commits intopingdotgg:mainfrom
Meetpatel006:fix/fix-checkpoint-diff-dedupe-upstream

Conversation

@Meetpatel006
Copy link

@Meetpatel006 Meetpatel006 commented Mar 14, 2026

What Changed

This PR fixes checkpoint diff behavior for sparse turn histories and improves Diff Panel handling when checkpoints are unavailable.

  • Added fallback checkpoint resolution at-or-before requested turn count to avoid hard failures when exact turn checkpoints are missing.
  • Added dedupe for repeated placeholder checkpoint events (turn.diff.updated) for the same thread+turn.
  • Removed the guard that skipped checkpoint capture when activeTurnId pointed to a different turn, so completed turns are still captured.
  • Updated Diff Panel behavior to avoid endless loading in all-turn mode when missing checkpoints are present.
  • Added explicit unavailable-checkpoint messaging and improved empty/loading/error states.
  • Added/updated tests for fallback resolution, dedupe behavior, and Diff Panel availability logic.

Why

Users could hit unreliable or confusing diff behavior:

  • Sparse checkpoint timelines could fail when exact turn checkpoints were not available.
  • Repeated provider diff updates could create unstable placeholder checkpoint state.
  • All-turn Diff Panel could appear stuck loading when one or more checkpoints were missing.
  • Error/empty states in the Diff Panel were not clear enough.

This approach keeps behavior predictable under partial/missing checkpoint data, avoids duplicate placeholder writes, and provides clearer UI feedback without expanding scope beyond bug fixes.

UI Changes

Before

  1. All-turn Diff Panel kept loading (stuck loading state).
Screenshot 2026-03-14 005501
  1. Error state shown before the fix.
Screenshot 2026-03-14 005507

After

  1. All-turn Diff Panel with better UX and no stuck loading.
Screenshot 2026-03-14 004035
  1. Explicit state when a checkpoint is missing.
Screenshot 2026-03-14 004042
  1. Normal Diff Panel state.
Screenshot 2026-03-14 004028

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a images for interaction changes

Note

Stabilize checkpoint diffs for sparse turns and improve unavailable-diff UX

  • getTurnDiff in CheckpointDiffQuery.ts now resolves to the nearest checkpoint at or before the requested turn count instead of throwing when an exact match is missing.
  • The checkpoint reactor in CheckpointReactor.ts now captures completed turns even when the session's activeTurnId references a different turn.
  • ProviderRuntimeIngestion.ts deduplicates placeholder checkpoints so repeated turn.diff.updated events for the same turn only enqueue one placeholder.
  • DiffPanel.tsx skips the diff query when a selected turn's checkpoint is missing or lacks a ref, showing a descriptive message instead of a loading/error state.
  • isCheckpointTemporarilyUnavailable now treats 'checkpoint ref is unavailable for turn' as a retriable condition.

Macroscope summarized b0fa258.

- tolerate sparse checkpoint turn counts in diff queries
- keep completed turn captures from being dropped on activeTurnId mismatch
- dedupe repeated provider diff placeholder events per turn
- retry checkpoint-ref unavailable errors in the web diff query
- add focused regression coverage for each path
@coderabbitai
Copy link

coderabbitai bot commented Mar 14, 2026

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: 41b960e3-0bbc-4da6-a6a2-ad482ae480c7

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
📝 Coding Plan
  • Generate coding plan for human review comments

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.

Tip

You can make CodeRabbit's review stricter and more nitpicky using the `assertive` profile, if that's what you prefer.

Change the reviews.profile setting to assertive to make CodeRabbit's nitpick more issues in your PRs.

@github-actions github-actions bot added size:XL 500-999 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels Mar 14, 2026
Copy link
Member

@juliusmarminge juliusmarminge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the root cause of this issue is that we're not handling subagents very well yet (they emit unique turn ids so a single user-assistant pass emits multiple turns but we are not capturing these), and codex is constantly 'improving' them. checkpointing worked flawlessly before we shipped, never had issues.

This seems like another bandaid to me(?), I was working on a real and proper fix earlier this week but got distracted.

Really like the UI improvements though!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL 500-999 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants