rowboat/apps/x/packages
Ramnique Singh 21c93913f4 fix(x): validate turn event batches before they become durable
The commit ritual persisted first and reduced second, so an illegal
append (e.g. a misbehaving tool reporting progress after its terminal
result) became durable before the reducer rejected it — permanently
corrupting the turn file and, through context references, blocking
every later turn in the session. Reduce the batch against the in-memory
history first: illegal batches now reject in memory for their caller
only, the file stays legal, and a failed commit no longer poisons
this.events for subsequent appends in the same invocation.

Adds a test that fires a stashed reportProgress after the tool's result
is durable (while a sibling keeps the invocation alive) and asserts the
late append rejects, nothing illegal reaches the file/stream/bus, and
the turn completes and stays re-advanceable. Updates the design doc
(§4.5, §24) to the reduce → persist → stream order.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-10 22:32:33 +05:30
..
core fix(x): validate turn event batches before they become durable 2026-07-10 22:32:33 +05:30
shared ci(x): typecheck test files — the gap vitest and the build tsconfigs both miss 2026-07-10 16:30:26 +05:30