Repository navigation
test: plugin-mode cache-friendliness matrix for all four wires (#1553) - #1571
Conversation
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.1523-pr.1571.831e41dThis exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr1571.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 Review complete — mergeable, with one cross-PR coordination caveat. Pulled head ① Original issue (#1553): delivers exactly what was ordered. P1–P5 + the anthropic geometry subtest map onto the ordered invariants (append-stability, fold-transition carrier replacement, multi-fold, marker/tag hygiene, zero transient artifacts). Two deltas vs the issue wording, both justified: the volatile-tail budget is ≤4 not ≤3 because #1419's retrieval note ( ② Regression review (existing-behavior inventory): since the diff is purely additive test code, the inventory is short and each item checks out:
③ Code review: read the full file. The flat-unit-list discipline is stronger than the proxy-mode twin's element-level compare (it dissolves anthropic/google same-role merging, so the unit sequence mirrors forwarded bytes), and the fold-transition check does exact whole-body reconstruction (
④ Test validity (teeth check): ran CI: all 12 checks green on head ⚠ Coordination caveat — merge order with #1570. #1570 (the #1567 strip fix, open, same base 中文摘要:审查了 plugin-mode 缓存友好矩阵测试 PR(#1571,纯测试、单文件 +627 行)——断言有牙(本地开启 |
|
Deep review complete — merge as-is (rebased onto current master, clean; head pushed). Design verified: P1 append-stability / P2a exact fold reconstruction / P2b occurrence=3 reality pin / P3 multi-fold survival / P4 no-transient-leak / P5 marker hygiene — occurrence-counting from day one (the anthropic element-counting artifact lesson from #1548 is baked in). Teeth (mutation-verified):
Gates: plugin matrix 5 pass + 4 skip-by-design; combined with proxy matrix 10 pass + 4 skip; typecheck ✓. Test-only (one file, zero src changes). Follow-through owed by #1567's fix PR: flip the |
5501b25 to
72697cd
Compare
…und (#1567 hardening) The unconditional prefix strip could lose a summary outright: if the client prunes or fails to re-send its compress pair, the in-place anchor was stripped with no carrier left (zero carriers). Restore the old predicate's self-verification — strip per-block only when that exact fold's pair is present in the (post-prepare) inbound history, matched by tool name plus the folded range quoted in the call args (flat {startId,endId} or {content:[...]}). hideConsumedCompressCalls (KEEP_LAST_ORPHANED) runs before the strip, so a kernel-hidden pair also keeps its anchor — fail-safe in both directions. Matrix (#1571) re-pinned to the intended behavior (0 carriers while pairs ride; exactly 2 pair quotes) and supplemented with two hardening scenarios: client drops a re-sent pair → anchor re-carries, bytes stable; 3rd concurrent fold → oldest pair pruned by KEEP_LAST_ORPHANED, oldest anchor kept.
Closes #1553
What
The plugin-mode twin of #1548's proxy-mode cache-friendliness suite (
tests/cache-friendly-proxy.test.ts), landed as a permanent gate. Test-only: one new file,tests/cache-friendly-plugin.test.ts(~627 lines); zerosrc/changes.Because the two compression modes have different summary carriers (plugin mode re-sends its own compress call+result from persisted history; proxy mode synthesizes them ephemerally), a green proxy-mode matrix proves nothing about plugin mode — hence the separate symmetric suite #1553 ordered.
Invariants pinned per wire (responses / openai-chat / anthropic / google)
One session per wire, 8 consecutive upstream-bound request payloads compared as flat unit lists (text blocks + structured tool units in serialization order):
/__bili/plugin/toolfold): the pre-fold span is replaced by exactly the expected carrier units (+ retained first user message) and nothing else; the client's pair stays visible at its chronological position every turn; coexistence pin: each fold summary occurs exactly 3× on every post-fold turn while its pair rides inbound (in-place carrier + fold spec echoed in the re-sent tool_call args + tail quote inside the persistently re-sent tool result).<acp>head tag, refs are never reused across turns, q/a marker lines are byte-stable within their ref, summary carriers stay untagged, and the system field (system/systemInstruction) is byte-identical across all turns.acp_loop_*ids in any forwarded body (plugin mode has none by construction — pinned so a regression cannot appear silently).KEEP_LAST_ORPHANED=2prunes the oldest pair exactly when a third arrives.Finding surfaced while building → #1567
The in-place
acp_summarycarrier is not stripped when the client's own compress pair rides inbound history — the plugin endpoint mintsplugin_<ts>callIds that can never equal the client's tool_use id, sostripKernelSummaries's source-keyed match never fires in plugin mode. That diverges from #1553's invariant-2a wording and #1551's "(plugin-mode) behavior unchanged" parenthetical. Filed #1567 with the full trace; the suite pins ACTUAL behavior and carries the intended-strip assertion skip-gated behindBILI_PLUGIN_STRIP_FIXED=1(off by default) so it flips on automatically once #1567 lands.Wire-specific normalization notes
Behavior changes
None — test-only workstream. No config surface touched. No wire behavior changed.
Pre-flight
1c60633c(post-docs: sync EN README to zh structure, add FAQ (round 3) #1564)npm run typecheck✓npm test: 3055 tests, 0 fail, 16 skipped (incl. the 4 skip-gated strip assertions) ✓npm run build✓