Repository navigation
[PR] fix(#3635): steer external summarizers to the enforced summary cap, name rejections, make the caps settable - #4445
ranxianglei wants to merge 3 commits into
Conversation
…ame rejections, make the caps settable External summaries longer than compress.maxSummaryLength were rejected whole after paying full latency, with the only trace a bare invalid_summary outcome - and the cap was accepted nowhere: the panel PUT dropped it, file edits never reached the resolved config, and the model-tool compress path never told its summarizer the number its validator enforces (the preflight path has since #1775). - state the exact enforced cap in the compress-path summarizer prompt (shared clause helper, byte-identical to preflight's) - name the rejection reason on each invalid_summary attempt and log it (describeExternalSummaryFailure moved next to its data type; re-exported from preflight for historical importers) - accept maxSummaryLength/minSummaryLength through parse/merge/apply so panel PUT and file edits reach the resolved kernel config - document both fields (CONFIGURATION en+zh, website seeds) Closes #3635
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.5345-pr.4445.c3ca967This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr4445.tgz
npm install -g packageInstall instructions are refreshed on each push. |
(ai: vllm-qwen/qwen3.8-27b) 查重: 本条是 PR #4445 的镜像,无独立查重对象;原 issue #3635 侧查重已做(不重复,孪生 #3634 已关闭,最近先例 #1775/#1779 只修 preflight 路径)。 标签: 本 PR 是 agent 已完成的工作(单 commit,awork),我不重做,按 [PR] 流程核验:拉分支读全量 diff、审方向/回归/代码/测试、本地定向验证。目前进展:
修正推完后我会给结构化八问结论。 |
…e floor disabled Review follow-up on this branch: summaryLengthBudgetClause documented "<= 0 / Infinity" as omitted but only gated on budget < minChars, so cap 0 + floor 0 rendered "AT MOST 0 characters" to the summarizer. Zero means unbounded; omit it. Pinned by a new assertion in tests/issue3635-summary-length-cap.test.ts.
…c passes Review follow-up: the summary-length rows were hand-written into CONFIGURATION.md / CONFIGURATION.zh-CN.md with wording that drifted from website/config-reference/compress.yaml, and website/docs/index.html + website/main.js were never regenerated, so the docs-sync artifact-drift gate went red. Regenerated all four derived files from the seed (node tools/gen-config-docs.mjs generate); the seed wording is the canonical one.
(ai: vllm-qwen/qwen3.8-27b) 核验完成。这个 PR 是 agent 已完成的工作(无 ework-agent-pr 标记,按 [PR] 流程做了独立审核而非重做)。结论:方向对、实现干净、测试有牙,审核中发现并直接修掉了两个小问题(已作为独立标注 commit 推到 PR 分支),CI 最终头全绿。建议合并(合并权在你,agent 不合并)。 结构化八问1. 是什么问题:外部摘要链有两个缺陷——①模型工具压缩路径的摘要器从未被告知被强制执行的字符上限(preflight 路径自 #1775 起就告知),超长回复烧完全程延迟后被整段拒绝,且日志只有裸 2. 什么原因导致的:两个独立根因——提示词/校验器不对称(校验器强制执行上限,提示词却不声明)+ 配置管线缺失(parse/merge/apply 三处都没映射这两个字段)。修复针对根因(疏),不是拦截症状(堵)。 3. 影响范围与严重程度:p2。能用但有明显问题:启用外部摘要链且回复超上限时整段丢弃(浪费延迟与成本),且上限/下限不可调。不涉及客户端 wire 形态与会话数据,不影响默认配置下的既有行为。 4. 怎么修复的:三层——①压缩路径复用 preflight 的共享 helper 5. 是否有回归问题:逐项审过既有行为——preflight 提示词字节不变(纯重构,真实 wire body 测试钉住,含禁上限的负例);默认值不变(kernel 20000/50);wire 形态、acp_summary 载体、kernel/、持久化格式均不动。审核中发现并已修复两处:
6. 是否破坏缓存:不涉及——客户端可见的出站前缀字节不变;长度预算子句只进外部摘要器的 side-call 提示词,unusable 字符串只流向日志/诊断(grep 过消费点,无一模型可见)。 7. 是否改了设计方向:没有。「整段拒绝、不截断」的方向保持;救援截断仍作为开放产品问题在 #3635 跟踪。 8. 是否引入了新的配置:有—— 验证证据
收工判定可合。PR 分支现有 3 个 commit(原提交 + 两个标注清晰的 review follow-up),diff 收敛到 13 个文件且每行都与 #3635 目的相关。等你合并;「超长摘要是否救援截断」留 #3635 由你拍板。 |
What this fixes
External summaries longer than
compress.maxSummaryLengthwere rejected whole after paying full latency — no truncation, no retry, and the only trace left was a bareinvalid_summaryoutcome nobody could act on. On top of that, the cap itself was accepted nowhere: the panel PUT silently dropped it (COMPRESS_SETTING_FIELDShad no entry), file edits never reached the resolved kernel config (mergeCompress/applyCompressSettingsnever mapped it), and the model-tool compress path never told its summarizer the number its own validator enforces — while the preflight path has done exactly that since #1775. So overshoots on the compress path were routine and unexplained; the floor-1 report measured 2/11 folds discarded this way on v0.1.204.Root cause, not symptom: the producer of the bad bytes is a prompt/validator asymmetry — the summarizer is asked for output it can never accept, and the operator has no dial to widen what IS acceptable. Both halves are fixed here.
Duplicate check: none open. Twin issue #3634 was already closed; closest prior art is #1775/#1779 (length-budget clause + rescue-truncate on the preflight path only) — this PR brings the same discipline to the compress path and makes the caps themselves settable.
Changes
src/external-summary-compress.ts, new shared helpersummaryLengthBudgetClauseinsrc/external-summary.ts). The compress-path work items now carry the sameLENGTH BUDGETclause preflight has had since preflight 摘要超长重试循环:summarizeRange 提示词无长度预算,超限摘要整体丢弃而非截断救援 #1775, rendered from the same number the validator enforces (min(range.summaryMaxChars ?? Infinity, config.compress.maxSummaryLength)). The two inline preflight copies were replaced by the shared helper — byte-identical prompts (existing pinned suites pass unchanged).src/external-summary.ts).invalid_summaryattempts now carry adetailmirroring the validator's check order (summary N chars exceeds cap M/below floor M/response N bytes exceeds byte cap M/empty or non-string response), rendered bydescribeExternalSummaryFailure— moved next to its data type, re-exported fromsrc/preflight.tsfor historical importers. The compress-path log line uses it (parity with preflight; was barebatch=<status>), and the all-fail refusal text now names length as the cause with the two real levers.src/config.ts,src/compress-settings.ts).compress.maxSummaryLength/compress.minSummaryLengthflow through parse → merge → apply into the resolved kernel config (panel PUT and file edits alike).0stays meaningful (unbounded cap / disabled floor); negative/non-finite rejected at parse. Docs: CONFIGURATION.md + zh-CN + website seeds (config-surface-guard green).Deliberately NOT changed: over-cap replies are still rejected whole on the compress path (no truncation added) — whether to add a bounded rescue-truncate there (mirroring preflight's #1775 pattern) is an open product question, tracked in the issue thread.
Behavior changes (old → new)
compress.maxSummaryLength, per-rangesummaryMaxChars)[external-summary] completed …log (compress path)batch=<status>tests/issue2484-overflow-and-summary.test.ts)[external-summary] completed (preflight) …log +unusablediagnosticsattempts=[t0:invalid_summary]Preflight prompts: byte-identical (pure refactor into the shared helper).
Config surface
compress.maxSummaryLength(number, default kernel20000,0= unbounded) andcompress.minSummaryLength(number, default kernel50,0= disabled) under the existing three-levelcompresshierarchy.defaultConfig().compress.{max,min}SummaryLength— no new semantics invented), but were missing fromCOMPRESS_SETTING_FIELDS,parseCompressSettings,mergeCompressandapplyCompressSettings, so every acceptance path dropped them. Considered alternatives: nothing — the per-range tool argsummaryMaxCharsremains the finer-grained lever and already worked.Both compression modes (§6)
Touches only the side-call prompt sent to configured external summarizers plus proxy-side config plumbing. No client wire shape change in plugin mode or proxy mode;
acp_summarycarrier handling untouched; client-visible history bytes unchanged, so prefix cache is unaffected.Tests
New
tests/issue3635-summary-length-cap.test.ts(7): executor rejection reasons (over-cap / below-floor / byte-cap / empty), describe-format preservation + detail rendering, clause gating, parse/merge/apply plumbing, and a wire integration asserting the clause reaches the HTTP body at both the default cap and a configured cap. Targeted neighboring suites local-green (157 tests across external-summary*, issue2484, compress-settings, web-routing, removed-compress-keys-inert, preflight-summary-*); full suite = remote CI.config-surface-guardand unused-export gates run green locally.Closes #3635