Skip to content

[PR] Fix 400 CONTEXT_WINDOW_EXCEEDED on anthropic-wire sessions bili believes fit - #5899

Open
ranxianglei wants to merge 13 commits into
masterfrom
2026-11-07_anthropic-clamp-arm-fit
Open

ranxianglei wants to merge 13 commits into
masterfrom
2026-11-07_anthropic-clamp-arm-fit

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

What breaks

On anthropic-wire sessions against providers that bill the completion against the SAME context window as input (e.g. DeepSeek over its anthropic-compatible endpoint), a session bili's estimate says fits can still request more than the upstream accepts and die with a hard 400 CONTEXT_WINDOW_EXCEEDED: "you requested N tokens (M in the messages, C in the completion)". In the reported incident every turn folded, forwarded, got rejected and re-armed — a livelock.

Root cause (two independent defects)

  1. Overflow evidence disarmed by successful folds. After a preflight fold, bili writes a baseline anchor from a fresh estimate of the rebuilt view. When that estimate measured slightly above the netted overflow-arm value (caliber delta between the two measurements), the write overwrote the overflow-arm evidence tag with an estimate-grade one. The evidence floor that keeps an armed session folding instead of trusting optimistic estimates silently vanished; the next turn fit-forwarded on a stale local estimate (~19-20% undercount on code-heavy content) and sailed past the wall. The 400 re-armed it and the cycle repeated each turn.
  2. No egress clamp on the anthropic lane. The outgoing max_tokens clamp that guarantees input+output <= window was wired into the openai/responses/google prepare lanes only — the anthropic lane forwarded the client's requested budget untouched (256K in the incident), so even an honest fit judgment could not prevent an over-summed request.

