Skip to content

Reconcile extra session segments before skipping empty checkpoints - #901

Merged
TheGreatAxios merged 1 commit into
mainfrom
cl-7701-empty-checkpoint-skip-can-leave-extra-turn-segments
Sep 11, 2026
Merged

Reconcile extra session segments before skipping empty checkpoints#901
TheGreatAxios merged 1 commit into
mainfrom
cl-7701-empty-checkpoint-skip-can-leave-extra-turn-segments

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Collaborator

Summary

  • Reconciles on-disk extra turn and prompt segments before deciding a checkpoint is empty
  • Skips git only when there is no staged compact and no managed-path diff after that reconcile
  • Commits leftover extra segments after a crash even when writeTurns did not run on the new store

Verification

  • bun run typecheck, bun run build, and bun run test pass
  • bun test ./src/session/optimized-context-store.test.ts passes (37 tests)

Fixes CL-7701

Skip used the in-memory pending set, so extra turn and prompt
segments left on disk after a crash never entered the managed-path
diff and were left untracked.
@linear-code

linear-code Bot commented Sep 11, 2026

Copy link
Copy Markdown

CL-7701

@TheGreatAxios TheGreatAxios left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Critic · Comment

Empty-checkpoint skip runs after reconcileSegmentStaging so leftover extra turn/prompt segments are staged. Skip still fires only when stagedRewrite is null.

Findings

No findings.

Notes

  • src/session/optimized-context-store.ts:763-793 — reconcile, then skip; extras land in toAdd and managedPathsDiffer
  • partial.jsonl stays off the managed allowlist; #899 torn-base write and failed-rewrite restore still pass

@TheGreatAxios
TheGreatAxios merged commit 36d5369 into main Sep 11, 2026
9 checks passed
@TheGreatAxios
TheGreatAxios deleted the cl-7701-empty-checkpoint-skip-can-leave-extra-turn-segments branch September 11, 2026 04:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant