Skip to content

[PR] fix: book upstream-stated overflow counts into the fold target (#3450) - #3453

Merged
ranxianglei merged 4 commits into
masterfrom
2026-10-17_issue3450-upstream-stated-window
Oct 20, 2026
Merged

ranxianglei merged 4 commits into
masterfrom
2026-10-17_issue3450-upstream-stated-window

Conversation

@ranxianglei

@ranxianglei ranxianglei commented Oct 16, 2026 •

Copy link
Copy Markdown
Owner

Closes #3450

What was wrong

An upstream overflow 400 that states the rejected payload's own counts ("you requested N tokens (M in the messages, K in the completion)") fed only its WINDOW into the one-shot arm — M and K were parsed away and discarded. The arm booked a ceiling as if it were a measurement, so preflight saw "payload ~window, deficit 0" on an underestimating local meter (incident: local ~773k vs upstream-counted 904k) and forwarded a payload the upstream then billed over the wall — messages AND completion against the same 1048576 — killing the turn.

Fix

  • inspectContextOverflow now extracts requestedTotal / requestedMessages / requestedCompletion from provider-specific phrasings (OpenAI/DeepSeek messages+completion split, Anthropic "prompt is too long", Gemini "input token count"). Provider-specific on purpose: a wrong guess is worse than no guess.
  • The arm books the measured MESSAGE count; the side-request guard keeps the CEILING (overflowArmTokens).
  • The proven completion share is reserved off the wall for every payload-vs-wall judgment while the arm lives (the foldable quantity is MESSAGES); it retires with the arm on the next real usage report (「BUG」sideRequestGuard 会永久拦截进程内第三方插件的 LLM 调用,导致与MemOS冲突 #1110 lifecycle).
  • One wall per request on the refold path: prepare/nudge and preflight judge on min(declared, upstream-stated) instead of two different walls — "usage=105%" and "target 1048576" can no longer coexist in one second.
  • One-time warning when the upstream-stated window differs from the window in use, naming both values (issue ask ③; deliberately a log line, not new config surface).

Per-fold accounting is UNCHANGED by this PR: commitFold calls the shared apply machinery (stream.ts applyRanges), which already credits the fold and nets the GROSS mass out of lastInputTokens; the existing += defaultCountTokens(summary) add-back makes the baseline track the post-fold payload size exactly once. That pairing previously had no comment explaining it — added in src/preflight.ts (see S1 below for why it matters).

Why the incident's loop stopped after exactly one fold (S1) — root-caused from the reporter's raw log

The refold round 2 DID start but exited silently at its fit-check (if (decisionTokens < textTarget) break, positioned before the per-round log line), because after one small fold the armed floor had already crossed below the wall: arm booked the ceiling 1048576 as payload size → fold netted −(4253 gross − 2845 summary) = −1408 → floor 1047168 < wall 1048576 → "converged", one fold short of the true measured gap (~112k). With this PR's measured booking (904518) plus the reserved completion share (wall judged at 744000 under the incident config), a single small fold cannot flip the judgment — the floor must descend ~160k before the fit-exit may fire, so the marathon actually runs. No loop-code change needed for S1; it falls out of booking the right numbers.

Behavior changes (old → new)

Area Old New
Armed baseline on stated-counts overflow the stated WINDOW the upstream-measured message count (window only when unstated)
Preflight wall while armed declared/stated window window − proven completion reservation
Refold prepare/nudge wall declared — different from preflight's stated override min(declared, stated), identical to preflight's
Persisted stats — +overflowArmCompletionReserve, +overflowArmMismatchWarned (absent on legacy files = legacy behavior)
Logs — +one-time mismatch warning naming both windows

No config schema change. No kernel change. Wire shape unchanged (folded bodies are the existing preflight artifact). Per-fold lastInputTokens accounting unchanged (see note above).

Commit 12e0bf4d9 reverts an earlier netting edit in commitFold: tracing the reporter's exact log values (1048576 → 1047168) showed the shared apply path already nets the gross fold, so that edit would have double-netted and made the S1 premature-convergence class worse. Revert restores master's accounting byte-for-byte; the kept comment documents the cross-file invariant.

Tests

  • tests/context-overflow.test.ts: verbatim incident body, comma grouping, Anthropic/Gemini counts, plus regression guards (no-count bodies keep legacy behavior; legacy OpenAI "your request used …" phrasing must NOT match).
  • tests/e2e-issue3450-stated-counts.test.ts (new, hermetic): T1 uncloseable gap → visible 400, never a masked over-forward (arm facts asserted: measured baseline, reservation, ceiling guard, mismatch flag); T2 small stated window → in-request rescue under the message budget, reservation retires with the arm.
  • tests/issue1195-overflow-refold.test.ts B: assertion updated to the new arm value (measured 130000 vs ceiling 128000) — the byte-identical passthrough contract it guards is unchanged.
  • Targeted local runs green post-revert: parser 31/31, new e2e 2/2, preflight-area regression batch (futility, tier-recovery, batch-fold, emergency-fold, baseline-anchor, calibration, cache-ledger, host-usage-postfold) 69/69. Full-suite verdict = CI.

查重 / coordination

查重: 不重复 — same family as #3017 (denominator drift) but different symptom (dead turn vs unpredictable thresholds) and different mechanism (wall-selection inconsistency + discarded upstream counts vs per-request sampling drift); full comparison in the issue reply. Adjacent open work: PR #3328 (Closes #3017) touches the same modelContextLimit plumbing — if it lands first, rebase this onto it.

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-10-17_issue3450-upstream-stated-window (5b91fb5)

Option A — Install this exact build (recommended)

npm install -g billion-context@0.0.4627-pr.3453.ea75d9d

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-pr3453.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

(ai: vllm-qwen/qwen3.8-27b)

查重:不重复。 我独立检索了 open+closed 的 issue/PR(overflow / preflight / modelContextLimit 关键词面),与本 PR 同族的邻居及区分:

无并列重复 PR。base 已是当前 master(ce9bc90a3),mergeable=True,CI 在跑(blocked 状态为等待检查)。开始独立审核:拉分支逐文件读 diff、过既有行为清单、审测试有效性。结论按八问体例随后跟上。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

PR #3453 审查结论(独立复审:逐文件通读全部 diff、对触碰路径的既有行为逐项清点、在 PR head 本地实跑直接受影响的 3 个测试文件 37/37 通过。CI:30 通过 / 15 skipped(门控 lane)/ 1 个分片 test (ubuntu-latest, 24, 1) 仍在跑,目前零失败)

八问

  1. 是什么问题:上游因上下文溢出拒绝请求时,错误体里通常带着实际计数("requested 1160518 tokens (904518 in the messages, 256000 in the completion)")。bili 只从这句话提取了窗口上限,把计数扔了:把上限记成该轮"实际大小",且判定时墙不一致(prepare/nudge 用声明值、preflight 用 stated 值)、fit 判断又不扣 completion 份额。结果:本地估算低于真实计费 → 判定 deficit 0 → 照发 → 上游再 400 → 整轮死亡([Bug][dsh native] preflight fold target sits ABOVE the engine's own denominator (1048576 vs 1000000) and the upstream-stated window from a 400 never feeds it — 'deficit 0' forwards an over-window payload → context_length_exceeded kills the turn #3450 实例:本地估 ~773K,真实计费 1160K vs 上限 1048K)。
  2. 什么原因导致的:同一机制域的三个缺陷:① arm 把窗口上限记成实测基线(relay.ts armOverflowShrink 丢弃了 messages/completion 计数);② 两段式选墙不一致——handle.ts 只把 stated 窗口传给 preflight 阶段,prepare/nudge 仍看声明值,同一请求两套墙;③ preflight 只拿 input 对整窗判断,不扣已证实的 completion 份额(真实 message 预算 = 窗口 − completion)。再叠加 commitFold 基线单调增(+= summaryCost),即使折了也永远收敛不到 fit。根因不是"本地估算不准",而是"唯一精确的数据(上游报的数)被丢弃 + 决策墙不统一"。
  3. 影响范围与严重程度:影响"上游返回带显式计数的 context-overflow 400"的会话(OpenAI/DeepSeek 式 messages+completion 措辞全量,Anthropic/Gemini 部分计数)。严重程度:该轮直接死(400 透传、用户可见失败),不是静默损坏。触发条件较窄(需先发生一次溢出 + 本地计量低估 + 声明值与 stated 值不一致或 completion 份额不可忽略),但触发即致命;实例 lane 是 dsh native(声明 1M、贴着上游上限无余量)。
  4. 怎么修复的:留住测量、统一决策墙、预留已知量。parseOverflowCounts 按 provider 特定措辞提取 messages/completion(只解析认得的、错猜比没有更糟);arm 记实测 message 数(guard 字段仍留上限);arm 存活期间所有 fit 判断的墙上扣除已证实的 completion 份额,随下一次真实 usage 报告与 arm 一同退役(「BUG」sideRequestGuard 会永久拦截进程内第三方插件的 LLM 调用,导致与MemOS冲突 #1110 生命周期不变);refold 路径在进入 prepare 前把 min(声明, stated) 统一进同一份 reqConfig,使 prepare/nudge/preflight 在同一请求内看到同一面墙;commitFold 把折掉的量从基线中净出(token regime,char regime 行为不变),让武装底线能降下来、循环能收敛到 fit;声明 ≠ stated 时一次性告警日志(log-only,不是配置)。
  5. 是否有回归问题:逐项清点过以下既有行为——无计数 body(legacy 各措辞)→ 行为不变(parser 返回空、arm 照旧记窗口;单测含负例钉住 legacy OpenAI 措辞必须不匹配);context window problem continues #987 不从流量学窗口 → confirmedContextLimits 不动,e2e 断言 undefined;使用pi 压缩后就提示prompt is too long #1195 byte-identical 透传(收不了的缺口原样透传原始 400)→ 保持(T1 断言诚实 400,不用 over-forward 掩盖);「BUG」sideRequestGuard 会永久拦截进程内第三方插件的 LLM 调用,导致与MemOS冲突 #1110 arm 退役时机 → 不变(settleUsageReport / resetSessionCompression 均删新字段);side-request guard 上限 → overflowArmTokens 仍 = 窗口;首转发路径与 nudge 分母 → 不变(统一只发生在 refold 重入);持久化兼容 → buildRecord 全量 spread stats,旧文件缺字段 = 旧行为。发现一个交互(非缺陷,值得知晓):非 anthropic wire 上 output-headroom 预留(默认 ≤25%×窗口)会与新的 completion 预留叠加——arm 期间折叠目标更保守(窗口 − headroom − 已证实 completion),方向安全(多折不多发,不会 over-forward),arm 退役后自动恢复;anthropic wire(事故 lane)无 headroom 预留,不受影响。
  6. 是否破坏缓存:不涉及。prefix cache、重试策略、去重键均未动;summary carrier 与 wire 形状不变;新增字段是加法式 session stats。
  7. 是否改了设计方向:没有。仍是"一次性 arm + 下次真实报告退役"的生命周期,仍是"不从流量学窗口";本修复只是让 arm 记账更准、决策墙统一。
  8. 是否引入新配置:没有。仅两个 session 内部状态字段(overflowArmCompletionReserve / overflowArmMismatchWarned,加法式持久化)+ CONFIGURATION en/zh 各一段文档说明 modelContextLimit 与 overflow-arm 的关系。无新 env/config/CLI。

行为变更清单(旧 → 新,均有原因):

  • 带显式计数的溢出 arm 基线:窗口上限 → 实测 message 数(无计数时行为不变)——原因:上限不是大小,拿它当基线会让折叠目标失真;
  • arm 存活期 preflight 墙:modelContextLimit → modelContextLimit − 已证实 completion 预留(arm 退役自动恢复)——原因:completion 和 messages 同墙计费,input-only 判断必然高估可发量;
  • refold 路径 prepare/nudge 墙:声明值 → min(声明, stated)(首转发路径不变)——原因:同一请求内两套墙会让 nudge 与 preflight 各判各的;
  • refold 折叠期间 lastInputTokens(token regime):单调递增 → 净出折掉的质量 − summary 成本(char regime 不变)——原因:单调增使武装底线永不下降,循环无法收敛到 fit;
  • 日志:+ 一次性 "stated ≠ 在用窗口" 告警。

测试有效性:真测试,断言有牙。新 hermetic e2e T1/T2 我推演过旧代码必挂(T1:旧代码 arm 记 1048576,落在断言区间外;T2:旧代码底线单调增、收敛不到 fit → 透传 400 而非 200);parser 单测含负回归守卫;issue1195-B 断言随新语义同步更新(byte-identical 契约本身未变)。本地在 PR head 实跑受影响的 3 个文件:37/37 通过。

合并顺序提示:#3328(Closes #3017,同样动 src/server.ts 与 src/server/handle.ts 的墙/分母逻辑,open)与本 PR 同域——后合者需要 rebase 并核对语义交互(两者都在调"判断用哪面墙")。PR 描述里已注明此协调事项。

判定:可合。代码层面无拦阻项;待最后一个 CI 分片 test (ubuntu-latest, 24, 1) 转绿(当前 30 通过 / 零失败),完成后我补一条确认。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

CI 全量确认:最后一个分片 test (ubuntu-latest, 24, 1) 已转绿。PR head 4c694dbda 全部 check runs:31 通过 / 16 skipped(门控 e2e lane,正常)/ 0 失败。

维持判定:可合——代码审查(八问 + 回归清点 + 行为变更清单见上一条)、本地定向测试(37/37)、CI 全量三层均已通过。合并顺序注意 #3328 同域,后合者 rebase 即可。

@ranxianglei

Copy link
Copy Markdown
Owner Author

解决冲突

@ranxianglei ranxianglei changed the title fix: book upstream-stated overflow counts into the fold target (#3450) [PR] fix: book upstream-stated overflow counts into the fold target (#3450) Oct 19, 2026
@ranxianglei
ranxianglei force-pushed the 2026-10-17_issue3450-upstream-stated-window branch from 12e0bf4 to b9e5ad7 Compare October 19, 2026 16:37
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

冲突已解决:分支已 rebase 到当前 master(217a5ba44,含 #3739 arm-headroom-clamp、#3674 nudge 重构等 ~40 个合并),force-push 完成(12e0bf4d9 → b9e5ad733),PR 状态已恢复可合并(mergeable,behind 一个纯日志措辞提交 #3850,无文件交集,不阻塞)。

八问

  1. 是什么问题:系统转发上游 PR 冲突——本分支与 master 在两个文件上文本冲突,无法合并。
  2. 什么原因导致的:master 期间合入了 [PR] fix: clamp the overflow-arm to the headroom-reserved judging limit #3739(外部贡献的 arm-headroom-clamp)与 The nudge growth reference point, once clamped by a single high-water mark, never recedes — long sessions must wait unti | nudge 增长参考点被单次高水位钳死后永不回落,长会话只能等到 75% OVER-LIMIT 才压缩 #3674(nudge 低水位重构),恰好压在本 PR 的两个改动点上(relay.ts 的 overflow-arm 写入、cache-ledger.ts 的 settle 清理)。更关键的是,rebase 后的定向验证发现两个修复的语义组合出一个双方各自测试都覆盖不到的回归:[Bug][dsh native] preflight fold target sits ABOVE the engine's own denominator (1048576 vs 1000000) and the upstream-stated window from a 400 never feeds it — 'deficit 0' forwards an over-window payload → context_length_exceeded kills the turn #3450 的「preflight 墙减 completion 预留」是在 handle.ts 已经就地改写为保留值之后的 config.modelContextLimit 上再做减法(completion 份额被计了两次),只要「存在输出预算预留 && 错误消息带 completion 计数」同时成立,preflight 墙就塌向零,rescue fold 完全不触发。
  3. 影响范围与严重程度:冲突本身 = PR 不可合并。组合回归 = 特定条件(1M 窗口级大窗 + 声明输出预算 + 上游报错带分段计数)下会话陷入无限 400 循环、完全不可用——正是本 PR 要修的那类事故,只是换了个入口。触发面窄但后果严重,所以在本次 rebase 里一并修掉并钉了测试。
  4. 怎么修复的:rebase + 按意图取并集——基线取 min(实测消息数 ?? 声明窗口, 判定上限)(fix: overflow-arm stored above the headroom-reserved judging limit → unbounded CONTEXT_WINDOW_EXCEEDED loop #3738 的不变量:meter 不得超过内核实际比对的保留上限,否则各档位永远不触发;无输出预算时该钳制恒为 no-op);side-request guard 保持收到声明天花板(它自己会对每个请求的自身输出做预留,喂预扣值会二次扣减——已核对调用点时序确认无双重扣减);preflight 墙改为 min(保留上限, 声明墙 − completion 预留);删除 The nudge growth reference point, once clamped by a single high-water mark, never recedes — long sessions must wait unti | nudge 增长参考点被单次高水位钳死后永不回落,长会话只能等到 75% OVER-LIMIT 才压缩 #3674 已从全仓库移除的 reanchorNudgeOnUsageDrop 调用。
  5. 是否有回归问题:逐项过过既有行为——无输出预算路径逐字节等价(此时判定上限==声明窗口,所有钳制/min 均 no-op,e2e T1/T2 在合并态原样绿);fix: overflow-arm stored above the headroom-reserved judging limit → unbounded CONTEXT_WINDOW_EXCEEDED loop #3738 核心不变量(meter ≤ 判定上限、档位可触发)经基线钳制保留;[Bug][dsh native] preflight fold target sits ABOVE the engine's own denominator (1048576 vs 1000000) and the upstream-stated window from a 400 never feeds it — 'deficit 0' forwards an over-window payload → context_length_exceeded kills the turn #3450 三件事(实测记账、completion 预留随下次真实 usage 报告退役、窗口失配一次性告警)全部保留;side-request guard 行为不变。定向验证:npm run typecheck 干净 + 5 个相关测试文件 46/46 通过(fix-arm-headroom-clamp / e2e-issue3450-stated-counts / context-overflow / issue1195-overflow-refold / e2e-overflow-selfheal);全量裁决交给推送头部的 CI。
  6. 是否破坏缓存:不涉及——未触碰缓存/重试/游标/去重键;arm 字段生命周期不变(overflow 时设置,下次真实 usage 报告退役)。
  7. 是否改了设计方向:不涉及——仍在既有 overflow-arm / preflight-wall 机制内,只修正两个合并特性的组合方式。
  8. 是否引入了新的配置:不涉及。

行为变更披露(相对本 PR 原始描述,旧值→新值+原因)

收工判定:冲突闭环,可合并;等待 CI 全量裁决后由人工合并。

— 备注:组合回归作为本次冲突收尾的一部分以独立标注 commit(b9e5ad733)修在本 PR 内,属同一失败域(overflow-arm 计量),不另立项。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

冲突已解决完毕(这条可能赶在我上一条回复之前):分支已 rebase 到当前 master(217a5ba44)并 force-push(12e0bf4d9 → b9e5ad733),PR 状态已恢复 mergeable。master 之后新进的唯一提交 #3850 是纯日志措辞修改,与本分支无文件交集,不构成冲突(behind 不阻塞合并)。

两处文本冲突(cache-ledger.ts、relay.ts)按意图取并集解决;rebase 验证中还修掉一个两个修复组合出的双重扣减回归(独立标注 commit b9e5ad733,详见上一条八问回复中的行为变更披露)。typecheck 干净,定向测试 46/46 通过。

等 CI 全量裁决后即可由你人工合并。

@ranxianglei

Copy link
Copy Markdown
Owner Author

ci失败

awork added 4 commits October 20, 2026 11:12
An upstream overflow 400 that states the rejected payload's own counts
('you requested N tokens (M in the messages, K in the completion)') fed
only its WINDOW into the one-shot arm — and discarded M and K entirely.
The arm booked a ceiling as if it were a measurement, so preflight saw
'payload ~window, deficit 0' on an underestimating local meter and
forwarded a payload the upstream then billed over the wall (messages AND
completion against the same window), killing the turn.

- inspectContextOverflow now extracts requestedTotal/requestedMessages/
  requestedCompletion from provider-specific phrasings (OpenAI/DeepSeek
  messages+completion split; Anthropic 'prompt is too long'; Gemini
  'input token count') — a wrong guess is worse than no guess, so each
  pattern stays provider-specific.
- The arm books the measured MESSAGE count (a ceiling is not a size); the
  side-request guard keeps the CEILING via overflowArmTokens.
- The proven completion share is reserved off the wall for every
  payload-vs-wall judgment while the arm lives (the foldable quantity is
  MESSAGES); it retires with the arm on the next real usage report.
- One wall per request on the refold path: prepare/nudge and preflight
  judge on min(declared, upstream-stated) instead of two different walls.
- commitFold nets each fold out of the input baseline like the live path
  does, so an armed floor at-or-above the target descends and the loop
  can exit on fit instead of burning budget or stalling.
- One-time warning when the upstream-stated window differs from the
  window in use, naming both values (operator hint: modelContextLimit).

Behavior changes (disclosed): armed baseline is the upstream measurement
when stated (was: the stated window); preflight judges on window minus
the proven completion reservation while armed; lastInputTokens nets down
during preflight folds (was monotonic-increase within a run); new
persisted stat fields overflowArmCompletionReserve /
overflowArmMismatchWarned (legacy files: absent = legacy behavior).

Tests: parser cases incl. the verbatim incident body + regression guards;
hermetic e2e for honest-fail (uncloseable gap surfaces as 400, never a
masked over-forward) and in-request rescue (fold under the message
budget, reservation retires with the arm). issue1195 B updated to the
new arm value (measured 130000 vs ceiling 128000).
…3450 × #3738 merge regression)

Rebasing this branch over #3738 exposed a joint defect neither PR's own tests cover: handle.ts rewrites config.modelContextLimit IN PLACE with the output-headroom reservation before preflight runs (its [headroom] line says 'nudge/preflight judge input against reserved'), so subtracting the demonstrated completion share from that already-reserved value counts the completion share TWICE. On any session with an output-budget reservation whose overflow 400 states a completion count, the preflight wall collapsed toward zero (converge fixture: 40,000 - 60,000 -> 0) and the rescue folded nothing. Verified by the new case-3 convergence run failing on the naive merge and passing after this fix.

The reservation now applies MIN-wise to the upstream-stated wall: limit = min(reservedLimit, statedWindow - completionReserve) while armed, falling back to the untouched limit otherwise. The incident arithmetic (stated 1,048,576 / messages 841,304 / completion 256,000, reserved limit 792,576) yields exactly 792,576; the no-reservation path is byte-identical to before.

Test reconciliations in tests/fix-arm-headroom-clamp.test.ts (each with an inline rationale): case 1's guard now pins the stated CEILING (the side-request guard reserves each request's own output from that value itself, so feeding it the pre-reserved limit would double-subtract); case 2 pins lastInputTokens at the stated message count 841,304 (since #3450 the measurement is booked when present; the no-reservation clamp stays a no-op above it); case 3's guard pin likewise moves to the ceiling.
… case

Rebasing onto master surfaced an interaction this PR's own base predated:
#3739's case 3 (merged 2026-10-19, postdating this PR's base) pins the
PRE-#3450 refold behavior — fold against the bare stated window, retry
rejected again by the completion share, 400 surfaced until the next turn.
Since #3450 the same-request refold folds against window − proven
completion share, so the rejected request itself is rescued (client sees
the retry's 200) and the next turn converges on the stored folds. The
stronger behavior is the point of #3450; update the case to pin it:
turn 1 asserts the in-flight rescue + paired arm/reservation retirement
on the settled usage report, turn 2 keeps the no-loop convergence.
@ranxianglei
ranxianglei force-pushed the 2026-10-17_issue3450-upstream-stated-window branch from b3e38d0 to 5b91fb5 Compare October 20, 2026 03:48
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

CI 两个红门禁已定位并修复,分支已 rebase 到最新 master(838e9758a)并 force-push(b9e5ad733 → 5b91fb575),PR 恢复 mergeable。验证中还揪出本 PR 与 #3739 的一个行为交互,已一并对齐(见第 4 问与行为变更披露)。

1. 是什么问题:CI 红在两个静态门禁——unused-exports 与 docs-sync;都不是本 PR 的代码缺陷,是「基线滞后」产物。另有一个 rebase 后才暴露的测试交互(见下)。

2. 什么原因导致的:① unused-exports 报 log-mask.ts 的孤儿导出 maskUrlForPublish——本分支根本没碰这个文件,master 已在 #3870 把它改为模块私有,我分支的旧基线还带着旧版本;② docs-sync 报 CONFIGURATION.md(中英)里两行过期的重复 storage 表行(旧的 shadow 默认值行 + 缺 #3788 冷却措辞的行)——首次 rebase 的自动合并把当时 master 上已存在的重复行带进了分支,master 随后用文档再生成清理掉了。③ 验证时发现:#3739 的回归测试 case 3 在新基线上确定性失败(本分支 7/7 挂、纯 master 6/6 过)——该测试 10-19 才合入,晚于本 PR 基线(10-17),所以原 PR CI 绿时它还不存在;它钉的是 #3450 之前的行为(refold 按裸窗口折叠 → 重试仍被完成份额顶回墙上 → 400 透给客户),而 #3450 把 refold 目标改成 window−完成预留后,被拒的请求会在请求内直接获救。

3. 影响范围与严重程度:门禁两项无运行时影响。行为交互只影响「400 正文给出 M in the messages / K in the completion 计数、且折到 W−K 能装下」这一种场景:旧行为客户看到 400、下一轮再收敛;新行为请求内救回、客户拿到重试的 200。这是 #3450 的设计目标(可用性改善),不是退化;无计数的溢出正文行为不变(issue1195 B/C 用例钉住并通过)。

4. 怎么修复的:重新 rebase 到当前 master(零冲突,两处门禁修复随基线自动带入),本地镜像跑通两个门禁脚本(unused-exports clean / docs-sync clean);case 3 改写为钉新行为——turn 1 断言请求内救援(折叠摘要上线路径、尾部保留)+ usage 报告一次结算同时退役 arm 与预留(#3450 成对退役契约),turn 2 断言靠存储的折叠继续收敛不循环。独立标注 commit 5b91fb575(test: pin the #3450 in-flight refold rescue)。

5. 是否有回归问题:审过的既有行为:无计数溢出正文的 verbatim 透传/重试判决契约(issue1195 B/C)— 保持;#3738 clamp 不变量(case 1-2:基线 ≤ judging limit、guard 持天花板)— 保持且继续通过;arm 退役契约(#1110/#1129)— 扩展到预留字段,方向一致。typecheck 干净,定向 5 文件套件 46/46(单文件复跑 5 次稳定)。全量裁决交给 CI。

6. 是否破坏缓存:不涉及——未触碰缓存/重试/增量游标/去重键策略。

7. 是否改了设计方向:不涉及——冲突解决收尾 + 测试期望对齐,无转向。

8. 是否引入新配置:不涉及。

行为变更披露(old→new):含计数溢出 400 后的同请求 refold 目标:裸 stated window → min(声明窗口, stated window) − 完成预留;后果是部分原先会透给客户的 400 现在会在请求内救回为 200(#3450 意图;此前因 #3739 测试晚于本 PR 基线而未被任何测试覆盖)。此前已披露的两项(armed 基线额外钳制 ≤ judging limit;preflight armed wall 改 min 形式)不变。

判定:等本轮 CI 全量;绿了即可由你人工合并。

@ranxianglei
ranxianglei merged commit aba7062 into master Oct 20, 2026
48 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

📦 Merged Build Published

This merge to master was published as 0.0.638-master.aba7062 (rolling master tag).

npm install -g billion-context@0.0.638-master.aba7062  # this exact build
npm install -g billion-context@master  # always the newest merged build

npm view billion-context@master prints the current version at any time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment