Skip to content

fix(core): recover stale event sequence - #51413

Open
d4n-sec wants to merge 1 commit into
anomalyco:devfrom
d4n-sec:sequence-recovery
Open

d4n-sec wants to merge 1 commit into
anomalyco:devfrom
d4n-sec:sequence-recovery

Conversation

@d4n-sec

@d4n-sec d4n-sec commented Sep 25, 2026

Copy link
Copy Markdown

Issue for this PR

Fixes #51411

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Uses the greater of the stored aggregate cursor and the latest persisted event sequence before assigning a local sequence. A stale cursor can no longer retry an already-written sequence forever. The owner-claim path is unchanged.

Running and comparing v1 and v2 is a normal plugin-development workflow. This is defensive recovery for an already damaged shared DB; it complements, rather than replaces, correct versioned data isolation.

How did you verify your code works?

  • bun test test/event.test.ts in packages/core — 45 passed. The new regression first writes events 0 and 1, lowers only the cursor, then confirms a new event receives 2 and retains its owner.
  • bun typecheck in packages/core — passed.
  • bunx oxlint packages/core/src/event.ts packages/core/test/event.test.ts — no errors.
  • Isolated manual path: v1 1.18.32 created a session in an isolated shared DB, latest dev reopened it, and after lowering only that session cursor from 0 to -1, a resume:false prompt was admitted at sequence 1. SQLite integrity check passed; both test servers were stopped.

Screenshots / recordings

Not applicable.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes

@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

This branch has not been deployed

No deployments
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.

Bug: stale event sequence permanently rejects new session events

1 participant