Skip to content

fix: rewind vs compaction boundaries + failed requests as timeline runs (v0.21.0)#51

Merged
lroolle merged 1 commit into
mainfrom
fix/rewind-vs-compaction-and-error-runs
Jul 23, 2026
Merged

fix: rewind vs compaction boundaries + failed requests as timeline runs (v0.21.0)#51
lroolle merged 1 commit into
mainfrom
fix/rewind-vs-compaction-and-error-runs

Conversation

@lroolle

@lroolle lroolle commented Jul 23, 2026

Copy link
Copy Markdown
Member

Two session-view truth bugs reported from one real trace pair, both reproduced and fixed against the actual wire data.

1. A /rewind displayed as "compacted"

The post-spine anchor walk accepted a msg[0]-to-msg[0] match with zero verified context. msg[0]'s content sig is the injected system-reminder prefix — identical for every request in a session — so a rewind-to-start (71 -> 2 turns, only the first message shared, everything after divergent) classified as a fold compaction.

Fix, in two parts:

  • The degenerate (i=0, j=0, checked=0) anchor is rejected. Anchors elsewhere may still verify zero neighbors (wildcard tool results at start-of-packing) — the real-wire compaction fixture has one and it stays accepted.
  • The boundary classifier reads index geometry: a fold's surviving tail aligns at shifted indices (the history above it shrank into a summary); a rewind's shared content is a same-index prefix. With no anchor at all, a same-sig thread that was never reunified classifies rewind too — every observed compact shape rewrites msg[0] and splits the sig, so merged continuation requests are now stamped and only they can claim a full rewrite.

The boundary renders "rewound · N -> M turns" (rail row + convo divider) with a hover that says what actually happened. Fold and rewrite are unchanged; tests/session-compaction.test.ts (real wire shapes) pins all of it.

2. Failed requests vanish or dump at the tail

Transport/HTTP failures transiently claimed the successful retry's turn at strength 1, then piled up as orphan "err" rows at the thread tail — a real kimi 429 storm rendered 82 unordered rows. Now they collect per timeline position (t.failed), never claim turns, and render as one collapsed run at the exact position the storm hit: "21 failed requests · 429 engine_overloaded_error", red dot on the rail, first wire pair linked, matching red-edged line in the conversation pane.

Verification

  • 486/486 tests pass (5 new session-layer tests, 2 new dom-stub UI tests)
  • Both real traces re-rendered through the actual page: the rewind trace shows 1 "rewound" boundary and 0 "compacted"; the kimi trace's chat shows its 3 storm runs (2/1/5) collapsed in position, zero page errors
  • Binary compiles clean

Releases as v0.21.0.

🤖 Generated with Claude Code

Two session-view truth bugs from one real trace pair (2026-07-22):

A /rewind displayed as "compacted": the post-spine anchor walk accepted
a msg[0]-to-msg[0] match with zero verified context — msg[0]'s content
sig is the injected <system-reminder> prefix, identical for every
request in a session — so a rewind-to-start (71 -> 2 turns, only the
first message shared) classified as a fold. The anchor now rejects that
degenerate hit, and the boundary classifier reads index geometry: a
fold's surviving tail aligns at shifted indices (history above it
shrank into a summary), a rewind's shared content is a same-index
prefix. With no anchor at all, a same-sig thread that was never
reunified classifies rewind too — every observed compact shape rewrites
msg[0] and splits the sig (merged continuations are stamped _cont).
The boundary row says "rewound · N -> M turns" with an honest hover;
the real-wire compaction fixture pins fold/rewrite unchanged.

Failed requests (no response / HTTP 4xx-5xx) transiently claimed the
successful retry's turn at strength 1 and then piled up as orphan
"err" rows at the thread tail — a kimi 429 storm rendered 82 unordered
rows. They now collect per timeline position (t.failed), never claim
turns, and render as one collapsed run where the storm hit ("21 failed
requests · 429 engine_overloaded_error"), red dot on the rail, first
wire pair linked, plus a red-edged line in the conversation pane.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@lroolle
lroolle merged commit 41a3b31 into main Jul 23, 2026
1 check passed
@lroolle
lroolle deleted the fix/rewind-vs-compaction-and-error-runs branch July 23, 2026 05:38
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