Repository navigation
[PR] Pin-first (#3977): escape-hatch characterization pins, then size-evidence ledger + verdict state machine - #3979
Conversation
…ence ledger extraction Characterization pins (先打桩), all locking CURRENT behavior on the batch-B integration base so the pure-extraction refactor (steps 1-3 of #3977) has a hard guardrail: - P-IMG-a: image-dominated over-window payload with no local evidence rides for upstream arbitration (#496/#1800 hatch itself). - P-IMG-b: after a scoped local 413 the same payload stays refused, zero upstream calls — the #3846 evidence guard on the image hatch. - P-DIV: after a scoped local 413 a foldable payload folds and the POST-FOLD view forwards (200) — evidence closes the forward-once escape hatches, not the legitimate folded forward. - P-LEARN: an upstream 400 whose body states the real token count changes NOTHING in the estimator's verdict (titles byte-identical) — @flip-target for step 4 learnFromOutcome(overflow-400) (#3900).
… and the final verdict classification Zero behavior change (all 171 guard tests green, incl. the four #3977 pins): - src/size-evidence.ts: localRefusals store (#3846: noteLocalRefusal / localRefusalCovers / shape-filtered read) and the preflightDeadEnd write side (#728) moved verbatim from server.ts. Metadata keys and shapes unchanged; legacy session files read exactly as before. - src/preflight-verdict.ts: the final-verdict expressions (status ternary #3461, progressContinues #3918, retryable #2189, progress detail suffix, contentDeadEnd) moved verbatim as pure functions over a structural VerdictWalkSlice — server.ts keeps the walk object and calls these. - The dead-end READ block stays inline (its replay/eviction semantics are exactly as rich as the block that owns them); its write now goes through armDeadEnd. Step 2 (escape hatches consult fitEvidence) and Step 3 (single render point) land behind this on the same branch.
(ai: vllm-qwen/qwen3.8-27b) 查重:不重复 —— 本条是 #3977 计划步骤 0(pin-first 打桩)的实现 PR,#3977 主线程已声明与 #3971(batch-B 集成底座)/#3916(状态板)的关系;open+closed 检索无同主题平行在途条目。 标签: 状态:本 PR 是本机此前开的(commit author ework-agent),按规则不重做——正在拉分支核对代码、查 CI、跑定向测试,随后按八问体例给审核结论。初步已发现两处待处理:① CONFIGURATION.md/zh 混入了一对互相矛盾的重复配置行(与本 PR 目的无关,需回退);② P-LEARN 钉子的基线对比方式有个漏洞(只比了 400 之后的两次标题,没和 400 之前的基线比,一次性的 k̂ 漂移抓不住)——核实后直接在 PR 分支上修。 |
Review fix on the pin-first PR: the original P-LEARN compares two POST-400 titles, so a one-time uptake of the stated count (single k recalibration or a one-off overflow-arm floor) would leave them equal and pass vacuously — exactly the drift class step 4 flips. The control session refuses the same payload without ever seeing the 400; today both titles are byte-identical, and learnFromOutcome(overflow-400) must move the treated title away from it.
(ai: vllm-qwen/qwen3.8-27b) Step 0(打桩)+ Step 1(纯抽取)审核通过,两处小问题已直接修进分支。 独立复核(不是照抄你的验证清单)
已修两处(已推)
更正首条回复:CONFIGURATION.md 重复行噪音是 stale-base 产物——batch-B base 推进到 b9f439e(docs regenerate)后,当前完整 diff 零文档变更,无需回退。 八问(Step 0+1 轮)
状态:截至当前,Step 2 的两个提交(5c3856b2/007a19d6)还没出现在远端分支上,落地后我继续审(重点:8 个逃生口改走 fitEvidence/转移表后的等价性 + 新增三钉)。Step 4 按规划等拍板。判定:Step 0+1 可放行,继续。 |
…ence (#3977) Every forward-once escape hatch now consumes one adjudication (fitEvidence in size-evidence.ts) instead of a raw localRefusals read: localRefusalCovers becomes module-private, server.ts derives localRefusalHere from evidence.verdict === "cannot-fit". Zero behavior change by construction (the gate delegates to the exact predicate it replaced); the indirection is the contract — a store added in step 4+ lands in the adjudicator and every hatch consults it the same moment (invariant A of the ROOT-FIX plan). Verified: pins 4/4, #3846/#3918 families 9/9, tsc clean, docs/unused-exports gates clean.
The ring/publish logic moves verbatim into its own function pairing a
REAL measured token count for the payload just sent against the
pending local estimate recorded at prepare time. settleUsageReport now
delegates — behavior identical (calibration families 35/35 green).
Step 4b will feed the same learner from armOverflowShrink: a 400 body
that STATES its counts ("N in the messages") is the same physical
event as a usage report — upstream measured a payload bili estimated
(#3900: the k-hat loop currently only learns from successes).
…bration ring (#3977/#3900) armOverflowShrink now calls learnCalibrationSample when the 400 body STATES the rejected payload's counts ("N in the messages, K in the completion"): upstream MEASURED a payload bili estimated — the same physical event as a usage report. The messages share is the estimator's input domain (the completion share is a reservation, never a sample). The ring's existing guards do all the gating: pending pair set by THIS request at prepare, same route (origin-gated), plausibility band x[0.2,5], >=2 agreeing samples within x2 before k-hat publishes, per-(origin,model) keying, #3211 route policy at publication. The arm (#3450) and the learner never collide — the arm writes lastInputTokens, the learner reads the pending-estimate pair; and a successful usage report retires the arm (#1110) so the loop converges instead of oscillating. P-LEARN pin flipped with the behavior, both directions pinned: - two agreeing stated-count 400s (via the image-arb ride, recovery requests retiring the arm between detours) publish k-hat ~2.2 and flip an under-window 12K-token payload from forward-direct to fold-first (real summary call before the forward); - a window-only 400 (no per-part counts) arms but never teaches: no samples, no publication, the same payload still forwards directly. Families unchanged through the hook: stated-count + calibration suites 74/74 (their single-shot 400s never reach >=2 agreeing samples), pins 4/4, tsc clean, docs/unused-exports gates clean.
… pinned Review fix 19bea67's premise (a stated-count 400 must move the treated title) meets the flipped semantics: publication needs TWO agreeing stated samples, and its fixture 400 was the window-only shape. (i) window-only 400: arms but never teaches — title stays byte-identical to the never-saw-400 control (the original assertion, preserved); (ii) two stated-count 400s: k-hat publishes, the calibrated estimate scales, the refusal title MOVES away from the control — and the payload still never reaches the upstream. Pins 5/5, families 83/83, tsc clean, gates clean.
Steps 2 + 4 landed (74499b5 → 45be60b)
Why the arm and the learner can't collide: the arm writes Step 3 (single-render enum exits) is deferred by design: its substance — verdict classification as pure functions + one evidence gate — is delivered by Steps 1–2; a mechanical all-exits-return-enum refactor adds churn without new behavior. Tracked in #3977 for a follow-up if the ledger migration (ROOT-FIX-PLAN §4) proceeds. Verification: pins 5/5 (incl. both flipped directions), stated-count + calibration families 74/74, #3846/#3918 families 9/9, tsc clean, docs-sync + unused-exports gates clean. The observed flip: two agreeing stated-count 400s (k̂ ≈ 2.2) turn a 12K-raw-token under-window payload from forward-direct into fold-first with a real summary call before the forward. |
(ai: vllm-qwen/qwen3.8-27b) 全 PR 审核完成(pins + Step 1/2/4a/4b @45be60b4c),通过。 独立复核,不是照抄验证清单: Step 2(fitEvidence) — 零行为变化成立是构造性的:grep 审计确认 Step 4a — verbatim 抽取;调用点 cache-ledger.ts:1540 位于 Step 4b — 臂写 本地定向验证 @45be60b4c:pins 5 + #3846/#3918 族 9 + 校准/stated-count 族 = 83/83 绿;tsc --noEmit 0 错。CI @45be60b4c:8 条 e2e lane 全绿。主矩阵(ci.yml)因 base 仍是 batch-B 分支未触发(pull_request 限定 base=master)——retarget 后以矩阵为准。 本轮动作
八问(全 PR)
判定:全 PR 可放行,ready for retarget-to-master → 主矩阵 CI 绿 → 人工合并。前置两件:① retarget 后矩阵全绿;② send-guard 预留的去向确认(上面第 3 点)。 |
Implements the pin-first discipline of #3977: 先打桩,盯住测试和证明,然后开干。
Stacked on #3971 (batch-B integration) — retarget to
masterafter that lands. This PR opens with the pins only; the extraction commits (steps 1-3 of the plan) land on this branch behind them.为什么先打桩
纯抽取重构的护栏不是"相信等价",而是把当前每个逃生口的可观测行为锁死。#3846/#3918 已钉住 probe 口、verdict 分类、模型/origin 独立性;本 PR 补上没有钉的四条边:
learnFromOutcome的翻转目标(#3900)验证
路线(后续提交落在本分支)
src/size-evidence.tsfacade(12 store 读写收口,metadata key 不动)+src/preflight-verdict.ts枚举与纯函数;判定结果逐字节不变,全钉+全量测试为界fitEvidence/转移表,删 4 处localRefusalHere手工插点learnFromOutcome(overflow-400)翻转 P-LEARN +FAIL_FAST(class="send-guard")预留(Mid-session wire/dialect switch sends one request far beyond the declared window (upstream ContextWindowExceededError); no send-time size guard #3872)Closes #3977
Behavior change (step 4b — disclosed per review rule)
armOverflowShrinknow also feedslearnCalibrationSamplewith the messages share (src/server/relay.ts). Two agreeing stated-count 400s on the same (origin, model) route publish k-hat through the ring's EXISTING guards (plausibility band ×[0.2,5]; ≥2 samples agreeing within ×2; per-route policy [Bug] 虚报线路把 k̂ 学成 1.86 后,决策数反超上游自身报数 47%、长期压在压力带:到 10W 线就折一次、每次只折 1W 多 #3211).Status note (review round 2)
FAIL_FAST(class="send-guard")reservation from the original roadmap (Mid-session wire/dialect switch sends one request far beyond the declared window (upstream ContextWindowExceededError); no send-time size guard #3872) is NOT in this PR — confirm it stays tracked in Root fix: server-side size-evidence ledger + preflight verdict state machine (fold-budget/eligibility B-class family) #3977 / Mid-session wire/dialect switch sends one request far beyond the declared window (upstream ContextWindowExceededError); no send-time size guard #3872 rather than silently dropped.