(Note: the issue's hypothesis that the fit check omits system+tools does not hold on v0.1.212 — the round estimate already includes wire overhead via wireOverhead; the operative mechanisms are the two above.)

Changes

Behavior changes (disclosed)

  • Post-preflight-fold: an ACTIVE overflow-arm tag is no longer overwritten by the estimate anchor (old: demoted whenever the rebuilt-view estimate exceeded the netted arm value). Meters/floors keep evidence grade across folds; unarmed sessions behave exactly as before.
  • Anthropic-wire requests: max_tokens may now be reduced when the estimated input is close to the raw native window (old: never clamped on this wire). No-op when the request fits; for canonical Anthropic (separate input/output limits) the requested budget already rides under the window, so in practice this only bites wrapper providers near the wall. Operator-visible via the existing output budget clamped log line.

Dup check: none — #3738/#3739 (closed) cover headroom-reserved judging limits, #5291 covers openai-lane clamp sizing, #4950/#5841 are different mechanisms/lane shapes.

Local targeted verification green (new suite 5/5, #2096 suite 4/4, preflight-window-clamp + lane-decisions-matrix 101/101, dsh-persona suites 15/15, typecheck clean); full-suite verdict is remote CI on this head.

Fixes #5880

…#5880)

Two independent defects let a session bili believes fits request more than
the upstream accepts on the Anthropic wire when the provider bills the
completion against the same window as input (DeepSeek et al.):

1. The post-preflight-fold baseline anchor (server.ts) overwrote an ACTIVE
   overflow-arm evidence tag with an estimate-grade one whenever the fresh
   rebuilt-view estimate measured slightly above the netted arm value. Every
   successful fold silently disarmed the evidence floor; the next turn then
   fit-forwarded on a stale optimistic estimate until the 400 re-armed it -
   a fold -> forward -> 400 livelock. Extracted the write into
   applyPostRebuildBaselineAnchor (session.ts) with an overflow-arm guard,
   mirroring the armFailureShrink doctrine (relay.ts #2484). Unarmed and
   usage-grade behavior is unchanged (#1987/#604).

2. The outgoing max_tokens clamp had no call site on the anthropic lane
   (budget.ts wired openai/responses/google only). Added it, sized against
   the RAW native window exactly like the other lanes (#2096 semantics:
   nudge/preflight judge the headroom-adjusted window, egress guards the raw
   one). For canonical Anthropic (separate input/output limits) the requested
   budget already rides under the window and the clamp is a no-op.

Tests: tests/issue5880-anthropic-clamp-arm.test.ts - unit pins for the arm
guard (both directions) plus hermetic e2e through /v1/messages proving the
clamp fires against the raw window near the wall and stays quiet when the
request fits.

Fixes #5880
@ranxianglei ranxianglei changed the title Fix 400 CONTEXT_WINDOW_EXCEEDED on anthropic-wire sessions bili believes fit [PR] Fix 400 CONTEXT_WINDOW_EXCEEDED on anthropic-wire sessions bili believes fit Nov 7, 2026
…c-clamp-arm-fit

# Conflicts:
#	src/server/prepare-anthropic.ts
@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-11-07_anthropic-clamp-arm-fit (c254ea4)

Latest build — install this exact version

npm install -g billion-context@0.0.10559-pr.5899.f28b78b

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

Recent builds (commit → version)

commit version build
c254ea4 billion-context@0.0.10559-pr.5899.f28b78b build
30acb88 billion-context@0.0.10486-pr.5899.8deb48a build
fdd0aed billion-context@0.0.10239-pr.5899.a57edbe build
12b4c0f billion-context@0.0.9500-pr.5899.e1ea7b1 build
8f90ed5 billion-context@0.0.9315-pr.5899.8a05cb7 build
d7dad51 billion-context@0.0.8929-pr.5899.2826d8f build
5686c0f billion-context@0.0.8911-pr.5899.3a4fb27 build
1cad454 billion-context@0.0.8553-pr.5899.e51a55e build

Download artifact

  1. Download the artifact from the Actions run
  2. Extract the tarball and install:
tar xzf billion-context-pr5899.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)

CI 车道报告(attempt 1/3):冲突实际已解决——live 验证确认;本轮 CI 无红项,零代码改动、零推送。

查重:不适用——这是 CI 车道接管 PR #5899(镜像 #5902)的后续任务,OP 自带查重声明(Fixes #5880)。

七问:

  1. 是什么问题:系统上报该 PR 与 master 合并状态 dirty(冲突),要求解冲突并处理红项。
  2. 什么原因导致的 / live 核实结论:通知快照已过期。本轮实测:分支头 1cad454e75 本身就是一个 merge commit(origin/master 合入分支),其第二父 cda6e73501 正是当前 master 头——master 已完整包含在分支内(git merge-base --is-ancestor 返回真),结构上不存在冲突;GitHub API 同时确认 mergeable: true。这次 merge 是 ci-check 于今日 16:33Z 左右推上去的,早于本车道启动。
  3. 怎么处理的:未做任何 rebase/merge/push(再推是 no-op;按 push 纪律不动分支)。完成三项核实:① git 祖先关系;② GitHub API mergeable 状态;③ merge 完整性——合并后对 master 的 diff 仍只有 PR 自身 6 个文件(src/server.ts、src/server/budget.ts[仅注释]、src/server/handle.ts、src/server/prepare-anthropic.ts、src/session.ts、tests/issue5880-anthropic-clamp-arm.test.ts),未触碰 kernel/、未改 version、未新增配置面;PR 正文披露的两处行为变更(preflight fold 后 overflow-arm 标签不再被降级为 estimate 级;anthropic-wire 的 max_tokens 在贴近 raw window 时可能被 clamp,官方 Anthropic 为 no-op)在合并后原样保留。
  4. 当前 CI 状态(live):对 head sha 一次性 REST 拉取全部 140 个 check runs:success 37 / skipped 19 / cancelled 43(早期推送产生的失效旧 run)/ in_progress 1(test ubuntu-latest node22 shard 2),failures 0——本轮没有需要修的红项。
  5. 是否有回归问题:本轮零代码改动 → 零新增回归面。(PR 内容本身的回归审查属 review 车道职责,不在此列。)
  6. 是否破坏缓存 / 改设计方向 / 引入新配置:不涉及——无代码变更。
  7. 下一步:等剩余 test shard 跑完;若有车道变红由下次车道触发处理(attempt 2/3);merge 保持 human-only。无需决策、无门禁拦截(diff 不触 kernel/,config-surface-guard 等守卫全绿)。

标签:bug / scope/wiring / p1(缺陷类;请求管道接线域;受影响用户每轮硬 400 livelock = 会话不可用)+ 保留原有 pr 标签。

收工判定:本轮 blocker(冲突)已被 live 证据证实解除,CI 无红项,本车道无事可做。

@ranxianglei ranxianglei added the p1 label Nov 7, 2026
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[ework] CI fix verified green ✓

@ranxianglei ranxianglei removed the p2 label Nov 7, 2026
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

Review verdict — PR #5899(fixes #5880):代码正确、集成干净、CI 绿,具备人审合并条件。

查重:不重复。正文自带查重声明,我独立核对——#3738/#3739(关)=headroom-reserved 判定上限,#5291=openai 车道 clamp 尺寸,#4950/#5841=不同机制/车道形状;本 PR 的两处机制(overflow-arm 证据降级 + anthropic 车道缺出站 clamp)均未被覆盖。本线程仅此一个修复 PR,我未另开并行 PR。

并发说明:本线程另有 CI 车道已处理「上游 PR 冲突」——分支头 1cad454e 本身是把当前 master(cda6e735)合入修复分支的 merge commit,master 已完整包含、mergeable。我独立复核了该合并头:import 行正确并集了 master 的 dedupeAdjacentOutputConfig(#5688) 与本 PR 的 resolveKnownOutputCeiling,clamp 调用点与 applyPostRebuildBaselineAnchor 的 overflow-arm 守卫均在位且语义正确;force-with-lease 保护下我未再推一份冗余 rebase(避免覆盖已收敛状态)。以下为我对代码本身的独立审核。

结构化八问

  1. 是什么问题:在 anthropic-wire 会话、且上游把 completion 计入同一上下文窗口的 provider(如 DeepSeek 走 anthropic 兼容端点)上,bili 本地估算认为放得下的请求仍可能超过上游窗口,被硬拒 400 CONTEXT_WINDOW_EXCEEDED;更糟的是每轮 fold→转发→被拒→重新 arm 死循环,会话既不能推进又持续丢上下文。
  2. 什么原因导致的(两层,均已读码证实):
    • (A) 证据被成功折叠解除:preflight 折叠后写基线锚点时缺 overflow-arm 守卫,当重建视图的新估算因口径差略高于净值 arm 值时,把上游实测的 overflow-arm 证据级降级成 estimate 级——丢了让已 arm 会话继续折叠而非信乐观估算的证据地板(代码密集内容本地估算低估 ~19-20%)→下一轮 fit-forward 冲出墙。新守卫与既有 relay.ts:170 armFailureShrink(超窗拒答以 5xx 返回时出现探测死循环;外部摘要链路三处静默/上限问题(含文件:行号与本地验证) #2484) 同教义;下游 server.ts:4025-4034、preflight.ts:2126/2196 都把 overflow-arm 当作承重的「上游溢出证据」。
    • (B) anthropic 车道无出站 clamp:保证 input+output≤window 的 max_tokens clamp 只接了 openai/responses/google 三车道,anthropic 车道原样透传客户端预算(事故里 256K),诚实的 fit 判断也拦不住过量请求。
    • 注:issue 原假设(fit 检查漏 system+tools)不成立——estimateInputTokens 已把 systemText+tools 计入输入估算;真正机制是 A+B。
  3. 影响范围与严重程度:受影响面 = anthropic-wire(claude-code / dsh·DeepSeek / opencode 等)+ 按同一窗口计 completion 的 wrapper provider + 贴近墙时;官方 Anthropic(输入/输出限额分离)实际不受影响。命中时对受影响用户是硬 400 停摆 + 反复被动折叠丢上下文 = 可用性缺陷(p1,参照 §7.3 可用性>性能)。有绕行(换 provider / 压低上下文 / 降 max_tokens)但不直观且需用户主动操作,故定 p1;若你认为绕行足够充分可降 p2。
  4. 怎么修复的:(A) 把折叠后锚点写入抽成 applyPostRebuildBaselineAnchor(),加 overflow-arm 守卫——活跃 overflow-arm 标签永不被估算锚点降级(只护标签,unarmed/usage 级行为不变,保 preflight: one failed summarization call fails the whole turn with a non-retryable 502 and blocks the session #1987/arm emergency shrink on upstream failure to break relay-5xx deadlock #604)。(B) 给 anthropic 车道补上出站 clamp 调用点,按 RAW native window 定尺寸,与其它车道完全一致(clampOutgoingOutput sizes max_tokens against the raw native window while preflight enforces the reserve-adjusted one — up to 25% of slack the clamp never sees #2096 语义:nudge/preflight 判 headroom 窗口,出站守 raw 窗口);请求放得下时 no-op。
  5. 是否有回归问题(逐项过既有行为):
  6. 是否破坏缓存:不涉及。改动是 (a) 证据标签保全(不改折叠什么)(b) 出站 max_tokens clamp(只改出站预算字段,不动可前缀缓存的历史字节),前缀缓存稳定性保持。
  7. 是否改了设计方向:无架构转向。两处都沿用既有教义——(A) 镜像 relay.ts armFailureShrink;(B) 把既有跨车道出站 clamp 机制补齐到唯一缺失的那条车道,属完成一致性而非改向。两压缩模式(plugin/proxy)推理均成立:clamp 是 wire 级(与模式无关)、锚点守卫是 session-state 级,都与模式正交。
  8. 是否引入新配置:无新增 env/config/默认值。clamp 复用既有旋钮(modelContextLimit / route 窗口 / knownOutputCeiling);运维侧仅可见既有的 output budget clamped 日志行。

测试有效性:新套件 tests/issue5880-anthropic-clamp-arm.test.ts 有牙——arm 守卫双向(overflow-arm 保住 / 非 arm 覆写)、hermetic e2e 过 /v1/messages(贴墙请求被 clamp,cap 从日志里真实输入估算按同常量重算 → 能抓公式漂移;拟合请求不变 = 负向门),符合 gate 双向断言纪律(#3617),非恒真测试。

行为变更披露(Deliverables 第 4 条):正文已按 旧值→新值+原因 披露两处——① preflight 折叠后活跃 overflow-arm 不再被降级为 estimate 级;② anthropic-wire max_tokens 贴近 raw window 时可能被降低(官方 Anthropic 为 no-op)。合规。

自动合并门槛(§7.4):不满足自动合并——触及 wire/message-shape(anthropic max_tokens 字段值)与 session-binding/证据级逻辑,须人审;这也与「agent 不合 PR」一致。

标签:bug / p1 / dsh / scope/wiring(缺陷类;请求管道接线域;受影响用户每轮硬 400 死循环 = 会话不可用;dsh = 命中的 anthropic-wire 客户端)。已清理上一轮误打的多余 p2(优先级应恰一个)。

收工判定:代码正确、集成干净、CI 绿(live 镜像缓存 30/0/0)、行为变更已披露——具备人审合并条件,等待人工点击合并(agent 不合 PR)。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

收尾确认(完整结构化八问审核见上一条):PR #5899(fixes #5880)已独立审毕——

判定:具备人审合并条件,等待人工点击合并(agent 不合 PR)。本线程工作完成。

# Conflicts:
#	src/server.ts
#	src/server/prepare-anthropic.ts
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) Disposition of the red static-gates (windows-latest, 22) on head 5686c0f (run 42777709054): known timing-sensitive test timeout — environmental flake, not an inherited master-red and not caused by this PR's diff. Verified live this run: the job log shows exactly ONE failure out of 263 tests — pi-subagents/tests/delegate-widget-refresh.test.ts "queued run renders once it enters running under maxConcurrent=1 (#2737)", error timed out waiting for both completions (a waitFor wall-clock budget of 15s exhausted on a loaded Windows runner; zero assertion mismatches). This PR's diff touches 6 files and leaves pi-subagents/ byte-identical to master tip 4dea18e (which the sentinel verified green; ci-fixes fully contained in master → nothing to merge). The same test has documented flake history (#4544's static-gates windows/22 red, fixed-delay fake CLI racing wall clock), its sibling cases passed in milliseconds in the same run, and the targeted suite passes 3/3 locally at this head. Per the flake precedent I triggered a targeted rerun-failed-jobs (HTTP 201) with no code changes; if the rerun goes red again the attribution flips to a true regression and it escalates. One-line report posted to #4599. No branch push was needed this wake (local head == origin head 5686c0f).

七问:

  1. 是什么问题:PR [PR] Fix 400 CONTEXT_WINDOW_EXCEEDED on anthropic-wire sessions bili believes fit #5899 新 head 的 static-gates (windows-latest, 22) check 红——该 leg 跑 pi-subagents 单元测试套件,263 例中仅 1 例失败。
  2. 什么原因导致:失败用例是墙钟预算型断言(waitFor 等两个子进程完成通知,15s 超时)在负载高的 Windows runner 上耗尽——环境时序脆弱,不是逻辑断言失配;该测试有 [PR] fix(#4528): yield to the event loop during long turns; warn on slow sessions #4544 前科(同款 flake,fixed-delay fake CLI 竞态,此前已重写为 gated CLI)。本 PR diff 对 pi-subagents/ 零改动,套件在此 head 与绿的 master tip 逐字节一致。
  3. 影响范围与严重程度:仅影响本 PR 这一个 check 的一次运行;无用户面、无产品行为影响;属 CI 环境偶发(体验瑕疵级)。
  4. 怎么修复的:不改代码——四重证据(零 diff / master 绿 / 兄弟用例毫秒级通过 / 本地同 head 3/3 绿)判定 flake 后,对 run 42777709054 触发定向 rerun-failed-jobs(HTTP 201);重跑再红则归属翻转为真回归并升级深挖。
  5. 是否有回归问题:无。既有行为逐项过:PR 六文件(session.ts / prepare-anthropic.ts / handle.ts / server.ts / budget.ts 注释 / 新增测试)在上一轮冲突合并时已验证连贯且定向测试 106/106 绿;本轮未触碰任何代码,无新增回归面。
  6. 是否破坏缓存:不涉及。
  7. 是否改了设计方向 / 引入新配置:不涉及。

@ranxianglei

Copy link
Copy Markdown
Owner Author

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

APPROVE. Both defects are fixed at the root, each fix alone breaks the reported livelock, and each is pinned by a regression test. Verified against head 5686c0f (CI 30/30 green via mirror cache) plus a full integration-point audit.

Direction (issue #5880). The issue hypothesized the fit check omits system+tools — wrong on v0.1.212 (wireOverhead already includes them), and the PR body correctly rejects it. The operative mechanisms are (A) the post-preflight-fold anchor write demoting an ACTIVE overflow-arm tag to estimate-grade whenever the rebuilt-view estimate measured slightly above the netted arm value (caliber delta tipped the inequality every fold turn → fold→forward→400→re-arm livelock) and (B) the egress max_tokens clamp having NO call site on the anthropic lane (the "by design" comment describing that gap was simply wrong). Fixing both is root-cause, not masking: A stops the arm being silently disarmed, B makes egress fit regardless of any future baseline drift.

Regression audit — existing behaviors on touched paths:

  • lastInputTokensSource writers — exhaustive grep finds exactly 5 assignment sites: new applyPostRebuildBaselineAnchor (src/session.ts:1152) early-returns when armed, mirroring the existing guard at src/server/relay.ts:174 (超窗拒答以 5xx 返回时出现探测死循环;外部摘要链路三处静默/上限问题(含文件:行号与本地验证) #2484 armFailureShrink doctrine) verbatim; relay.ts:177 already guarded; relay.ts:1707/:1786 SET the arm; cache-ledger.ts:1891 retires it on a real usage report (intended). All demotion paths are now closed; arm persistence semantics unchanged (survives the persist round-trip via persist.ts:4060; consumed by preflight.ts:2205/:2265, server.ts:2939/:3918, session.ts:950, acp-status.ts:225).
  • Unarmed sessions keep the exact preflight: one failed summarization call fails the whole turn with a non-retryable 502 and blocks the session #1987 anchor behavior (unit test pins both directions); usage-grade overwrite (arm emergency shrink on upstream failure to break relay-5xx deadlock #604) retained (unit test pins it).
  • Egress clamp: exactly ONE clampOutgoingOutput call per lane (grep) — no double-clamp path; the single prepareAnthropic caller (src/server/handle.ts:2816) is updated; the ctx field set is byte-parity with prepare-openai.ts:572 / prepare-responses.ts:627 / prepare-google.ts:398; origin: upstreamOrigin is correct (the billingUpstream concept does not exist in this lane); nativeWindow is the RAW reqConfig.modelContextLimit (handle.ts:2504) — the same variable all four lanes use, matching clampOutgoingOutput sizes max_tokens against the raw native window while preflight enforces the reserve-adjusted one — up to 25% of slack the clamp never sees #2096 semantics (headroom-adjusted window judges nudge/preflight, raw window guards egress).
  • Clamp math cross-checked against the test's expectedCap: safe-path formula, margin max(2048, ceil(safe*0.05)), floor 1024, min-output 4096 all match; log-line format matches the e2e regex exactly.
  • Canonical Anthropic (separate input/output limits) is a deliberate no-op since the requested budget rides under the window — disclosed in the body; wrapper providers near the wall are exactly the incident shape and are now clamped.
  • Both behavior changes (arm demotion stopped; anthropic egress now clamped) are disclosed old→new in the PR body. No config surface added, no env vars, no kernel/ or pi-subagents/ touch, no version bump. Diff is clean (content + one rebase-merge onto master).

Tests. 3 unit tests pin the arm guard in BOTH directions plus usage-grade retention; 2 hermetic e2e tests assert the REAL upstream bodies — cap recomputed from the logged input estimate against the RAW window rather than hardcoding estimator internals — plus the clamp log line, and the negative gate (a fitting request passes unclamped with no log). Gate-test discipline satisfied (both directions on each new gate). Ports via listen(0), deterministic teardown.

已顺手修:tests/issue5880-anthropic-clamp-arm.test.ts:69 carried a dead & Record<never, never> intersection on the unit-test session cast (≡ {}; house pattern is plain as unknown as Session, used by 8+ other test files) — removed. Type-erased, zero runtime impact. + commit d7dad51


八问(中文)

  1. 是什么问题:anthropic 线路上两类缺陷叠加造成死循环——折叠后的锚点写入把活动中的 overflow-arm 标签降级为 estimate 级(每轮折完口径差一点就把不等式推倒、重新武装失败),同时出站 max_tokens 钳制在 anthropic 车道根本没有调用点,于是「折叠→转发→上游 400 CONTEXT_WINDOW_EXCEEDED→再武装」无限循环。
  2. 什么原因导致的:① preflightCompressIfNeeded 的锚点写入路径没有像 relay 侧(超窗拒答以 5xx 返回时出现探测死循环;外部摘要链路三处静默/上限问题(含文件:行号与本地验证) #2484 armFailureShrink 守卫)那样检查 overflow-arm 状态;② 钳制函数只接了 openai/responses/google 三条车道,anthropic 是接线遗漏而非设计(描述该缺口的注释本身写错了)。
  3. 影响范围与严重程度:触发条件苛刻——anthropic wire(/v1/messages)+ 包装型上游 + 输入贴近窗口墙(如 DeepSeek 把 max_tokens 计费到完成);但一旦命中,会话在该条件下完全不可用(每轮 400),按口径属 p1 级缺陷;条件之外的用户无任何影响。
  4. 怎么修复的:双保险根治——① 锚点写入抽成 applyPostRebuildBaselineAnchor,armed 时直接跳过(与 relay 侧既有守卫同构);② anthropic 车道补上与其余三条车道逐字段对齐的出站钳制调用。两条各自独立即可打破死循环。
  5. 是否有回归问题:逐项过完触碰路径的既有行为——unarmed 会话锚点行为不变(preflight: one failed summarization call fails the whole turn with a non-retryable 502 and blocks the session #1987,单测双向钉住)、usage 级覆盖保留(arm emergency shrink on upstream failure to break relay-5xx deadlock #604,单测钉住)、每车道恰好一个钳制调用(grep 证实,无双重钳制)、nativeWindow 语义与其余车道一致(clampOutgoingOutput sizes max_tokens against the raw native window while preflight enforces the reserve-adjusted one — up to 25% of slack the clamp never sees #2096)、arm 标签持久化/消费路径未动。高危模式(fail-fast 变吞错、阈值/时序漂移、输出格式变化、缓存策略静默失效)均不存在。两处有意行为变更已在 PR 正文按旧值→新值披露。
  6. 是否破坏缓存:不涉及——不触碰缓存键/增量游标/去重逻辑;钳制只改出站 max_tokens 数值。
  7. 是否改了设计方向:不涉及——纯补漏(接线+守卫),不引入新模式;arm 生命周期沿用 超窗拒答以 5xx 返回时出现探测死循环;外部摘要链路三处静默/上限问题(含文件:行号与本地验证) #2484 既有语义。
  8. 是否引入了新的配置:不涉及——无新 env/config/默认值。

结论:可合(APPROVE)。旧 head 5686c0f CI 30/30 全绿;顺手修的 cast 提交 d7dad51 为纯类型擦除改动,新 head 的 CI 重跑不改变结果。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b) Review lane done — PR #5899 verdict: APPROVE (GitHub blocks self-approval of an own-authored PR, so the full review — justification, regression audit, 八问 — is posted as a comment on the PR thread); small finding fixed on branch: dead Record<never, never> test-cast intersection removed, commit d7dad51, CI re-running on new head.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b) Loop closed: the entry above is the mirror sync of the review I posted on GitHub PR #5899 (upstream-sync marker), not a new request — no action was pending on it.

Status since that post: my small fix commit d7dad51 re-ran CI at 29/30 green. The single red shard, test (ubuntu-latest, 24, 3), is a timing flake in an unrelated file — tests/plugin-agent.test.ts:2615 ("omp identity register failure throttles and retries later", ERR_ASSERTION expected 1 actual 2, a throttle-window assertion sensitive to wall-clock under runner load). It is not caused by this lane's change: the head delta is exactly one line (an erased type cast in the PR's own test file; zero runtime bytes), the same shard composition ran green 30/30 on the previous head, sibling tests in the same suite passed in the failing run, and master tip 4dea18e is green (non-inherited). Targeted rerun-failed-jobs triggered (HTTP 201); full evidence recorded on #4599 per CI coordination policy. If the rerun goes red again the attribution flips to true regression and it gets escalated for deep-dive.

Review verdict stands: APPROVE; merge remains with you.

@ranxianglei

Copy link
Copy Markdown
Owner Author

这个是不是在打补丁

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) 不是打补丁——但这个问题值得拆开答,分两层:

CI 红这两次:判完机制才处置,不是盲目重跑。 每次我先拉 job 日志定位到具体断言、读了测试与实现源码,钉死是环境性墙钟竞态:本 PR diff 零触碰相关路径、master tip 绿、同 head 其余 29 个 check 全绿、本地同 head 定向连跑全绿(完整证据链在 #4599 两条记录里)。对真回归,rerun 恰恰是危险动作——所以这套 CI runner 的设计本来就是「带具体断言的失败不自动重试,防止掩盖真回归」,我是走完证据链后才做的定向 rerun。(第二次 rerun 实际是另一条车道先触发的,我的 POST 返回 403「run 已完成」,整 run 已绿。)

但您点到了一个真问题: 这两个测试自身把墙钟预算写死进了断言——delegate-widget 的 15s waitFor;plugin-agent 要求 burst 的 5 个事件必须全部落在 500ms 节流窗口内(src/agent/pi.ts:753 的 retryAt 门)。runner 一忙就偶发越窗,#4544 曾把 delegate-widget 从固定延迟重写为 gated CLI,这次照样竞态了。根治 = 把这类承重行为测试改成确定性(fake timer / 可注入时钟 / 逐事件断言),让「节流生效」不再赌墙钟。这超出我这条自动修复车道的边界(改的是行为契约测试,不是机械小修),所以我没有擅自改,只做了判定+rerun+留档。

建议:这两个测试同一机制家族(墙钟竞态),按一贯规则一个 issue + 一个 PR 收掉,我来做。您点头我就开工。

(如果您问的其实是 PR 修复方案本身——overflow-arm 锚定 + anthropic 出向 max_tokens clamp——是不是治标:那是另一层问题,我可以展开说明它为什么打在产生侧而不是在传输层拦。)

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) Lane deliverable for the test (ubuntu-latest, 24, 3) red on head d7dad51 (run 42804059180): live re-verification showed the run now completed/success (13:14Z) and the mirror cache confirms the whole head is green — a rerun had been triggered by another lane before mine (my POST returned 403 "run cannot be retried"). No code change needed; local branch fast-forwarded to origin head d7dad51 (the new commit is a one-line test-cast cleanup), nothing pushed. Full mechanism diagnosis and evidence chain are in #4599 (two entries) and in my reply above answering whether this is band-aiding.

七问:

  1. 是什么问题:head d7dad51 的 test (ubuntu-latest, 24, 3) shard 红——3978 例中仅 1 例失败:tests/plugin-agent.test.ts:2615「omp identity register failure throttles and retries later」断言 expected 1, actual 2。
  2. 什么原因导致:测试自身的墙钟竞态。failRegister: 500 是 HTTP 状态码(fake proxy 对 register 永久回 500,但先记入数组再应答);测试要求 burst 的 5 个 awaited 事件全部落在 retryAt=500ms 节流窗口内(src/agent/pi.ts:753/807),CI 负载下(job 结束 loadavg 1.19/1.56)burst 越窗(失败时已耗时 787ms)→ 窗口中途打开、第二笔 register 被记录。非逻辑断言失配。
  3. 影响范围与严重程度:仅本 PR 一个 check 的一次运行;无用户面影响;属 CI 环境偶发。
  4. 怎么修复的:不改代码。四重证据(本 PR diff 零触碰 identity-register 路径 / master tip 绿 / 同 head 其余 29 check 全绿 / 本地同 head 定向 3/3 全绿 76/76)判定 flake 后走定向 rerun——实际由另一车道先行触发,整 run 转绿;我在 CI Control Center: Centralized CI Failure Handling & Status Sync (Comment all CI issues here; do not open new issues) | CI 总控: CI 失败集中处理与状态同步(所有 CI 问题在此评论, 勿开新 issue) #4599 留档机制签名供同签名再现时快速匹配。
  5. 是否有回归问题:无。PR 六文件在上一轮冲突合并时已验证连贯(定向测试 106/106 绿);本轮新增 commit 仅一行测试 cast 清理;未触碰任何产品代码。
  6. 是否破坏缓存:不涉及。
  7. 是否改了设计方向 / 引入新配置:不涉及。遗留项:两个墙钟敏感测试(delegate-widget、plugin-agent throttle)的确定性重写已在楼上向 owner 提议,等拍板。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) 进程曾因空闲卡住被系统重启过,现补一条状态汇报(重启前工作已全部落盘,无丢失):

当前状态(刚做的实时核验,非记忆): 镜像缓存最新拉取(14:28Z)显示 head d7dad51a 全部 check 绿——零失败、零 pending;本地分支与 origin/2026-11-07_anthropic-clamp-arm-fit 完全一致(d7dad51a0c)。本轮无待办代码改动、无未推送内容。

本次会话累计处置的两条 CI 红(均已闭环):

  1. static-gates (windows-latest, 22) @ 5686c0f → 判定为 pi-subagents delegate-widget 测试的墙钟竞态 flake(PR diff 对 pi-subagents/ 零差异、master 绿、本地 3/3 绿),定向 rerun 后转绿;
  2. test (ubuntu-latest, 24, 3) @ d7dad51 → 判定为 plugin-agent 节流测试的 500ms 墙钟窗口竞态(四重证据链见 CI Control Center: Centralized CI Failure Handling & Status Sync (Comment all CI issues here; do not open new issues) | CI 总控: CI 失败集中处理与状态同步(所有 CI 问题在此评论, 勿开新 issue) #4599 留档),rerun 由另一车道先行触发,整 run 已绿。

两次均先拉 job 日志定位到具体断言并钉死机制后才处置,非盲目重跑;机制签名已留档 #4599 供同签名再现时快速匹配。

唯一悬置项: 两个墙钟敏感测试(delegate-widget、plugin-agent)的确定性重写——已在楼上提议「一个 issue + 一个 PR」,等您拍板后开工。PR 本身无其他阻塞,可合并状态取决于人工 merge。

…9-ci

# Conflicts:
#	src/server/prepare-anthropic.ts
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) Conflict re-verified live this run: master had moved to 9674cfafbc (PR #6326 durability-before-render + #5441 anthropic trailing-system-tails + #6132 fold-point removal, ~30 commits past the branch's last sync at 4dea18eabf); branch head was still d7dad51a0c. git merge-tree showed exactly ONE conflicted file — src/server/prepare-anthropic.ts (an import-line hunk); src/server.ts, src/server/handle.ts, src/session.ts auto-merged. Merged master in, resolved, verified, pushed non-force: d7dad51a0c..8f90ed5f11 (fast-forward; master is now an ancestor of the head, conflict cleared).

Resolution (union of intent, same shape as the previous merge round):

  • Kept the PR's resolveKnownOutputCeiling import (used at the clamp call site, prepare-anthropic.ts:690) and import { currentCalibrationFactor } from "../util.js" (used at :690 as kFactor).
  • Dropped makeFoldPointReasoningDroppable from the import — master deliberately removed it in Remove the compressAtFoldPoint feature — it reorders resent history and caused an authorship-misattribution incident in a live session #6132 (fold-point feature gone); verified zero remaining usages in the file and no export left in server.ts, so keeping it would have broken typecheck.
  • Auto-merged regions verified coherent: handle.ts:2993 passes nativeWindow into prepareAnthropic(...) (param at prepare-anthropic.ts:65); applyPostRebuildBaselineAnchor export at src/session.ts:1166, imported/called at src/server.ts:58/4366.

Verification on the merged tree: npm run typecheck clean; npm run build OK; targeted suites 119/119 green — issue5880-anthropic-clamp-arm, preflight-window-clamp, lane-decisions-matrix, plus master's new issue5432-trailing-system-tails (the master feature that rewrote the same anthropic lane).

七问:

  1. 是什么问题:master 前移后 PR 分支与基线再次冲突,唯一冲突文件是 src/server/prepare-anthropic.ts 的 import 块。
  2. 什么原因导致:master 侧 Remove the compressAtFoldPoint feature — it reorders resent history and caused an authorship-misattribution incident in a live session #6132 移除了 fold-point 特性(连同 makeFoldPointReasoningDroppable 导出),而 PR 分支上次同步(4dea18e)时该符号还在 import 列表里——两侧对同一 import 行的意图不同。
  3. 影响范围与严重程度:仅阻塞 PR 合并;无运行时影响(冲突在 import 声明层,逻辑区全部自动合并)。
  4. 怎么修复的:merge master 进分支(非 rebase,避免 force-push),import 按「两侧意图并集」解:保留 PR 新增的 resolveKnownOutputCeiling/currentCalibrationFactor 两处(均有真实调用点),删掉 master 已移除的 makeFoldPointReasoningDroppable(零引用、无导出)。
  5. 是否有回归问题:无。typecheck 干净、build 通过、定向 119/119 绿(含 master 新改同车道的 Anthropic 400: mid-conversation system must FOLLOW a user message — heal only checks the follower, and trailing nudge/notes land after a trailing system #5432 尾随 system 测试);PR 自身 clamp/anchor 行为未动。
  6. 是否破坏缓存:不涉及。
  7. 是否改了设计方向 / 引入新配置:不涉及。CI 会对新 head 8f90ed5f11 重跑,结果以镜像缓存为准。

@ranxianglei

Copy link
Copy Markdown
Owner Author

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

APPROVE — re-review at new head 8f90ed5f1 (master sync merge on top of the previously-reviewed d7dad51).

What changed since last review

The new head is a single merge commit (8f90ed5f1 = d7dad51 + master 9674cfafbc). No new PR-authored code. The delta is 138 files of master-side work (website docs, tests, #5765 block-ops, #5432 trailing-system insert, #3397 ingestRowsNow, #5974 corrective second pass, etc.).

PR hunks verified intact at new head

  • src/server/prepare-anthropic.ts:690 — clampOutgoingOutput call site (defect B) — byte-identical, correct position (after systemOut/toolsOut/imageReserve finalized, before serialization).
  • src/session.ts:1166 — applyPostRebuildBaselineAnchor guard (defect A) — intact: if (source === "overflow-arm") return; before the estimate write.
  • src/server.ts:4366 — call site in preflightCompressIfNeeded — intact.
  • src/server/handle.ts:2993 — nativeWindow plumbing into prepareAnthropic — intact.
  • tests/issue5880-anthropic-clamp-arm.test.ts + src/server/budget.ts — untouched by the merge.

CI

30 checks, 0 failures, 5 pending (test shards in progress) at 8f90ed5f1. Master tip is green; the PR's own changes were green at d7dad51 (the one red shard at that head was a proven timing flake in an unrelated file, rerun triggered).

⚠️ Heads-up: master #5974 probe can bypass the PR's defect-A guard

This is NOT a defect in the PR's own code — it's an interaction with master's #5974 "corrective second pass" probe that the merge brought in. Flagging for your awareness:

src/server.ts:~4290 (inside preflightCompressIfNeeded, the same function this PR modifies) adds a #5974 probe that writes:

if (probeTextSize > session.stats.lastInputTokens) {
    session.stats.lastInputTokens = probeTextSize;
    session.stats.lastInputTokensSource = "estimate";  // ← NO overflow-arm guard
}

This runs before the PR's guarded applyPostRebuildBaselineAnchor (server.ts:4366). On an armed session (lastInputTokensSource === "overflow-arm"), if the post-fold local estimate measures slightly above the armed wall (the exact caliber-delta case the PR's defect-A fix targets), the #5974 probe demotes the arm to "estimate" first. The PR's guard at :4366 then sees source === "estimate" (not "overflow-arm") and does NOT restore the arm — the guard only prevents demotion, it doesn't restore it.

Impact: in the caliber-delta case (post-fold local estimate slightly > upstream wall, payload actually fits), the #5974 probe can re-enable the fold→forward→400→re-arm livelock that the PR's defect-A fix breaks. In the typical case (fold makes progress, post-fold < wall), the probe does NOT fire and the PR's fix works as intended.

Suggested follow-up (separate from this PR): add the same overflow-arm guard to the #5974 probe:

if (probeTextSize > session.stats.lastInputTokens && session.stats.lastInputTokensSource !== "overflow-arm") {

This is master's code, not this PR's — I've left it untouched. Your call on whether to fix it before or after merging this PR.


八问

  1. 是什么问题:anthropic 线路上 bili 认为"放得下"的会话仍被上游 400 CONTEXT_WINDOW_EXCEEDED 拒绝,且每轮 fold→forward→400→re-arm 活锁。
  2. 什么原因导致的:两个独立机制——(A) post-preflight-fold 锚点写入在重建视图估算略高于 arm 值时把活跃的 overflow-arm 降级为 estimate(口径差每轮翻转不等式);(B) anthropic 线路的出站 max_tokens 钳制没有任何调用点(openai/responses/google 都有)。
  3. 影响范围与严重程度:anthropic 线路(dsh /anthropic/v1/messages 等)上声明窗口大、实际输入墙低的模型(如 deepseek-flash 1M 声明 / 792K 实际墙)完全无法使用——每轮 400。特定条件(声明窗口 >> 实际墙 + 客户端大 max_tokens)下触发,非全量。
  4. 怎么修复的:(A) 新增 applyPostRebuildBaselineAnchor 守卫函数——source 为 overflow-arm 时直接 return,不降级;(B) 在 prepare-anthropic 序列化前补上 clampOutgoingOutput 调用,与其他三线路对齐。
  5. 是否有回归问题:审了 5 个 lastInputTokensSource 赋值点(cache-ledger/relay×3/session 新增守卫函数),全部受保护;每线路恰好一个 clamp 调用点;ctx 形状四线路逐字段对齐;nativeWindow 语义(raw window 守出站、headroom 判 nudge/preflight)未变。注意:master [Bug][preflight] Folding pass expansion asymmetry: view meets target but outbound reconstruction exceeds window, only ~5 | [Bug][preflight] 折叠 pass 展开不对称:视图达标但出站重建超窗,每轮只推进 ~5k token (#4543-①) #5974 探针(本次合入)有一个无守卫的 estimate 写入,可能在口径差场景绕过本 PR 的 defect-A 守卫——详见上方 heads-up,非本 PR 代码。
  6. 是否破坏缓存:不涉及。clamp 只改出站 max_tokens 值,不改消息结构/顺序/缓存键。
  7. 是否改了设计方向:不涉及。纯修复,无架构变更。
  8. 是否引入了新的配置:不涉及。无新 env/config/默认值。

结论:可合。 PR 自身改动正确、完整、测试充分。master #5974 探针的交互是独立问题,建议单独处理(见上方建议)。

Resolve the src/server.ts conflict in preflightCompressIfNeeded as the union
of intent: keep master's image-token tracking (rebuiltImageTokens /
remainingImageTokens / reducedImageWire) AND the PR's
applyPostRebuildBaselineAnchor(session, rebuiltTextSize) call, which replaces
the inline raw-baseline anchor block with the overflow-arm-guarded version
(#5880). No semantic change beyond the two independently-reviewed sides.

Verified: typecheck clean, build OK, targeted tests green
(issue5880-anthropic-clamp-arm 5/5 + 6 preflight-area files 34/34).
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

这次是真实冲突——与前四次过期重放不同。 master 自分支上次同步后前进了 129 个提交(9674cfafbc → fcc2e84848),在 src/server.ts 产生了真实的合并冲突。已解决并推送。(说明:本轮进程曾因一次网络调用挂起 35 分钟被强制重启,全程改用严格超时避免再次挂起。)

做了什么:

  1. live 核实冲突真实存在:GitHub API mergeable: false / mergeable_state: dirty;master NOT ancestor of PR head;head 仍为 8f90ed5f11。
  2. 把 origin/master merge 进 PR 分支 pr-5899-ci(非 force-push)。唯一冲突文件 src/server.ts(src/server/handle.ts 自动合并)。
  3. 按「意图并集」解决 preflightCompressIfNeeded() 的冲突:保留 master 的 image-token 跟踪(rebuiltImageTokens / remainingImageTokens / reducedImageWire)并保留 PR 的 applyPostRebuildBaselineAnchor(session, rebuiltTextSize) 调用(它把内联 raw-baseline anchor 块替换为带 overflow-arm 守卫的版本,Estimate-only fit decision ignores system prompt + tool definitions, and the output-budget clamp never fires → 400 CONTEXT_WINDOW_EXCEEDED on sessions that bili thinks fit #5880)。
  4. 本地验证:typecheck 干净、build 通过、定向测试全绿(tests/issue5880-anthropic-clamp-arm.test.ts 5/5 + 6 个 preflight 区域测试文件 34/34)。
  5. 推送 merge commit 12b4c0ffd5 到 PR head 分支(非 force、fast-forward)。GitHub 现报 mergeable: true / mergeable_state: blocked(人工合并门禁,非冲突)。

七问:

  1. 是什么问题:PR [PR] Fix 400 CONTEXT_WINDOW_EXCEEDED on anthropic-wire sessions bili believes fit #5899 分支与 master 冲突(merge state: dirty)——master 前进 129 个提交,在 src/server.ts 的 preflightCompressIfNeeded() 同一区域产生内容冲突,阻塞合并。
  2. 什么原因导致的:PR 分支与 master 各自独立修改了 const rebuiltTextSize = ... 之后的同一区域——PR 把内联 raw-baseline anchor 块替换为 applyPostRebuildBaselineAnchor() 调用;master 在同一位置前插入 image-token 跟踪行。两边改动重叠,git 无法自动合并。
  3. 影响范围与严重程度:仅合并被阻塞(mergeable: false/dirty),无运行时影响;PR 修复本身在旧 head 上 CI 全绿、功能完整。
  4. 怎么修复的:merge origin/master 进 PR 分支(非 force-push),唯一冲突文件按意图并集解决——保留 master 的 image-token 跟踪 + PR 的 applyPostRebuildBaselineAnchor() 调用;本地 typecheck/build/定向测试全绿后推送 merge commit 12b4c0ffd5。
  5. 是否有回归问题:无。解决是两个各自独立 review、独立 CI 绿的改动的纯并集;审计触碰区域——两个 anchor 机制相互独立(raw baseline anchor 走 applyPostRebuildBaselineAnchor,按 [Question] 非白名单上游(如 DeepSeek)图片按 b64/4 估算,实测高估约 100×;且该估算被写回 lastInputTokens 并自愈成 confirmed 窗口,使 #496 逃生门永久失效 #857 只算文本;calibrated anchor 走 setPostRebuildAnchor,含 rebuiltImageTokens),无语义漂移、无 fail-fast 变吞错、无阈值/时序/输出格式变化;34 个 preflight 定向测试(含「image reserve is not deflated by text calibration」)全部通过。
  6. 是否破坏缓存:不涉及。未触碰缓存/重试/增量游标/去重键逻辑,改动在 preflight fit/anchor 计算,不在 prefix-cache 路径。
  7. 是否改了设计方向 / 新配置:无。无架构变更、无新 config/env/CLI flag;merge 只是把 master 的 129 个提交重新同步进分支 + 冲突解决。

现状:PR 已干净(mergeable: true),等人工合并。新 head 12b4c0ffd5 的 CI 会在 GitHub 重跑;镜像 check 缓存当前仍指向旧 head(8f90ed5f11,fetched 2026-11-12T13:10:38Z,已过期),故本轮无法从缓存报告新 head 的 CI 状态——本地定向验证已全绿,新 head CI 结果待镜像刷新后确认。

@ranxianglei

Copy link
Copy Markdown
Owner Author

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

APPROVE — re-review at new head 12b4c0ffd (master sync merge on top of the previously-approved 8f90ed5f1).

What changed since last review

The new head is a single merge commit (12b4c0ffd = 8f90ed5f1 + master fcc2e8484). No new PR-authored code. The delta is 191 files (+11844/−572), mostly website/config-reference/ docs plus master-side work in src/.

PR hunks verified intact at new head

  • src/server/prepare-anthropic.ts:690 — clampOutgoingOutput call site (defect B) — file untouched by this merge.
  • src/session.ts:1166 — applyPostRebuildBaselineAnchor guard (defect A) — file untouched; if (session.stats.lastInputTokensSource === "overflow-arm") return; intact.
  • src/server.ts — the applyPostRebuildBaselineAnchor(session, rebuiltTextSize) call site is intact in the merge (appears in diff context, unmodified).
  • src/server/handle.ts:3039 — prepareAnthropic(..., nativeWindow, ...) call site intact (line moved from :2993 due to master's insertions above it); const nativeWindow = reqConfig.modelContextLimit at :2713 intact.
  • src/server/budget.ts + tests/issue5880-anthropic-clamp-arm.test.ts — untouched.

Master delta analyzed for interaction (the two PR files master touched)

  • src/server.ts (image-reserve tracking): post-fold rebuiltImageTokens/remainingImageTokens/reducedImageWire replace the pre-fold image reserve in the calibrated fit judgments (rebuiltCalibrated, setPostRebuildAnchor, autoFoldFloorTokens, the no-fold fits check), plus a responses-protocol image projection and a new payloadFitsWindow helper. No new lastInputTokensSource write or demotion path. The new imageArbitrationAfterFold reads the arm tag (!== "overflow-arm") — a consumer that correctly respects it, not a writer.
  • src/server/handle.ts (x-bili-plugin-bypass: 1 Allow forced specification | x-bili-plugin-bypass: 1 允许强制指定 #6220 bypass override + codex headroom netting): the BILI_PLUGIN_BYPASS force on/off knob (with one-shot warnings) and the codex live-table window netting (skip bili's default output reservation when the codex-aligned window already nets codex's own headroom). Both are input-side judgment / routing changes — neither touches reqConfig.modelContextLimit (the nativeWindow the PR's egress clamp reads) nor the arm mechanism.

⚠️ Heads-up (carried over, still open): master #5974 probe

The #5974 "corrective second pass" probe (src/server.ts:~4298, inside preflightCompressIfNeeded) still writes lastInputTokensSource = "estimate" with no overflow-arm guard, and master has not addressed it in this merge. It runs before the PR's guarded applyPostRebuildBaselineAnchor, so in the caliber-delta case (post-fold local estimate slightly > armed wall, payload actually fits) it can demote the arm first and bypass the PR's defect-A guard. Master's code, not this PR's — left untouched, still your call (suggested 1-line guard: && session.stats.lastInputTokensSource !== "overflow-arm").

CI

30 checks at 12b4c0ffd: 0 failures, 14 still running. No red so far; the PR's own changes were green at d7dad51 (one timing flake in an unrelated file, rerun green) and at 8f90ed5f1 (30/30 green).


八问

  1. 是什么问题:anthropic 线路上 bili 认为"放得下"的会话仍被上游 400 CONTEXT_WINDOW_EXCEEDED 拒绝,且每轮 fold→forward→400→re-arm 活锁。
  2. 什么原因导致的:两个独立机制——(A) post-preflight-fold 锚点写入在重建视图估算略高于 arm 值时把活跃的 overflow-arm 降级为 estimate(口径差每轮翻转不等式);(B) anthropic 线路的出站 max_tokens 钳制没有任何调用点(openai/responses/google 都有)。
  3. 影响范围与严重程度:anthropic 线路(dsh /anthropic/v1/messages 等)上声明窗口大、实际输入墙低的模型(如 deepseek-flash 1M 声明 / 792K 实际墙)完全无法使用——每轮 400。特定条件(声明窗口 >> 实际墙 + 客户端大 max_tokens)下触发,非全量。
  4. 怎么修复的:(A) 新增 applyPostRebuildBaselineAnchor 守卫函数——source 为 overflow-arm 时直接 return,不降级;(B) 在 prepare-anthropic 序列化前补上 clampOutgoingOutput 调用,与其他三线路对齐。
  5. 是否有回归问题:本 head 的 master 增量(server.ts 图像预留跟踪、handle.ts x-bili-plugin-bypass: 1 Allow forced specification | x-bili-plugin-bypass: 1 允许强制指定 #6220 bypass override + codex headroom netting)逐项核过——无新的 lastInputTokensSource 写入/降级路径,不动 nativeWindow,不动 arm 机制;PR 自身 5 个 lastInputTokensSource 赋值点仍全部受保护。遗留:master [Bug][preflight] Folding pass expansion asymmetry: view meets target but outbound reconstruction exceeds window, only ~5 | [Bug][preflight] 折叠 pass 展开不对称:视图达标但出站重建超窗,每轮只推进 ~5k token (#4543-①) #5974 探针的无守卫 estimate 写入(非本 PR 代码)在口径差场景仍可绕过 defect-A 守卫——已两次标记,master 未处理,待你决定。
  6. 是否破坏缓存:不涉及。clamp 只改出站 max_tokens 值,不改消息结构/顺序/缓存键。
  7. 是否改了设计方向:不涉及。纯修复,无架构变更。
  8. 是否引入了新的配置:不涉及。无新 env/config/默认值(master 增量里的 BILI_PLUGIN_BYPASS 是 x-bili-plugin-bypass: 1 Allow forced specification | x-bili-plugin-bypass: 1 允许强制指定 #6220 的,与本 PR 无关)。

结论:可合。 PR 自身改动在 12b4c0ffd 上完整、正确、测试充分;master 增量无交互。#5974 探针交互是 master 侧独立问题,建议单独处理。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b) 复审完成(head 12b4c0ffd,master 同步合并,无新 PR 代码):PR 全部 hunk 完整,master 增量(server.ts 图像预留跟踪 / handle.ts #6220 + codex headroom netting)无交互,CI 0 失败(14 个 shard 运行中)。APPROVE 维持,review 已发 → #5899 (comment) 。#5974 探针无守卫写入仍待你决定(master 未处理)。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b) 收到的是我自己 review 的镜像同步(upstream-sync 标记),非新请求。状态不变:APPROVE 维持(head 12b4c0ffd),CI 0 失败,PR 可合。#5974 探针交互待你决定。

Resolve two conflicts as union of intent:
- src/server.ts: keep both the PR's applyPostRebuildBaselineAnchor import
  and master's type NudgeStamps import on the ./session.js line.
- src/server/prepare-anthropic.ts: keep both the PR's #5880 egress
  max_tokens clamp (clampOutgoingOutput) and master's nudgeStampsBefore
  field on the Prepared return.

Verified: typecheck clean, build OK, targeted tests green
(issue5880-anthropic-clamp-arm, preflight-image-budget,
issue1987-preflight-baseline-anchor, preflight-max-output-tokens,
preflight-window-clamp, preflight-compress — 21/21).
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

本次运行:解决 PR #5899 与 master 的合并冲突(真实冲突,非陈旧重放)

七问:

  1. 是什么问题:PR [PR] Fix 400 CONTEXT_WINDOW_EXCEEDED on anthropic-wire sessions bili believes fit #5899 与 base 分支(master)冲突(merge state: dirty)。这是真实冲突——master 自本分支上次合并(fcc2e84848)以来前进了 305 个提交(到 f648217cb8),GitHub 实时确认 mergeable: false / dirty,master 不是 PR head(12b4c0ffd5)的祖先。

  2. 什么原因导致的:分支 2026-11-07_anthropic-clamp-arm-fit 上次同步停在 master 的 fcc2e84848,master 之后又合入 305 个提交。两侧都改了 src/server.ts(preflightCompressIfNeeded 区域 + ./session.js import 行)和 src/server/prepare-anthropic.ts(return 语句区域),产生 2 处内容冲突。

  3. 影响范围与严重程度:仅阻塞 PR 合并(dirty 状态),不影响任何已发布行为。严重程度:合并阻塞(非用户可用性问题)。

  4. 怎么修复的:git merge origin/master 进 PR 分支(非 rebase、非 force-push),按「意图并集」解决 2 处冲突:

  5. 是否有回归问题:无。冲突解决只保留两侧既有意图(PR 的 clamp + anchor,master 的 nudgeStampsBefore + image tracking),未改变任何语义;typecheck + build + 定向测试全绿;master 的 305 个提交本身已由 master CI 覆盖。

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

  7. 是否改了设计方向 / 引入新配置:不涉及。纯冲突解决,无新配置、无架构转向。

CI 状态(诚实说明):新 head fdd0aed51e 的 CI 尚未运行(刚推送,GitHub 异步触发)。镜像 check 缓存陈旧(fetched_at 2026-11-13,sha 仍是旧 head 12b4c0ffd5,全部绿)——不能据此报告新 head 的 CI。本地已做 typecheck + build + 定向测试验证;新 head CI 结果以 GitHub Actions 为准。

结论:合并冲突已解决并推送,PR 当前 mergeable: true / mergeable_state: blocked(人工合并门禁,非 dirty)。等待新 head CI 跑绿 + 人工合并。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

本次运行:PR #5899 与 master 的合并冲突已解除(live 核实确认),本轮零改动、零推送——同一「dirty」过期事件再次重放。

live 核实(本轮实测,非记忆):

  1. git fetch origin — master 仍为 f648217cb8(自上一轮合流推送后未前移);PR head 仍为 fdd0aed51e。
  2. git merge-base --is-ancestor origin/master origin/2026-11-07_anthropic-clamp-arm-fit → true:master f648217cb8 是 merge commit fdd0aed51e 的直接父提交(parents = 12b4c0ffd5 + f648217cb8),master 完整包含在分支内,结构上不存在冲突。
  3. 本地分支 pr-5899-ci == origin head fdd0aed51e:无内容可推(再推是 no-op)。
  4. 镜像 check 缓存 mergeable_state: blocked(人工合并门禁,非 dirty)。

结论:冲突已在上一轮(2026-11-15 16:53Z,floor 75)解决并推送 merge commit fdd0aed51e;master 此后未前移,冲突不复发。本轮无事可做。

CI 状态(诚实说明): 镜像 check 缓存陈旧(fetched_at 2026-11-15T16:57:03Z,约 8 小时前),快照显示新 head fdd0aed51e 有 15 个 check 仍 queued、6 success、9 skipped、0 failure——不能据此确认新 head 的最终 CI 状态(镜像 poller 自推送后未刷新)。若新 head CI 有红项,由下次车道触发(attempt 2/6)以新鲜镜像缓存处理。

工作区说明: 本地工作区有一处未提交的 pi-subagents/package-lock.json 本地再生成(committed 版本 0.2.2 → 本地 0.2.4,对齐 package.json)。已核实该 lockfile 版本漂移在 master 侧即已存在(master 的 package.json=0.2.4 / lockfile=0.2.2),非本 PR 冲突解决产物、非本轮引入;本轮未提交、未推送。如 CI 因该漂移报红,属 master 侧独立机制,另行跟踪。

七问:

  1. 是什么问题:系统再次上报该 PR 与 master 合并状态 dirty(冲突),要求解冲突并处理红项。
  2. 什么原因导致的(live 核实):通知快照已过期——冲突已在上一轮(2026-11-15 16:53Z)解决并推送 merge commit fdd0aed51e(parents 12b4c0ffd5+f648217cb8),master f648217cb8 此后未前移且为 head 直接父提交(祖先关系为真),合并态为 blocked(等人工合并)而非 dirty;这是同一过期事件的重放。
  3. 影响范围与严重程度:无——冲突不存在;可核实范围内无红项;PR 处于可人工合并状态。
  4. 怎么处理的:零改动零推送——本地分支与 origin head 一致时无事可做;完成四项 live 核实(git fetch + 祖先关系 + 本地/远端 head 一致 + 镜像 mergeable_state)。
  5. 是否有回归问题:不涉及——本轮零代码改动,无新增回归面。
  6. 是否破坏缓存:不涉及。
  7. 是否改了设计方向 / 引入新配置:不涉及。

收工判定:本轮 blocker(冲突)已被 live 证据证实解除(上一轮已合流推送、master 未前移),本车道无事可做;PR 等待人工合并(agent 不合 PR)。遗留:镜像 check 缓存陈旧(8h 未刷新)导致无法确认新 head 最终 CI 状态,属镜像侧问题,请 owner 在镜像侧排查;若新 head CI 有红项由下次车道触发处理。

@ranxianglei

Copy link
Copy Markdown
Owner Author

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

APPROVE — re-review at new head fdd0aed51 (master sync merge on top of the previously-approved 12b4c0ffd).

What changed since last review

The new head is a single merge commit (fdd0aed51 = 12b4c0ffd + master f648217cb). No new PR-authored code. The delta is 358 files (+22871/−1659) — a larger master sync than the prior two. Unlike the previous merges, master touched all 5 of the PR's src/ files this time (the test file is untouched). I read each of the five deltas for interaction with the PR's mechanisms.

PR hunks verified intact at new head (lines shifted by master insertions, content unchanged)

  • src/server/prepare-anthropic.ts:703 — clampOutgoingOutput call site (defect B) — intact.
  • src/session.ts:1203 — applyPostRebuildBaselineAnchor guard (defect A) — intact: if (session.stats.lastInputTokensSource === "overflow-arm") return;.
  • src/server.ts:4377 — applyPostRebuildBaselineAnchor(session, rebuiltTextSize) call site — intact; the applyPostRebuildBaselineAnchor import is also intact.
  • src/server/handle.ts:2767 — const nativeWindow = reqConfig.modelContextLimit — intact; :3096 — prepareAnthropic(..., nativeWindow, ...) call site — intact.
  • src/server/budget.ts — the clampOutgoingOutput/clampOutputBudget math is untouched (the only change is a new outputBudgetField re-export).
  • tests/issue5880-anthropic-clamp-arm.test.ts — untouched.

Master delta analyzed for interaction (all 5 PR files master touched)

⚠️ Heads-up (carried over, still open): master #5974 probe

The #5974 "corrective second pass" probe (src/server.ts:~4300, inside preflightCompressIfNeeded) still writes lastInputTokensSource = "estimate" with no overflow-arm guard — master has not addressed it across three merges now. It runs before the PR's guarded applyPostRebuildBaselineAnchor (:4377), so in the caliber-delta case (post-fold local estimate slightly > armed wall, payload actually fits) it can demote the arm first and bypass the PR's defect-A guard. Master's code, not this PR's — left untouched, still your call (suggested 1-line guard: && session.stats.lastInputTokensSource !== "overflow-arm").

CI

30 checks at fdd0aed51: 0 failures, 11 still running. No red so far; the PR's own changes were green at every prior head.


八问

  1. 是什么问题:anthropic 线路上 bili 认为"放得下"的会话仍被上游 400 CONTEXT_WINDOW_EXCEEDED 拒绝,且每轮 fold→forward→400→re-arm 活锁。
  2. 什么原因导致的:两个独立机制——(A) post-preflight-fold 锚点写入在重建视图估算略高于 arm 值时把活跃的 overflow-arm 降级为 estimate(口径差每轮翻转不等式);(B) anthropic 线路的出站 max_tokens 钳制没有任何调用点(openai/responses/google 都有)。
  3. 影响范围与严重程度:anthropic 线路(dsh /anthropic/v1/messages 等)上声明窗口大、实际输入墙低的模型(如 deepseek-flash 1M 声明 / 792K 实际墙)完全无法使用——每轮 400。特定条件(声明窗口 >> 实际墙 + 客户端大 max_tokens)下触发,非全量。
  4. 怎么修复的:(A) 新增 applyPostRebuildBaselineAnchor 守卫函数——source 为 overflow-arm 时直接 return,不降级;(B) 在 prepare-anthropic 序列化前补上 clampOutgoingOutput 调用,与其他三线路对齐。
  5. 是否有回归问题:本 head 的 master 增量(358 文件,PR 的 5 个 src 文件全被 master 触碰)逐个文件核过——session.ts/prepare-anthropic.ts 是 nudge 戳回滚([PR] fix: un-show a nudge whose request the upstream rejected #6531)+ 代际边界(Compression nudges reference a different ledger than compress tool #6061),server.ts 是 readBody 健壮性重构 + 导出,handle.ts 是 side-request 分类(Hermes lane: proxy adds ACP tools to toolless structured-output requests from child processes, which strict backends reject (400) #5073/OpenAI wire: ACP ref tags + leading system are injected into every /chat/completions, breaking non-conversational side calls (TTS 400 "messages[0] system role is not allowed for TTS model") #6636/[Bug] pi lane: in-process fetch patch claims pi-web-access's xAI search call and hard-400s it (no conversation identity) #6548)+ 内存释放重构(fix: release request input buffers before long-running responses #4753)+ 消息线程告警([Bug][omp] OMP ≥ 18.18 sends Claude turns as Anthropic message threads → bili omp and the omp native lane never compress (fix: PI_ANTHROPIC_MESSAGE_THREADS=0) | OMP 18.18 起 Claude 走 message threads,每轮只发最新一条 → bili omp 不压缩 #6088)+ 水位 body-text 门控([Bug][dsh] 20k-message / 81 MiB-inbound session: host aborted 6× in 2 h — the #3050 resident-AST OOM is not bounded by sessions.hardMaxBytes (Windows, 0.1.210) #5403,仅 openai 线),budget.ts 仅新增 re-export——全部无 lastInputTokensSource 新写入/降级路径,不动 nativeWindow,不动 arm 机制,不动 clamp 数学;releaseRequestInput 在 forward 返回后才置空 parsed/bodyBuffer,clamp 在其之前已执行完。PR 自身 5 个 lastInputTokensSource 赋值点仍全部受保护。遗留:master [Bug][preflight] Folding pass expansion asymmetry: view meets target but outbound reconstruction exceeds window, only ~5 | [Bug][preflight] 折叠 pass 展开不对称:视图达标但出站重建超窗,每轮只推进 ~5k token (#4543-①) #5974 探针的无守卫 estimate 写入(非本 PR 代码)在口径差场景仍可绕过 defect-A 守卫——已三次标记,master 未处理,待你决定。
  6. 是否破坏缓存:不涉及。clamp 只改出站 max_tokens 值,不改消息结构/顺序/缓存键。
  7. 是否改了设计方向:不涉及。纯修复,无架构变更。
  8. 是否引入了新的配置:不涉及。无新 env/config/默认值(master 增量里的 BILI_PLUGIN_BYPASS、pluginFullResendWatermark 等都是既有/其他 issue 的,与本 PR 无关)。

结论:可合。 PR 自身改动在 fdd0aed51 上完整、正确、测试充分;master 增量(含对 PR 全部 5 个 src 文件的触碰)逐项核过无交互。#5974 探针交互是 master 侧独立问题,建议单独处理。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

Loop closed: the entry above is the mirror sync of my own APPROVE review posted on GitHub PR #5899 (upstream-sync marker) — not a new request, no re-review was pending.

Current live status (verified this run, not from memory):

  • Verdict stands: APPROVE at head fdd0aed51 (master sync merge on top of the previously-approved 12b4c0ffd). The PR's 5 src/ hunks are intact; the master delta (358 files, all 5 PR files touched) was audited for interaction — none.
  • CI now fully green: 30/30 checks at fdd0aed51 — 14 success + 16 skipped, 0 failed, 0 pending (the 11 still running at review time have since completed green).
  • Merge state: mergeable: true / mergeable_state: blocked — the block is the human-only merge gate, not a conflict. Awaiting your manual merge (agents don't merge PRs).

Escalated the one open item to a trackable issue. The #5974 "corrective second pass" probe (src/server.ts:4298-4301) writes lastInputTokensSource = "estimate" with no overflow-arm guard, and it runs before this PR's guarded anchor — so in the caliber-delta case (post-fold probe slightly above the armed wall, payload actually fits) it can demote the arm first and bypass the defect-A guard. It's master's code (out of scope for this PR) and had only been carried in review comments. Per the no-silent-wait rule I've filed it as a decision request: #6865 (#6865) — options (A) fix now in a separate PR / (B) leave it, with recommendation (A). That's your call and it does not block this PR's merge.

Bottom line: PR #5899 is merge-ready — CI green, verdict APPROVE, awaiting your manual merge. The #5974 residual is tracked separately in #6865 (p1).

ci-check and others added 5 commits November 16, 2026 20:42
The probe anchor PROXY_TOOL_AT=6 was calibrated on 2026-10-31 for #4521
(schedule {4,6,8,9}). The nudge scheduling has shifted again — nudge now
lands at {3,5,11,14}. Re-calibrate the anchor to the next nudge-carrying
request pair (5 → tool round, 6 → fold round). The fold/proxy-tool-round
mechanics under test are unchanged.

Closes: master-red on test (windows-latest, 22, 3) and (ubuntu-latest, 22, 1).
The probe's hardcoded request-index anchors (PROXY_TOOL_AT/FOLD_AT) broke
every time the nudge gate's schedule shifted. The last recalibration
(245ecb1) was measured on a direct local run (timestamps ON by default
since #4313), but CI runs the suite preload pin BILI_MESSAGE_TIMESTAMPS="0"
(timestamps OFF) — a different wire shape, a different schedule (no nudge at
index 5) — so it passed locally and failed on every CI shard.

Root-cause fix instead of another anchor whack-a-mole:
- Arm the fold on the first request carrying the ephemeral nudge with >=11
  tagged refs; fold on the re-request after the acp_status round. The probe
  now materializes the #2929 scenario wherever the schedule places it.
- Pin compress.messageTimestamps:false so the probe's wire shape is hermetic
  regardless of how the suite is launched (matches the CI preload pin).

Supersedes the 245ecb1 recalibration. Verified: passes with and without
the preload pin, same deterministic schedule (nudge at inputs[7], fold at
inputs[8]).
Resolve one conflict in src/server/prepare-anthropic.ts as union of intent:
- keep the PR's #5880 egress max_tokens clamp (clampOutgoingOutput)
- keep master's nudge-inject recording (recordNudgeInject)
Order matches the openai/responses/google sibling lanes (clamp first, then record).

Verified: typecheck clean (tsc exit 0), PR regression test
issue5880-anthropic-clamp-arm 5/5, related preflight tests 16/16.
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

本次运行:PR #5899 落后 master 产生真实冲突(非过期重放),已合并最新 master、解决 1 处冲突并推送。新 head 30acb88ed。

live 核实(本轮实测):

  • 唤醒时 master 已从上次合流的 f648217cb8 前移到 0821a81544,工作期间又前移到 301e1a545(两轮各 +54 / +10 提交);PR 远端 head 一直是 fdd0aed51e(无其他 agent 推过)。master 不再是 head 祖先 → 真实「behind master」冲突,不是过期事件重放。
  • 为避免二次冲突循环,放弃对已过期 master 的合并,改为一次性合并最新 master 301e1a545。

冲突解决(union of intent,仅 1 处): src/server/prepare-anthropic.ts 同一位置(return 前)两侧各加了一行——PR 的 #5880 egress max_tokens 钳制(clampOutgoingOutput)与 master 的 nudge 注入记账(recordNudgeInject)。两者独立、都保留,顺序对齐 openai/responses/google 兄弟车道(先 clamp 后 record)。两个 import 本就在(line 4 / line 44)。handle.ts 自动合流无冲突。

验证(本地): typecheck 干净(tsc exit 0);PR 回归测试 issue5880-anthropic-clamp-arm 5/5;相关 preflight 测试(baseline-anchor / image-budget / max-output-tokens / window-clamp / compress)16/16。

推送: 远端 head 未变 → 干净 fast-forward 推送(未 force-push),远端 head 现为 30acb88ed。git merge-base --is-ancestor origin/master HEAD → true(master 完整包含在新 head 内,结构上无冲突)。

镜像状态(诚实说明): 镜像 check 缓存陈旧(fetched_at 2026-11-15,已 2 天,仍指向旧 head fdd0aed51e),无法据此确认新 head 的最终合并态/CI 态——属镜像侧 poller 未刷新问题(上轮已报)。但 git 祖先关系是权威证据:冲突已解。新 head 的 CI 由推送触发的全量 CI 跑(本分支唯一一次完整 CI pass,commit 无 [ework:ci-held] 标记)。

七问:

  1. 是什么问题:PR 落后 master 导致与 base 分支合并冲突(merge state dirty),要求接冲突。
  2. 什么原因导致的(live 核实):master 自上次合流后前移两轮(f648217cb8→0821a81544→301e1a545),PR 分支停在 fdd0aed51e 未跟上;master 新提交与 PR 都改了 src/server/prepare-anthropic.ts 的 return 前同一段(各加一行)→ 真实冲突,非过期重放。
  3. 影响范围与严重程度:仅冲突解决面——1 个文件 1 处冲突;合并本身带入 master 54+10 提交(均已在 master 侧 CI 验证)。无行为变更:冲突解决是两行的并集保留,顺序对齐既有兄弟车道。
  4. 怎么修复的:一次性合并最新 master 301e1a545(放弃对已过期 master 的合并,避免二次冲突循环);冲突按 union of intent 保留双方新增行,顺序对齐 openai/responses/google 车道。
  5. 是否有回归问题:无——冲突解决只保留两行(各自在其源树已 typecheck 验证),未删改任何既有逻辑;typecheck 干净 + PR 回归测试 5/5 + 16 相关 preflight 测试全绿。
  6. 是否破坏缓存:不涉及。
  7. 是否改了设计方向 / 引入新配置:不涉及。

收工判定:冲突已解并推送(新 head 30acb88ed,master 完整包含、祖先关系为真),本地 typecheck + 定向测试全绿;PR 等待人工合并(agent 不合 PR)。遗留:镜像 check 缓存 2 天未刷新导致无法从镜像侧确认新 head 最终态,属镜像侧问题,请 owner 在镜像侧排查 poller。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

本次运行:live 核实后确认这是「过期事件重放」——冲突不存在,零改动、零推送。

live 核实(本轮实测,非记忆):

  • git fetch 后:origin/master = 301e1a5459 —— 与上次运行合流的 master 完全一致,未移动。
  • origin/PR-head = 30acb88ed3 —— 上次运行已推送的合流提交;本地 pr-5899-ci 与之相等(三方 ref 全等)。
  • git merge-base --is-ancestor origin/master origin/PR-head → true:master 是 PR-head 的祖先,结构上不可能有冲突。
  • 镜像 check 缓存陈旧约 32 小时(fetched_at 2026-11-15T18:23Z,仍指向旧 head fdd0aed51e 与旧 mergeable_state)——系统据这份陈旧数据误判为 dirty 并反复重放。镜像 poller 32 小时未刷新。

结论: 冲突已在上次运行解决并推送(head 30acb88ed,master 完整包含、祖先关系为真),master 此后未再移动 → 冲突不会复发。本轮无任何可操作项:不冲突、不推送(local == remote head,重推是 no-op)、head 本就无 [ework:ci-held] 标记(已是最终 head)。

七问:

  1. 是什么问题:系统再次报告 PR [PR] Fix 400 CONTEXT_WINDOW_EXCEEDED on anthropic-wire sessions bili believes fit #5899 与 base 分支冲突(merge state dirty),要求接冲突。
  2. 什么原因导致的(live 核实):这是过期事件重放,不是真实冲突——master 自上次合流后未移动,PR-head 已包含最新 master,git 祖先关系为真,结构上无冲突;触发源是镜像 check 缓存 ~32 小时未刷新、仍停留在旧 head 的旧状态。
  3. 影响范围与严重程度:无实际影响——冲突不存在,PR 处于可合并态(仅被人工合并门禁 blocked,正常,agent 不合 PR);代价是重复重放浪费 CI 车道算力。
  4. 怎么处理的:本轮零改动、零推送(live 核实冲突不存在,且 local == remote head,重推为 no-op)。
  5. 是否有回归问题:不涉及(未改任何代码)。
  6. 是否破坏缓存:不涉及。
  7. 是否改了设计方向 / 引入新配置:不涉及。

收工判定:冲突不存在(live 祖先关系为真),本轮无需任何操作。根因是镜像 check 缓存 ~32 小时未刷新(poller 疑似故障),导致系统反复据陈旧数据重放 dirty 事件——这是镜像侧基础设施问题,请 owner 在镜像侧排查 poller(已第 3 次报告)。PR 本身等待人工合并。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

本次运行:PR #5899 的 CI 红了(3 个 test 分片),live 核实为「继承性失败」——已按 CI 失败协调政策 merge ci-fixes 修复并推送。新 head c254ea492。

live 核实(本轮实测):

七问:

  1. 是什么问题:PR 的 CI 红了——3 个 test 分片(win22-4 / ubuntu22-2 / ubuntu24-2)挂在同一个测试 #2929: nudge + proxy-tool-round fold keeps re-request/next-turn byte-stable。
  2. 什么原因导致的(live 核实): 继承性失败,不是本 PR 的改动——3 分片同挂同一测试同一行;本 PR 改动在 anthropic 车道、该测试在 codex 车道(不重叠);本地在 master 301e1a545 上跑该测试同样红。是合流进来的 64 个 master 提交之一把 nudge 触发/probe 校准搞漂移了,与本 PR 无关。
  3. 影响范围与严重程度:仅 CI 门禁面——该测试在 master 上就红,任何基于最新 master 的 PR 都会继承这个红;不是本 PR 引入的行为回归,不影响已发布功能。
  4. 怎么处理的:按 CI 失败协调政策(owner 2026-10-24,继承性失败 → 合 ci-fixes),把 origin/ci-fixes merge 进 PR 分支;ci-fixes 带现成修复(codex 命中率问题分析 #2929 probe schedule-independence + 重校准 anchor),merge 干净无冲突。
  5. 是否有回归问题:无——merge 只带入 ci-fixes 的测试修复 + 文档,未改任何 src/ 行为代码;typecheck 干净 + issue2929 转绿 + 本 PR 回归测试 5/5。
  6. 是否破坏缓存:不涉及。
  7. 是否改了设计方向 / 引入新配置:不涉及。

收工判定:3 个红分片已修(merge ci-fixes,新 head c254ea492,本地 issue2929 转绿 + typecheck 干净 + PR 回归测试 5/5),已推送(最终 head、无 ci-held 标记、触发完整 CI pass),已在 #4599 报一行。本 PR 自身的 anthropic clamp 改动未受影响,等待人工合并。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b)

PR #5899 red CI (3 test shards) — fixed this run. New head c254ea492.

Live-verified: all 3 shards (win22-4 / ubuntu22-2 / ubuntu24-2) fail the same test #2929: nudge + proxy-tool-round fold keeps re-request/next-turn byte-stable (tests/issue2929-codex-fold-double-miss.test.ts:232, "scenario miss: no ephemeral nudge").

Root cause = INHERITED master regression, NOT this PR's change — my change is anthropic-lane (src/server/prepare-anthropic.ts); the failing test is codex-lane (/v1/responses); and the test fails identically on master 301e1a545 (ran locally). One of the 64 merged master commits broke the nudge probe calibration.

Fix (per CI-failure coordination policy, owner 2026-10-24, inherited → merge ci-fixes): merged origin/ci-fixes (carries the #2929 probe fix 724741097+245ecb1a9, converging to master via PR #6976) — clean, no conflicts, no overlap with this PR's files.

Verified locally: issue2929 test green · typecheck clean (tsc exit 0) · PR regression test issue5880-anthropic-clamp-arm 5/5.

Pushed as final head c254ea492 (no [ework:ci-held] marker, clean fast-forward — this branch's one full CI pass). Reported in #4599.

七问:

  1. 是什么问题:PR 的 CI 红了——3 个 test 分片(win22-4 / ubuntu22-2 / ubuntu24-2)挂在同一个测试 #2929: nudge + proxy-tool-round fold keeps re-request/next-turn byte-stable。
  2. 什么原因导致的(live 核实): 继承性失败,非本 PR 改动——3 分片同挂同一测试同一行;本 PR 改动在 anthropic 车道、该测试在 codex 车道(不重叠);本地在 master 301e1a545 上跑该测试同样红。是合流进来的 64 个 master 提交之一把 nudge 触发/probe 校准搞漂移了。
  3. 影响范围与严重程度:仅 CI 门禁面——该测试在 master 上就红,任何基于最新 master 的 PR 都会继承这个红;不是本 PR 引入的行为回归,不影响已发布功能。
  4. 怎么处理的:按 CI 失败协调政策(owner 2026-10-24,继承性失败 → 合 ci-fixes),把 origin/ci-fixes merge 进 PR 分支;ci-fixes 带 codex 命中率问题分析 #2929 现成修复(probe schedule-independence + 重校准 anchor),merge 干净无冲突。
  5. 是否有回归问题:无——merge 只带入 ci-fixes 的测试修复 + 文档,未改任何 src/ 行为代码;typecheck 干净 + issue2929 转绿 + 本 PR 回归测试 5/5。
  6. 是否破坏缓存:不涉及。
  7. 是否改了设计方向 / 引入新配置:不涉及。

收工判定:3 个红分片已修(merge ci-fixes,新 head c254ea492,本地 issue2929 转绿 + typecheck 干净 + PR 回归测试 5/5),已推送(最终 head、无 ci-held 标记、触发完整 CI pass),已在 #4599 报一行。本 PR 自身的 anthropic clamp 改动未受影响,等待人工合并。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

Re-review at head c254ea4928 (master sync + ci-fixes merge on top of the previously-approved fdd0aed51): APPROVE.

The #5880 fix is intact and correct. Both defects are root-cause fixes, verified present at the new head:

Master-sync audit (30acb88): the sync brought in #6880 (dsh purpose signal, handle.ts), #6151 (nudge-debug, prepare-anthropic.ts), and #6928 (status-line removal, prepare-anthropic.ts). None of these touch the lastInputTokensSource write path or the clamp call site — no interaction with the #5880 fix. The clampOutgoingOutput call and the anchor guard are byte-identical to the previously-approved hunks.

ci-fixes merge audit (c254ea4): brought in #6922 (one-line reference/architecture.md module-map entry for responses-system-sections.ts) and #2929 (schedule-independent fold-probe test rewrite in tests/issue2929-codex-fold-double-miss.test.ts — replaces hardcoded request-index anchors with a state-machine arm/fold trigger + pins compress.messageTimestamps:false for hermetic wire shape). Both correct, both low-risk (docs + test-only), both from the standard ci-fixes coordination flow.

CI: 30/30 green at c254ea4928 (14 success + 16 skipped, 0 failed, 0 pending). No kernel/ touch. No config surface. Behavior changes disclosed old→new in the PR body. Merge state blocked = human-only merge gate.


八问 (for human reviewers):

  1. 是什么问题: anthropic-wire 会话在 bili 认为"装得下"时仍被上游 400 CONTEXT_WINDOW_EXCEEDED 拒绝——两个根因: (A) 折叠后锚点写入把活跃的 overflow-arm 降级为 estimate 级(口径差), 导致 fold→forward→400→re-arm 活锁; (B) anthropic 车道没有出站 max_tokens 钳制(openai/responses/google 都有)。
  2. 什么原因导致的: (A) applyPostRebuildBaselineAnchor() 在重建视图的 estimate 略高于净 arm 值时, 把 lastInputTokensSource 从 "overflow-arm" 降级为 "estimate"——口径差(重建视图 vs 实际转发)。 (B) anthropic 车道的 prepare 路径没有调用 clampOutgoingOutput(其他三个车道都有)。
  3. 影响范围与严重程度: 影响所有 anthropic-wire 会话(包括 wrapper providers 如 DeepSeek, 其 completion 与 input 共享同一窗口)。严重程度: 特定条件下有问题(当 estimate 略高于 arm 值时触发活锁; 当 agent 忽略 compress nudge 时触发 400)。
  4. 怎么修复的: (A) 在 applyPostRebuildBaselineAnchor() 加守卫: 当 lastInputTokensSource === "overflow-arm" 时提前返回(镜像 relay.ts 超窗拒答以 5xx 返回时出现探测死循环;外部摘要链路三处静默/上限问题(含文件:行号与本地验证) #2484 armFailureShrink)。 (B) 在 src/server/prepare-anthropic.ts 添加 clampOutgoingOutput 调用, 以 RAW native window 为基准(与 clampOutgoingOutput sizes max_tokens against the raw native window while preflight enforces the reserve-adjusted one — up to 25% of slack the clamp never sees #2096 语义一致)。
  5. 是否有回归问题: 无。master sync 带来的 [Design][dsh] Stop guessing dsh's auxiliary requests — the in-process plugin can declare each request's purpose explicitly #6880/[PR] feat: pi lane — show the injected nudge text verbatim in the terminal when debug is on #6151/Per-turn '[ACP status: …]' line keeps ordering the model to fold leftover small ranges right after a big fold — the opposite of what the compress receipt says #6928 变更不与 Estimate-only fit decision ignores system prompt + tool definitions, and the output-budget clamp never fires → 400 CONTEXT_WINDOW_EXCEEDED on sessions that bili thinks fit #5880 修复交互; 高危模式逐项过——错误处理未从 fail-fast 变吞错(守卫是提前返回, 不是吞错), 默认值/阈值/时序未漂移, 输出格式未变, 缓存/重试策略未动。ci-fixes 带来的 [Bug] Inconsistent system prompt separator in Responses internal re-request breaks cache prefix | [Bug] Responses 内部重请求的系统提示分隔符不一致,破坏缓存前缀 #6922/codex 命中率问题分析 #2929 变更正确且低风险(文档 + 测试)。
  6. 是否破坏缓存: 不。修复不涉及缓存/重试/增量游标/去重键; 钳制只改出站 max_tokens, 不改前缀字节。
  7. 是否改了设计方向: 不。修复是根因修复(守卫 + 补钳制调用点), 不改变架构/边界/数据流; 与 clampOutgoingOutput sizes max_tokens against the raw native window while preflight enforces the reserve-adjusted one — up to 25% of slack the clamp never sees #2096/超窗拒答以 5xx 返回时出现探测死循环;外部摘要链路三处静默/上限问题(含文件:行号与本地验证) #2484 既有语义一致。
  8. 是否引入了新的配置: 不。无新 env/config/默认值。

判定: APPROVE — 可合并(等待人工合并)。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 Re-review complete at head c254ea4 — APPROVE

What I did:

Outcome: APPROVE — merge-ready, awaiting human merge.


八问(中文,供人工审核):

  1. 是什么问题:anthropic 线路上 bili 认为 fit 的会话仍收到 400 CONTEXT_WINDOW_EXCEEDED——两个根因:(A) post-preflight-fold 锚点写入把活跃的 overflow-arm 降级为 estimate 级(口径差),导致 fold→forward→400→re-arm 活锁;(B) anthropic 线路缺少出站 max_tokens 钳制(openai/responses/google 都有)。
  2. 什么原因导致的:(A) 重建视图的 estimate 测量值略高于净 arm 值(口径差),锚点写入无 overflow-arm 守卫;(B) prepare-anthropic.ts 从未调用 clampOutgoingOutput。
  3. 影响范围与严重程度:所有 anthropic 线路、窗口接近上限的会话;完全无法使用(400 硬拒),p1 级。
  4. 怎么修复的:(A) applyPostRebuildBaselineAnchor() 在 lastInputTokensSource === "overflow-arm" 时提前返回(镜像 relay.ts 超窗拒答以 5xx 返回时出现探测死循环;外部摘要链路三处静默/上限问题(含文件:行号与本地验证) #2484 armFailureShrink);(B) prepare-anthropic.ts 加 clampOutgoingOutput 调用,按 RAW nativeWindow 钳制(对齐 clampOutgoingOutput sizes max_tokens against the raw native window while preflight enforces the reserve-adjusted one — up to 25% of slack the clamp never sees #2096 语义)。
  5. 是否有回归问题:无。master-sync([Design][dsh] Stop guessing dsh's auxiliary requests — the in-process plugin can declare each request's purpose explicitly #6880/[PR] feat: pi lane — show the injected nudge text verbatim in the terminal when debug is on #6151/Per-turn '[ACP status: …]' line keeps ordering the model to fold leftover small ranges right after a big fold — the opposite of what the compress receipt says #6928)与 ci-fixes([Bug] Inconsistent system prompt separator in Responses internal re-request breaks cache prefix | [Bug] Responses 内部重请求的系统提示分隔符不一致,破坏缓存前缀 #6922/codex 命中率问题分析 #2929)变更已逐项审计,不触碰 lastInputTokensSource 写入路径或 clamp 调用点;高危模式(语义漂移、fail-fast 变吞错、阈值/时序/输出格式变化)逐项过——无命中。
  6. 是否破坏缓存:不涉及——钳制作用于出站 max_tokens,不影响缓存键/增量游标/去重键。
  7. 是否改了设计方向:不涉及——A 是守卫补全,B 是补上缺失的既有机制(其他线路已有),无架构转向。
  8. 是否引入了新的配置:不涉及——无新 env/config/默认值。

判定:APPROVE,可合,等人工 merge。

This branch has not been deployed

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

Labels

Projects

None yet

1 participant