Repository navigation
fix(#1029): self-contained compress failures, incoming marker strip, refs span hint - #1034
Conversation
[bot] 🏷 Reviewing this PR now — pulling the branch ( |
9ed1e2b to
4de8233
Compare
📦 Built Package ArtifactBranch: Option A — Install from npm PR tag (recommended)npm install -g billion-context@pr-1034Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf billion-context-pr1034.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 Review of PR #1034 — verified, rebased onto current master, ready to merge (merge itself stays with you: #1034) Verdict: all three fixes are correct and well-scoped. No issues found in the code; two housekeeping items handled directly on the branch (below). Verification (on the rebased head, not the original base)The PR was based on
Root causes confirmed
Housekeeping done on the branch
Auto-merge gate assessmentTouches wire-visible message shape (marker text, incoming content mutation) and spans the compress-loop hot file → human-merge territory per §7.4, which is why this lands via your merge button. Nothing load-bearing (no 中文摘要:修复了 compress 失败回执不自包含(标记只剩一行、拒绝原因丢失导致模型盲目重试)、参数解析失败不触发重复失败升级、会话代际变更后陈旧 m-ref 无可用范围提示三个问题(均已对照内核源码核实根因);已在当前 master 上完成 rebase(Google-wire 冲突按双方意图合并)、补齐 CHANGELOG、本地 typecheck/2051 测试/build 全绿并推回分支,可以合并。 |
[bot] 🏷 CI follow-up — all four workflows green on the rebased head
PR is (And the standing suggestion from my review above: close stale PR #1008 once this lands — its span-hint intent is covered by |
…refs span hint 1. no-valid-ranges failure: reasons were multi-line bullets so line 1 ended with a dangling 'Rejected entries:' header; the streamed visibility marker keeps only line 1, so clients stored a truncated failure with an empty-looking list. Reasons are now inlined on line 1 (<=3, <=160 chars each). 2. The #847 repeat-failure guard only tracked applyRanges execution failures; malformed-argument parse failures retried blindly (5x observed). The streak guard now covers the parse path too. 3. After a session-generation change (new session instance, refs restart at m00001), stale refs failed every batch. Zero-block rejections now inline a compact current-context snapshot (visible message count, ref span, active blocks) so the model can self-correct without an extra acp_status round-trip. Marker accumulation under full-history resend: incoming history is stripped of ACP status marker lines in all three prepare paths (mirrors the #359 panel-strip pattern; messages never deleted, emptied text degrades to a space), and the loop suppresses duplicate identical markers within one request.
4de8233 to
8ba9b9e
Compare
Background
Issue #1029 reports three ACP status defects observed on DSH Desktop v0.6.5-beta.1 (proxy mode, OpenAI protocol, full-history resend every step, prefix-affinity sessions):
Rejected entries:list always empty → the model cannot self-correct (5 identical malformed retries observed);Root causes (verified against master @ 3adc9ac, acp-kernel 0.0.80)
Defect 2 — dangling header (bili bug). The no-valid-ranges failure from
applyRangesput each reason on its own line (Rejected entries:\n- entry 0: …), so line 1 ended with a bare header. The streamed visibility marker (buildVisibilityMarker) keeps only line 1 of the result — so the ❌ marker stored by the client always ended withRejected entries:and zero bullets, even though the tool result itself carried the reasons. Proxy-mode tool calls are ephemeral (never enter client history), so on the next turn the model's only memory of the failure was that truncated marker → blind identical retries. Additionally, the #847 repeat-failure guard only tracked execution failures; malformed-argument parse failures had no streak escalation at all.Defect 3 — stale refs across generations. Kernel 0.0.80 already handles this correctly (gateMessage explains the generation scenario + diagnostics + points at
acp_status). What was missing is bili-side convenience: the rejection carried no hint about which refs are currently valid, forcing a dedicatedacp_statusround-trip that models often skip.Defect 1 — marker accumulation (bili enabler; the literal concatenation is DSH-side). In proxy mode, failed-compress markers stream to the client as plain assistant text (#717 design). DSH stores them in its own history and resends the full history every step, so stored markers re-entered the model context and reading flow on every turn, accumulating under retry storms. No incoming-side stripping existed anywhere (outgoing tag/marker stripping did; incoming history was forwarded verbatim). Note: the literal "marker inside the user's text part" concatenation happens on DSH's storage/render side (its source is not available here) — details requested in the issue thread; the bili-side enablers are fixed below.
Changes
src/stream.tsRejected entries: X | Y.— both the tool result and the streamed marker carry the full actionable text;[Current context: N visible message(s), refs mNNNNN–mMMMMM, K active block(s). Refs restart at m00001 after a session-generation change — request only refs inside this span, or call acp_status for exact compressible ranges.]src/acp-panel.ts— newstripAcpStatusMarkers(): strips ACP status marker lines (emoji-prefixed[ACP] …, line-initial; plain[ACP]text untouched) from incoming user/assistant message content in string and text-part form. Mirrors the pi plugin /acp panel via ctx.ui.notify() — transient toast in web hosts (same class as billion-context-pi#255) #359 panel-strip pattern: messages are never deleted (tool_calls pairing safety); emptied content degrades to" ".src/server.ts— applies the strip in all three prepare paths (Anthropic/OpenAI/Responses) right after the existing panel-strip, with an info log when lines are removed.src/loop/core.ts— suppresses duplicate identical status markers within one request (retry storm → one marker instead of N).tests/issue1029-acp-marker-stale-refs.test.ts(5 regression tests reproducing each defect); updatedtests/compress-reject-reasons.test.tsassertions to the inline format.Both compression modes considered (§6): plugin mode (
handlePluginTool) returns raw results and is unaffected by marker changes; it benefits from the self-contained failure text + refs snapshot. Incoming stripping applies to all requests and is a no-op where no markers exist. No config schema / persistence / cross-repo changes.Pre-flight (rebased head 9ed1e2b on master 3adc9ac)
npm run typecheck✅npm test✅ 2029 pass / 0 fail / 2 skipped (e2e-gated)npm run build✅Closes #1029