Repository navigation
fix: withhold ACP compression surface below minCompressRange (#1112) - #1121
ranxianglei wants to merge 2 commits into
Conversation
A fresh session below compress.minCompressRange (default 5000 chars) was already exposed to the full ACP surface — compress/decompress/search_context/acp_status tools plus the compression philosophy prompt — from request one, while the kernel sums range chars against that same floor: every compress call in such a session is guaranteed to fail, and the model then burned rounds on acp_status/search_context (including conversation_id "current" from the param description). - armAcpSurface (src/server.ts): sticky per-session feasibility gate; the ACP tools + philosophy prompt are injected only once visible content reaches minCompressRange. minCompressRange <= 0 restores legacy always-on. Wired into all four wire paths and the stream-handler absorb re-check. - Prepared.acpTurn: keeps the compress-loop pipeline (usage accounting, tag stripping) running for tracked turns even pre-arm, so pipeline selection is byte-identical to baseline; only wire injection differs. - applyRanges (src/stream.ts): when the whole conversation is below the floor, append a conclusive verdict (no range can succeed yet; do not retry or inspect status) to the standard failure receipt — kernel reason and #847 reversal note stay intact. - executeSearchContextTarget (src/decompress-shared.ts): literal conversation_id "current" (any case) aliases to the current session instead of failing with unknown-session. - Tests: new tests/fix-1112-acp-arm.test.ts (gate units, verdict receipts, end-to-end sticky arming through startServer); #1112 alias case in tests/search-context-cross-session.test.ts; sixteen harnesses restored to the always-on surface via { compress: { minCompressRange: 0 } } because they assert wire mechanics on sub-floor fixtures. Pre-flight on rebased head (origin/master + this change): typecheck clean, 2202 pass / 0 fail / 2 skipped, build OK.
📦 Built Package ArtifactBranch: Option A — Install from npm PR tag (recommended)npm install -g billion-context@pr-1121Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf billion-context-pr1121.tgz
npm install -g packageInstall instructions are refreshed on each push. |
#1112's arm gate makes the filler-less warmup turn structurally lighter than steady state (below minCompressRange it carries no ACP tools/philosophy prompt), so it became the new min and tripped the peak <= min*1.3 bound (CI e2e-fake-codex: PR warmup 45003B vs master 58814B; load turns are byte-comparable across both, ratio 1.0145). The bound targets the filler-injected steady state, so measure it over load turns; unbounded growth still trips it within two turns.
[bot] 🏷 Review of #1121 — verified against the rebased head (base = current What I verified
Found & fixed — pushed Notes (non-blocking)
Verdict: correct in both compression modes, clean diff, gates green on current master — mergeable once the re-run CI on 中文摘要:修复了低于 minCompressRange 的新会话从第一轮起就被暴露完整 ACP 压缩面(每次 compress 必然失败、模型空转 acp_status/search_context)的问题——压缩面改为可见内容达到阈值后一次性粘性注入,另加结论性失败回执与 |
|
[人工否决] 这个方向不合并 —— 没有定位根因,用"隐藏表面"预防症状,同时引入新的复杂度和能力损失。 为什么说没定位根因#1112 的产生机制是三要素叠加:
本 PR 只把要素 2 在 <5000 字符时用"表面隐藏"预防,要素 1、3 原样保留。直接后果(独立 review 实证): 同时引入的新问题
根因修法方向(讨论后再做)在决策点给模型状态正确的信息,而不是藏掉工具:nudge 引擎每次请求已经算出精确的 live 可压缩量(日志 本 PR 中可独立保留的两块(请拆成独立小 PR)
本 PR 关闭或按上述方向重做。 |
[bot] 🏷 接受否决。两个决定性技术点我都独立复核过,确认成立,不是只凭描述同意: 1. Arm ≠ 可压缩(口径不一致)— 成立。 PR head 的 2. Plugin mode 静默变更 — 成立。 master 的 你的三要素框架是对的:本 PR 只在要素 2 上用"藏表面"预防,同时砍掉了与可压缩性无关的能力(跨会话搜索 #841、decompress、acp_status),并静默把 已执行 / 进行中:
拆分 PR 就绪后我会在本线程跟进链接。 中文摘要:接受否决——独立复核确认两处硬伤(arm 按全部可见文本计数而 kernel 只数请求范围内 live 消息,arm 后仍可能必然失败;master 上 plugin 会话第一轮就有哲学 prompt,PR 静默改变了该行为);PR 已关闭,stream.ts 失败回执与 |
…inCompressRange When the WHOLE visible conversation holds fewer chars than compress.minCompressRange, no range combination can succeed (the kernel sums range chars against the single threshold), yet the standard failure receipt gave only generic 'combine more messages' advice — steering models straight back into compress retries and acp_status/search_context inspection loops (root-cause factor 3 of ranxianglei#1112). Append one conclusive sentence to the applyRanges failure receipt when minCompressRange > 0 and total visible chars < minCompressRange: the floor is unreachable for any range, so do not retry compress or inspect ACP state about it. Kernel reason string and the ranxianglei#847 reversal note stay intact; when a viable larger range exists the generic advice is unchanged. No config schema change, no wire-shape change beyond failure-time tool-result text, plugin mode unaffected (receipt text only). Piece 1 of the owner-approved split of PR ranxianglei#1121 (surface-gating half stays out of scope); re-applied standalone on current master per the split directive. Closes ranxianglei#1124
|
Closing per owner conclusion on #1112: the proxy-side artifacts from the incident log are already fixed on master independently — the literal "current" session resolution landed as #1125 (src/decompress-shared.ts, duplicating this PR's alias hunk), and the #156 loop guard now breaks only on re-submitted identical failing compress/decompress args (src/loop/core.ts failedSignatures), so a first failure no longer terminates the round. The remaining pieces here (feasibility gate + conclusive sub-floor receipt) were premised on injection-as-trigger, which the production record (all bili products inject unconditionally, never reproduced outside this single codex×gpt-6-astra incident) does not support. Branch 2026-09-22_acp-surface-feasibility-gate stays pushed; reopen or ask for a slimmed receipt-only variant if wanted. |
Closes #1112
Problem
A fresh Codex session below
compress.minCompressRange(default 5000 chars) was already exposed to the full ACP surface from request one — compress/decompress/search_context/acp_status tools plus the kernel's compression philosophy prompt — while the kernel sums range chars against that same floor. Every compress call in such a session is therefore guaranteed to fail (Total compressible content too small (1990 chars …, min 5000)), and the model burned the first turn on follow-up acp_status/search_context rounds — includingconversation_id: "current", taken verbatim from the param description "Defaults to the current conversation", which failed as an unknown session.Verified against the injected surface (acp-kernel 0.0.82
buildCompressSystemPrompt()+ tool schemas): nothing in it says compression is unavailable before the conversation can hold a viable range, and the philosophy section actively pushes compressing listed ranges. The proxy nudge was idle (as the issue log shows) — the trigger was the always-injected surface itself, not a proxy prompt.Changes
armAcpSurface(session, msgs, minChars, log)in src/server.ts: ACP tools + philosophy prompt are injected only once visible conversation content reachesminCompressRange; arming is per-session sticky (one-time flip at the threshold, like nudges — no mid-session tool removal after native compaction shrinks history). Wired into all four wire paths (anthropic/openai/google/responses) and the stream-handler absorb re-check.minCompressRange <= 0restores legacy always-on behavior.Prepared.acpTurn— the compress-loop pipeline (usage accounting, tag stripping) keeps running for tracked turns even pre-arm; pipeline selection stays byte-identical to baseline for every request shape, only wire injection differs. Without this, sub-floor sessions lost usage capture and preflight/emergency went blind (caught by 21 regressions during development).applyRanges: when the whole conversation holds fewer chars than the floor, NO range combination can succeed (the kernel sums across ranges against one threshold), so the standard failure receipt gains one appended sentence telling the model not to retry or inspect status and to continue the task. Kernel reason and the 出现持续压缩失败,无法自动恢复 #847 reversal note remain intact; when a larger viable range does exist, the generic advice is unchanged."current"alias — src/decompress-shared.tsexecuteSearchContextTarget: literalconversation_id: "current"(any case) resolves to the current session instead ofunknown session "current".{ compress: { minCompressRange: 0 } }because they assert wire mechanics on sub-floor fixtures (baseline always injected; their assertions were written against that).Review notes
Wire-shape change affecting both compression modes' injection path → human review required per AGENTS.md §7.4 (no auto-merge claim). Plugin mode unaffected: the proxy injects nothing there; the gate only gates proxy-side injection. Side requests/title-gen/passthrough/transform-fallback paths keep the pipeline off exactly as before.
Pre-flight (rebased head = origin/master + this change)
npm run typecheck— cleannpm test— 2202 pass / 0 fail / 2 skipped (baseline master: 2193 pass / 0 fail / 2 skipped)npm run build— OK