Repository navigation
Conversation
A stage keeps the snapshot work between its boundary check and its Staged publication. If a commit runs in that window, the late Staged write puts the revert pointer back on the boundary the commit just deleted, and every later commit (which each send performs first) fails with "Revert boundary message not found", permanently blocking the session. Projections for one session already run serialized under the durable lock, so the Staged projection now writes only while its boundary message still exists. A commit whose boundary is already gone is treated as applied and clears the pointer, which also recovers sessions blocked by an older build.
There was a problem hiding this comment.
I'd approve this. It fixes the stuck session from #63282, which I reproduced on the base branch first.
To reproduce it, I added a test-only 1.5 s pause just before stage publishes RevertEvent.Staged (the same pause the bot used in #63282). Then I staged a revert twice and committed while the second stage was still running.
- Base branch: the late stage set
session.revertback to the deleted message. The nextrevert/commitreturned 500, and the next TUI send failed with "Failed to commit revert". - This pull request:
session.revertstaysnull, the second commit succeeds, and the next send goes through.
The projector tests pass (48), and the two new ones fail against the base source. tsc passes for packages/core.
Skipping the inbox, instruction-state and blob cleanup when the boundary is already gone looks right: the commit that deleted the boundary already did that work.
The public API is unchanged: no new endpoints, events, payloads or config.
I have no blocking concerns.
|
The repository checks on this head are still waiting for workflow approval from a maintainer. Nothing else is pending from my side: the review above reproduced the same interleaving on the base branch. |


Issue for this PR
Closes #63282
Type of change
What does this PR do?
A revert stage keeps its snapshot work between the boundary check in
planand theRevertEvent.Stagedpublication. If a commit runs in that window, the lateStagedwrite puts the revert pointer back on the boundary the commit just deleted. Every later send starts with a commit, and each one dies withRevert boundary message not found, so the session is blocked until it is deleted.Projections for one session already run serialized under the durable lock, so this fixes both halves in the projector:
Stagedwrites the pointer only while its boundary message still exists, so a late stage cannot resurrect a deleted boundary.Committedwhose boundary is already gone is treated as applied and clears the pointer instead of dying, which also recovers sessions an older build left blocked.How did you verify your code works?
bun test test/session-projector.test.tsinpackages/core: 48 pass. Two new tests replay the interleaving through the bus: aStagedpublished after the commit leavesrevertnull, and a commit whose boundary row is already missing clears the pointer. Both fail before the change (2 fail, 4 pass with only the source reverted).bun typecheckinpackages/core: no type errors.dev(a75fcac14c); the bot reproduction in core: committed revert can leave session_v2.revert pointing at deleted boundary, permanently blocking sends #63282 still matches the source on that revision.Screenshots / recordings
Not a UI change.
Checklist