Repository navigation
fix(packs): leanPack acpTags states ref stability across compression - #419
Conversation
📦 Built Package ArtifactBranch: Option A — Install from npm PR tag (recommended)In your adapter project: npm install acp-kernel@pr-419Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf acp-kernel-pr419.tgz
npm install ./packageThis comment is automatically updated on each push. |
[bot] 🏷 Review of PR #419 (fixes #417) — verified on branch 方向关(原 issue): Bug 属实。核对 回归审查: 改动只碰 leanPack pi 代码: 单行改动,最小且准确。"Message refs remain stable across compression within the same session state." 精确圈定了保证范围;保留的从句仍覆盖真实的 reset 重启场景(新会话状态),恢复流程逐字未动。 测试有效性: 新增 diff 整洁度: 2 files, +29/−1——每一行都服务于目的(修复 + 钉住它的测试)。Prettier 干净(pr-validation 的 format 门绿)。 CI: 全绿 — pr-validation ✓ / test(22) ✓ / test(24) ✓ / build-artifact ✓; 说明:#387 的重叠(重审时丢掉其 结论:可以合并。我不会执行合并(PR 合并仅人工操作)。 中文摘要:修复了 leanPack 提示词里“压缩后 refs 可能重新编号”的错误说法(实现上同一会话状态内 refs 从不重发),改为准确表述并保留原有失效恢复规则,补了带断言的回归测试,CI 全绿,可以合并。 |
The leanPack pi-adapter acpTags line claimed "Refs may be renumbered
after compression," contradicting assignRefs (src/refs.ts): within a
single session state existing byRaw/byRef refs are copied through and
new refs allocate monotonically from nextIndex — never reissued.
Numbering restarts only across a generation switch / native-compaction
reset, which already carry dedicated error text. Replace the false
claim with "Message refs remain stable across compression within the
same session state." and retain the stale-ref recovery rules
(acp_status { scope: "uncompressed" }, no offset guessing, batch
ranges). String-pinned regression test added.
Fixes #417
Adopts the broader regression net from duplicate PR #429: asserts /renumber/i appears nowhere in either builtin pack (defaultPack, leanPack), complementing the existing lean acpTags string-pins. Red pre-fix, green post-fix.
d67f15e to
3b4dce3
Compare
Closes #417
Problem
The built-in
leanPackpi-adapteracpTagsline (src/packs.ts:225) told models:This contradicts the implementation.
assignRefs(src/refs.ts:52-84) copies the existingbyRaw/byRefmaps through, skips already-mapped messages (if (map.byRaw[message.id]) continue;), and allocates new refs monotonically fromnextIndexviaallocateFreeRef— refs are never reissued within a session state. Numbering restarts only across a generation switch / native-compaction reset, which already carry dedicated error text. So within one session state, compression does not renumber. Consistent with the kernel contract "Message Ids Are Never Reused".Change
One model-facing line in
src/packs.ts(leanPackadapters.pi.promptSections.acpTags), first sentence only:Refs may be renumbered after compression.Message refs remain stable across compression within the same session state.The rest of the line is retained verbatim (stale-ref recovery:
acp_status { scope: "uncompressed" }, retry in-turn with reported refs, never guess offsets, batch ranges). The retained clause still covers the rare real restart case (a new session state after reset) by telling the model exactly how to recover if it ever hits a stale ref. Wording follows the issue's suggested phrasing (pi-side-consistent, token-lean for the lean pack).Behavior change (disclosure)
Model-facing prompt text only — no programmatic semantics, error shape, or wire format touched. Old → new: the false per-compress renumbering expectation is removed; models are now told refs are stable within a session state, plus the unchanged recovery procedure. Why: the old line taught models to expect a renumbering that no longer happens, contradicting both the ref-immutability invariant and the dedicated reset-path error texts, and could cause unnecessary
acp_statuscalls.Relationship to #385 / #387
Same fix as part 2 of PR #387 ("leanPack ref-stability wording"), split out so the uncontroversial factual correction lands independently of #387's protected-zone acp_status-guidance change (part 1), which was shelved pending root-cause investigation. When #387 is revisited, drop its
src/packs.tschange (keep only itssrc/compress.tspart) to avoid a duplicate edit on this line. Discovered independently from billion-context-pi#541; the pi default-prompt analog was fixed there in billion-context-pi#543.Cross-repo follow-up (not done here)
billion-context-pi
CONFIGURATION.md:890describes the lean pack with "renumbering recovery" wording; needs a matching update once this kernel change ships. Out of scope for this repo — flagging for tracking.Tests
String-pinned regression in
tests/packs.test.ts: asserts the stability sentence is present,"may be renumbered"is gone, and all four retained failure-handling rules survive. Fails pre-fix, passes post-fix.Verification (rebased onto current origin/master
fafc9c8, v0.0.89)npm run typecheck: cleannpm test: 1109/1109 passnpm run build: successformat:checkreports pre-existing non-conformant files on master itself; this diff adds zero new violations)