Repository navigation
fix: stale-ref gate messages report true causes with diagnostics - #175
Conversation
The minCompressRange batch gate claimed 'a prior compress renumbered the
remaining refs' — the kernel has no ref-renumbering mechanism (refs are
additive per-session snapshots; applyCompression/prune only change the
message view). The fabricated history made models self-doubt on a session's
FIRST compress (billion-context#387).
- all-unknown branch: states refs are per-session snapshots that no
compress reassigns; names the real causes (previous session instance
after model/upstream switch, pre-rebase generation, typo)
- consumed branch: splits dangling refs (content drift / filtered
messages — 'cannot be anchored') from ranges covered by active blocks
('already compressed')
- both branches carry [diagnostics: session highest ref, unknown ranges
in request, session history] so the model can tell a fresh-generation
restart from block consumption at a glance
- 'renumber' no longer appears in any user-visible text or dist bundle
- tests: updated 2 gate tests, added 3 category tests (model switch,
rebase, content drift) each asserting its wording + diagnostics
📦 Built Package ArtifactBranch: Option A — Install from npm PR tag (recommended)In your adapter project: npm install acp-kernel@pr-175Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf acp-kernel-pr175.tgz
npm install ./packageThis comment is automatically updated on each push. |
[bot] 🏷 Work is complete and verified. PR: #175 (branch I independently re-ran the full pre-flight on the branch:
Acceptance criteria check against the issue:
CI on the PR is green (test 22/24, pr-validation, build-artifact all success) and the PR is mergeable against master. Coordination notes acknowledged: if #176 (ref reclamation) lands first, expect a small rebase on Ready for review + human merge. |
[bot] 🏷 Minor finding (report-only, not blocking): |
…undary failures Rebase onto master (incl. #175): resolve refs.js import conflict (indexToRef + pruneDeadRefs). Because applyCompression now syncs (prunes dead refs) before boundary resolution, a drifted ref is released and reported as unknown rather than the pre-#175 dangling branch; name edit-drift as an unknown-ref cause in the all-unknown gate message and update the #387 drift test accordingly.
What
Fixes the factually-wrong batch-gate error from ranxianglei/billion-context#387:
your refs are stale: a prior compress renumbered the remaining refs. The kernel has no ref-renumbering mechanism — refs are additive per-session snapshots (assignRefsnever deletes;applyCompression/pruneonly change the message view;rebuildRefIndexrebuilds the reverse map from the forward one). The fabricated history made models self-doubt on a session's first compress (0 blocks, 0 compression history).Changes (src/compress.ts only + tests)
compress.tsgate, ex-line 274): now states refs are per-session snapshots, assigned once at first render, and that no compress reassigns them — so unknown refs cannot come from an earlier compress in this session. Names the real causes: a previous session instance (switching model/upstream mid-conversation starts a fresh session whose refs restart at m00001), the generation before a native-compaction rebase (also resets to m00001), or a typo.cannot be anchored … leaving your old refs danglingalready compressed … covered by active block(s) or the block ref(s) are stale (distilled or consumed)+ existing liveHint[diagnostics: session highest ref=mNNNNN|none, unknown ranges in request=U/R, session history=N compression(s), M block(s)]— lets the model tell "fresh generation restart" (high requested refs, zero history) from "consumed by block" at a glance.renumberno longer appears in any user-visible text; verified 0 occurrences in the builtdist/index.js.Tests
createInitialState, old refs → same branch, diagnostics show zeroed history (current generation, not the past)cannot be anchored, asserted NOT "already compressed"doesNotMatch /renumber/ion the gate message.Pre-flight
npm run typecheck— cleannpm test— 552/552 pass (baseline 549 + 3 new)npm run build— success;grep -c renumber dist/index.js→ 0Coordination notes
src/compress.tsgate messages,src/boundaries.tsconsumed-reason split, ref reclamation insrc/refs.ts/src/sync.tsfor the ghost-ref issue). This PR is based on clean master and is self-contained; if that work lands first, expect a small rebase oncompress.tslines ~270-290.