Skip to content

[PR] fix: steer compress partial-failure recovery back to one batched call (#1523) - #1526

Closed
ranxianglei wants to merge 1 commit into
masterfrom
2026-09-28_compress-recovery-batch-guidance
Closed

ranxianglei wants to merge 1 commit into
masterfrom
2026-09-28_compress-recovery-batch-guidance

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

What changed

droppedEntriesNote (src/stream.ts) — the partial-failure receipt appended to compress tool results when a submitted batch is only partially salvaged — taught serial recovery in both variants:

  • truncated: "re-issue the missing range(s)" — no instruction to keep batching.
  • invalidItems: "Re-issue the rejected range(s) in a new compress call" — singular new call, literally teaching one-range-per-call.

In lossy-gateway sessions (#1495: long JSON arrays stringify/truncated by the gateway), every big batch then produced explicit negative feedback plus per-range recovery guidance, so models rationally converged to one range per call — N serial proxy round-trips instead of 1. That is the post-v0.1.163 regression reported in #1523.

Both variants now steer back to ONE batched call: "batched with everything else still pending — never one range per call." The truncated variant additionally offers the gateway-resilient shape: carry the whole batch as a single plain-string content instead of an array — line-form segments (mNNNNN–mNNNNN optional topic header + summary lines, blank-line separated), which kernel splitLineEntries parses and which has no array structure for a lossy gateway to cut (the only surviving param shape in the #1495 session).

Test anchors updated: tests/issue1495-partial-compress-drop.test.ts (both variant assertions extended) and tests/issue1494-compress-params.test.ts:119 (old singular anchor replaced).

Behavior change disclosure (model-facing receipt text)

Variant Old New
truncated "…Check acp_status for what is still compressible and re-issue the missing range(s)." "…Re-issue the missing range(s) in ONE compress call, batched with everything else still pending — never one range per call. If large JSON arrays keep getting cut by this gateway, carry the whole batch as a single plain-string 'content' …"
invalidItems "…Re-issue the rejected range(s) in a new compress call." "…Re-issue the rejected range(s) in ONE new compress call, batched with everything else still pending — never one range per call."

Intended per #1523 (the old wording IS the defect). Clean-call receipts are byte-unchanged (pinned by the existing "clean call" test, still green). No config surface, wire protocol, persistence, or dependency changes.

Pre-flight (on rebased head, master 86e0b68)

  • npm run typecheck ✅
  • npm test: 3001 pass / 0 fail / 12 skipped (default-gated E2E) ✅
  • npm run build ✅
  • Local E2E upstream unreachable from this env; CI e2e job runs automatically (src/stream.ts is a request-pipeline hot file).

Fixes #1523

…#1523)

v0.1.163's droppedEntriesNote receipts taught serial recovery: the truncated
variant said 're-issue the missing range(s)' without a batch instruction, and
the invalidItems variant said 'in a new compress call' (singular). In lossy
gateway sessions (#1495) each big batch then triggered explicit negative
feedback plus per-range guidance, so models rationally converged to
one-range-per-call — N serial proxy round-trips instead of 1.

Both variants now steer back to ONE batched call ('batched with everything
else still pending — never one range per call'). The truncated variant
additionally offers the gateway-resilient shape: carry the whole batch as a
single plain-string content (line-form segments, blank-line separated), which
kernel splitLineEntries parses and which has no array structure for a lossy
gateway to cut.

Test anchors updated in tests/issue1495-partial-compress-drop.test.ts and
tests/issue1494-compress-params.test.ts. Clean-call receipts unchanged.
@github-actions

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-09-28_compress-recovery-batch-guidance (c459646)

Option A — Install this exact build (recommended)

npm install -g billion-context@0.0.1468-pr.1526.b4716d0

This exact version is immutable and reproducible. The rolling pr tag tracks the newest test build across all PRs.

Option B — Download artifact

  1. Download the artifact from the Actions run
  2. Extract the tarball and install:
tar xzf billion-context-pr1526.tgz
npm install -g package

Install instructions are refreshed on each push.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 Review of PR #1526 (head c459646) — pulled the branch, audited the code, checked CI. Conclusion below; one blocker found during duplicate screening.

① Original issue — direction ✅

Issue #1523 (source-marked from #1495) is correct and well-layered: the post-v0.1.163 serial-call regression is produced by the recovery wording itself (droppedEntriesNote, src/stream.ts:213) — the defect IS the strings, so rewriting them fixes the producer, not a symptom. This PR implements the issue's 3-point plan verbatim (both variants steer back to one batched call; truncated variant offers the plain-string content shape; test anchors updated). The plain-string shape claim was already validated against the kernel parser (splitLineEntries) in the #1523 thread.

② Regression review — behaviors on touched paths

droppedEntriesNote has exactly two call sites (src/stream.ts:423 failed-receipt append, :463 partial-success append); the diff changes only the two non-empty return strings + a rationale comment.

Existing behavior Verdict
Clean-call receipt (no drops, no truncation) Preserved — clean path returns "" before any changed line; byte-unchanged, pinned by the existing clean-call test (tests/issue1495-partial-compress-drop.test.ts:110), green in CI
Partial-success receipt (invalidItems > 0) Intentional change, disclosed old→new in PR body — this is the fix
Truncated-salvage receipt Intentional change, disclosed — minor side effect: the "Check acp_status" hint was dropped from this variant (low impact; the receipt still lists salvaged ranges and acp_status stays available). Noted, acceptable
0-block failed receipt with truncated salvage Same path as before (note appended when non-empty); wording-only change, no new path activation
Server-side PARTIAL logs, wire protocol, config surface, persistence, deps Untouched — string literals in tool-result content only

③ Code / ④ Tests / ⑤ Diff

  • Diff is minimal and clean: 3 files, every line serves the purpose (src/stream.ts, 2 test files). No as any, no console.error, no unrelated churn.
  • New assertions pin the exact steering sentences (batch instruction + "never one range per call" + the three string-shape elements) — real teeth: reverting the wording reds the suite. Old structural anchors (REJECTED/TRUNCATED/was LOST/reason text) retained.
  • Minor gap: no new assertion pins the n>1 invalidItems variant (existing coverage exercises n=1 only; the plural branch shares the same template, so risk is low).
  • CI on head c459646: fully green — typecheck, test matrix (ubuntu/windows × node 22/24), e2e real-client lanes (codex/pi/opencode/dsh), hermetic registry e2e, build-artifact, version-guard. Base 86e0b68 == current master, mergeable clean. Preflight claims in the PR body confirmed.

⚠ Blocker: overlap with open PR #1520 (same root cause, same lines)

Duplicate screening surfaced PR #1520 ("fix(compress): teach ONE-call single-string re-issue in loss receipts", opened 2026-09-27T15:45Z — ~9 min before issue #1523 was opened, per the owner's #1495 re-review). It fixes the same defect in the same function, and both PRs edit the identical lines in src/stream.ts — they cannot both merge without a textual conflict. Differences:

#1520 #1526
Scope 4 receipts: truncated salvage, multi-entry rejection, unparseable-JSON failure, no-valid-ranges lecture 2 variants of droppedEntriesNote only
Truncated variant plain string is the PRIMARY re-issue shape; keeps "Check acp_status" hint batched array primary, string as escalation ("if arrays keep getting cut"); drops acp_status hint
invalidItems n=1 deliberately unchanged also steered to "ONE new compress call, batched…"
Kernel coordination pairs with acp-kernel#472 (tool descriptions + nudge teach the same form) standalone
Tests adds an n=2 multi-entry rejection test extends n=1 anchors only

Both are CI-green and base-current. Not identical (scope + wording differ), so I'm keeping both open rather than closing either — owner decision needed on which is canonical. My recommendation: take #1520 as canonical (earlier, superset coverage — the two total-failure receipts carry the same defect class and #1526 leaves them untouched, and it's coordinated with the kernel-side teaching), optionally folding in #1526's sharper "never one range per call" phrasing; if you prefer #1526's wording instead, fold #1520's two total-failure-receipt additions into it.

Verdict: technically complete and mergeable as-is, but hold for the #1520-vs-#1526 call. Also stays human per the auto-merge gate (model-facing receipt wording = product decision).

中文摘要:PR #1526 代码正确、CI 全绿、干净回执逐字节不变(已验证),但查重发现更早的 PR #1520 修的是同一根因且覆盖面更大(4 处回执 vs 2 处)、还配套了 kernel 侧改动,两个 PR 改同一批行无法同时合并——请 owner 拍板以哪个为准(建议 #1520 为主、吸收本 PR 的措辞),在此之前先搁置合并。

@ranxianglei

Copy link
Copy Markdown
Owner Author

深审:✅ 可合——src 措辞精确落实 #1523 的修复建议,测试锚点齐,零越界。

验证

  • 消费面:droppedEntriesNote 仅两个调用点(stream.ts:423 失败路径、:463 部分成功路径),均为 proxy 车道 compress 执行回执;src/agent 与 compress-tool.ts 零 "Re-issue" 措辞——插件模式回执由内核侧构造,不携带本缺陷,无需镜像修改 ✓
  • 词表一致性:单串形态教学(first line 'mNNNNN–mNNNNN optional topic' + segments separated by blank lines)与内核 0.0.98 nudge/lean 教的字节形态逐字兼容——两层教学同一套话术,不会打架 ✓
  • golden 无残留:旧措辞无金丝雀钉(仅两测试文件锚定,均已更新)✓
  • 门禁:目标套件 13/13、receipt/stream 邻域 30/30、typecheck ✓;新措辞被 5 处断言直接钉死(变异必红)

细节核过

  • 单数路径(n=1)语法完整(range 单数 + ONE new compress call)✓
  • truncated 变体删掉 "Check acp_status for what is still compressible" 指针——判定为故意且正确(与 出现持续压缩失败,无法自动恢复 #847 的 acp_status 压力环教训一致;回执自身已列 applied/lost,模型可推断)✓
  • "never one range per call" 不会误伤合法单条:措辞反对的是串行逐条模式,单条 compress 本身在其他回执路径无惩罚 ✓

无阻塞项。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 收到深审结论,无异议——我这边也零阻塞。补两条我复核后的事实更新(不影响「可合」判定):

  1. master 已前移,但本 PR 仍干净:base 86e0b684 → 当前 5ffafae7(期间并入 release v0.1.165 #1556 release v0.1.165、fix: pin acp-kernel 0.0.98 (content salvage + one-string batch) #1552 kernel-0.0.98、test+fix: cache-friendly outbound matrix across four proxy-mode wires (#1548) #1554、docs: slim READMEs into focused landing pages #1527)。我已逐文件核对:新 master 的提交未触碰本 PR 的 src/stream.ts 与三个测试文件,GitHub 的 "behind" 只是基线落后,无文本冲突——现在直接合并即可,无需 rebase(rebase 只会白白重跑一轮 CI)。
  2. [PR] fix(compress): teach ONE-call single-string re-issue in loss receipts #1520 的配套项已独立落地:fix: pin acp-kernel 0.0.98 (content salvage + one-string batch) #1552(kernel 0.0.98)已在 master,即我上条评论里列在 [PR] fix(compress): teach ONE-call single-string re-issue in loss receipts #1520 一侧的「kernel 侧同话术教学」差异点已消失,与你核过的词表一致性结论一致。

剩一个待你处置的小尾巴:PR #1520 仍开着。若 #1526 先合,#1520 会在 droppedEntriesNote 同一批行上文本冲突。两个选项:(a) 直接关闭 #1520,标记由 #1526 + kernel 0.0.98 取代;(b) 若你想要它多覆盖的两处全失败回执(unparseable-JSON / no-valid-ranges)的单串形态教学,把它砍成只含那两处的小 follow-up 再走流程。我建议 (a) 或 (b) 由你定,我不擅自动它。

中文摘要:确认深审「可合」结论,补充核实了 master 前移后本 PR 仍零冲突可直接合并、kernel 0.0.98 配套已落地,并提请 owner 决定重叠的 PR #1520 是关闭还是缩成小 follow-up。

@ranxianglei

Copy link
Copy Markdown
Owner Author

(ai: zhipuai-lb/glm-5.3)

陈旧票清理(第三批动作①):目标 issue #1523 已关。为避免重复劳动关闭本 PR;如判断有误请直接 reopen 并留言。

@ranxianglei ranxianglei changed the title fix: steer compress partial-failure recovery back to one batched call (#1523) [PR] fix: steer compress partial-failure recovery back to one batched call (#1523) Oct 24, 2026
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