Skip to content

fix(server): keep ready checkpoints when a later placeholder arrives - #8432

Open
Adolanium wants to merge 1 commit into
pingdotgg:mainfrom
Adolanium:fix/sql-checkpoint-placeholder-guard
Open

fix(server): keep ready checkpoints when a later placeholder arrives#8432
Adolanium wants to merge 1 commit into
pingdotgg:mainfrom
Adolanium:fix/sql-checkpoint-placeholder-guard

Conversation

@Adolanium

@Adolanium Adolanium commented Aug 27, 2026

Copy link
Copy Markdown

What Changed

The SQL turns projector now refuses a later missing placeholder over a checkpoint that is already ready or error.

In-memory projectEvent already had this guard. SQL always wrote checkpointStatus: event.payload.status. Thread detail and diffs read SQL.

Same-turn placeholder then ready is still the happy path. This only stops a later placeholder from wiping a capture that already landed.

Why

Ingestion and CheckpointReactor dispatch onto the same serial queue. If ready lands first, a later missing was a no-op in memory and a clobber in SQL.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes (N/A)
  • I included a video for animation/interaction changes (N/A)

Note

Low Risk
Narrow projection guard on duplicate turn-diff events; improves read-model consistency for checkpoints with limited blast radius.

Overview
Aligns the SQL turn projector with in-memory event projection so a later thread.turn-diff-completed with missing cannot overwrite a turn that already has a real checkpoint (ready or error).

When ready is projected before a trailing placeholder (e.g. shared serial queue ordering), projection_turns used to always take the latest status, so thread detail and diffs could show missing even after a successful capture. The handler now no-ops that downgrade; placeholder-then-ready on the same turn is unchanged.

Adds an integration test that projects ready then missing for the same turn and asserts SQL still stores ready and the checkpoint ref.

Reviewed by Cursor Bugbot for commit c5e84c9. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Fix ProjectionPipeline to keep ready checkpoints when a later missing placeholder arrives

  • In the thread.turn-diff-completed handler in ProjectionPipeline.ts, adds an early return guard: if an existing turn projection already has a non-null, non-missing checkpointStatus, incoming events with status missing are ignored for that turn.
  • Adds a test in ProjectionPipeline.test.ts that projects a ready checkpoint followed by a missing event for the same turn and asserts the ready status and original checkpointRef are retained.

Macroscope summarized c5e84c9.

The in-memory projector already refuses a missing placeholder over a ready capture. SQL always wrote the later status. Thread detail and diffs read SQL, so a concurrent placeholder could hide a finished checkpoint.

Skip the SQL write when the stored checkpoint is not missing and the new event is.
@coderabbitai

coderabbitai Bot commented Aug 27, 2026

Copy link
Copy Markdown

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: a6bf3df3-105d-47ba-948e-160f317d67d3

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

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

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Aug 27, 2026
@macroscopeapp

macroscopeapp Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at c5e84c9

Macroscope's review found this PR approvable — This is a narrow read-model consistency fix: only a later missing checkpoint event is ignored when a real checkpoint already exists, preserving the stored status and git reference. The accompanying integration test covers the affected ordering, with no schema or cross-cutting runtime changes.

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

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

Labels

size:S 10-29 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.

1 participant