Skip to content

feat(session): gate saveCrashState on crashed state - #1478

Merged
TheGreatAxios merged 2 commits into
mainfrom
cl-10757-session-persistence-hardening
Oct 17, 2026
Merged

TheGreatAxios merged 2 commits into
mainfrom
cl-10757-session-persistence-hardening

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Collaborator

Summary

Gate saveCrashState on the crashed flag so the terminal crash write fails closed unless markCrashed() ran first, instead of relying on caller discipline. Adds a resetCrashedForTests seam (the crashed flag is process-global and sticky) and stale-cache regression tests covering the fence.

Verification

  • Unit: 86 passed
  • E2E: 6 passed

Fixes CL-10757

@linear-code

linear-code Bot commented Oct 17, 2026

Copy link
Copy Markdown

CL-10757

@corbits-triage

corbits-triage Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Triage: Pass

No changes needed from you. A maintainer will review this pull request.

@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.

Review · Request changes

saveCrashState fails closed unless isCrashed() is set. The gate and its tests hold. The same diff also adds live-turns cache tests with no production change in the context store.

Findings

  • src/session/optimized-context-store.test.ts:2272 — this block is a second change. The append and committed-rewrite cases repeat tests already in this file. Take the cache tests off this PR so the diff is only the crash fence.

Notes

  • src/session/state.ts:211 — the comment drops a "that" and is hard to read. Fix it while the cache tests come out.

@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.

Review · Approve

saveCrashState throws unless isCrashed() is set. The diff is only that gate, the test reset, and the tests that lock it.

No findings.

@TheGreatAxios
TheGreatAxios merged commit c25ae83 into main Oct 17, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant