Files
apes-sidebar/docs
NolanHo 98c42971a2 fix(sidechat): normalize the head skeleton and mirror the host invariant core (review round 3)
Round 3 (two fresh reviewers) converged on: the head skeleton kept the
rewritten system head's ORIGINAL step number (a mid-session rewrite can
live at turn 1 step >= 2), the relational gate lacked the host's
nextStep/pendingCalls rules (a wide head's tool/result without its call
slipped through), kept compaction metering records carried stale
shadowedRange/shadowedSeqs (violating the compaction invariant
companion), and the gate was STRICTER than the host on non-append
tool/results — so the default-loaded pruner's replacements silently
disabled the trim.

v4: the head skeleton normalizes to turn 1 step 1, rewriting only the
envelope numbers an event already carries (a user/message never gains
fields — its whole data object IS the model-visible message; the
equivalence token now mirrors the renderer's projection exactly: user
messages compare their full data, everything else data.message). The
gate mirrors the host invariant's counter and pairing core: contiguous
turns, no nested open turn, sequential steps, in-turn naming with the
host's non-append tool/result exemption, and pending-call consumption.
Compaction metering records rebase their citations; when the span they
priced did not survive, the record is dropped. A surface node that is a
kept replacement's fold TARGET is no longer skipped, so pruner
replacements replay their transition instead of degrading into an
append stranded after a closed step — that shape now trims.

Pinned by new spec cases (rewritten head, pruner-rewritten keep-window
result) and by all three review rounds' out-of-tree probes.
2026-10-16 16:14:41 +08:00
..