Repository navigation
[PR] EN | #3977 step 1: extract size-evidence ledger facade + land preflight verdict enum (zero behavior change) - #4012
ranxianglei wants to merge 5 commits into
Conversation
(ai: vllm-qwen/qwen3.8-27b) 查重:不重复 — #4012 本身就是 #3977 迁移计划的第 1 步(纯抽取),检索 open+closed issue 与近期 PR(按失败签名:facade 抽取 / preflight verdict enum / size-evidence ledger)无同主题在途条目。栈关系核对无误:head = 开始独立审核:①核对 commit 1 ≡ #4009;②逐行读 layer-2 diff( |
…facade Rebase onto post-#4079 master: the refusal store moved by this PR's refactor commit was the pre-TTL version. Master's #4079 (#3974) added LOCAL_REFUSAL_TTL_MS (10 min) + the no-at-means-expired filter to readLocalRefusals; without adopting it here the facade would silently revert refusals to never-expiring locks. Verbatim adoption of the master implementation (comments included).
The #3146 forward-once and #3846 refusal-closure log lines gained a /#4185 suffix when #4185 extended the fresh-session escape to identified zero-evidence sessions (merged to master after this pin's base b9f439e). Behavior of the pinned anonymous-zero-baseline path is unchanged — every other assertion in both tests passed; only the two exact-substring pins were stale. Also align the P-FRESH negative test title with its 502 assertion (the title said 413).
Comment-only accuracy fix: post-#4079 master has no dead-end cooldown mechanism left (knob + config key + exit site all gone), so the contract comments must not present cooldown/dead-end-cooldown as live exit kinds. Step 2 decides whether the members stay for ledger mapping or drop.
69afd9d to
629098e
Compare
(ai: vllm-qwen/qwen3.8-27b) 审核结论:layer-2 抽取本身成立(零行为变化逐项复核通过),但分支基线已失效——我已代为 rebase 到当前 master、补上三个标注 commit 并把 PR base 改回 master。 新 head 独立审核做了什么(不复述 issue 结论)① 原 issue 方向关:#3977 的根因判断我认可——知识+策略焊死在 preflight if-chain 里,估算与硬证据共用一个无类型数字(#1839 estimate-as-fact / #3146 unknown-as-estimate / #3663 mixed rulers 是同一病的三个症状);step 1 只做「证据平面 + 出口契约」的纯抽取,不碰决策,切法正确。 ② 逐行读 layer-2 diff(
审核中发现的问题(已当场修复,均为无决策依赖项)
结构化八问
收工判定可进入 owner 合并评审,待新 head CI 绿。合并顺序建议 #4009 先行(step 0 在前),两者内容现已逐字节一致,#4009 先合后 #4012 的两个 pin commit 在下一次 rebase 直接 drop;反序亦可机械处理。CI 红了叫我定向排查。 |
(ai: vllm-qwen/qwen3.8-27b) CI 状态补报:新 head |
|
(ai: zhipuai-lb/glm-5.3) 收尾清理:issue #3977 的修复已随合并 PR 落地。关单;误判请 reopen。 |
(ai: vllm-qwen/qwen3.8-27b)
#3977 migration step 1/5 — pure extraction: size-evidence ledger facade + preflight verdict enum, judgments byte-identical. Work stack sits on the #3971 integration branch per the issue plan.
Contents (2 commits, stacked)
This branch stacks on PR #4009 (step-0 pins):
test: pin preflight escape-hatch × local-refusal edges + calibration boundary (#3977)— identical to [PR] test: pin preflight escape-hatch × local-refusal edges + calibration boundary (#3977) #4009; drops out automatically on rebase once [PR] test: pin preflight escape-hatch × local-refusal edges + calibration boundary (#3977) #4009 merges.refactor: extract size-evidence ledger facade + land preflight verdict enum (#3977)— the change under review. Review layer 2 only viab7a116f21..HEAD.What changed
src/size-evidence.ts— the size-evidence authority (goal A, phase 1):EvidenceGrade = "usage" | "overflow" | "local-refusal" | "estimate"and theSizeEvidencerecord shape from the issue ({kind, origin, model, window, tokens, at, grade});readBaselineEvidence(stats)— the session baseline as one graded record (unprovenanced source → estimate grade = the exact legacy treatment);baselineFloor(evidence, currentOrigin, hasProcessedMessages)— the emergency shrink / preflight 的本地估算用错了视图:超长会话(客户端历史 127 万,压缩后 outbound 仅 ~16 万)在上游失败无 usage report 时,bili 按原始历史估算 #1492 floor rule + DSH: 切换模型后,preflight 在窗口远未满时提前触发压缩 #1933 F2 cross-origin demotion as a pure projection;hasOverflowEvidence(evidence, limit)— the PR #489 后续: 默认图片计费 b64/4 在像素 tile 计费上游(官方 Anthropic/OpenAI)会硬 502 误杀多模态会话 #496/任何一轮没有拿到 usage 报告的请求,都会把上下文分母放大 12–20×(nudge 读到 >1000% usage、假 EMERGENCY、基线冻结数分钟) #1839/[Question] 非白名单上游(如 DeepSeek)图片按 b64/4 估算,实测高估约 100×;且该估算被写回 lastInputTokens 并自愈成 confirmed 窗口,使 #496 逃生门永久失效 #857 evidence predicate;noteLocalRefusal/localRefusalCovers/readLocalRefusals) moved VERBATIM from server.ts.fitEvidence()lands in step 2 WITH its callers (no dead code in step 1);learnFromOutcome()in step 4 (owner sign-off pending).src/preflight-verdict.ts— the goal-B state machine landed as the typed contract:PreflightVerdictunion (forward-fits/fold/forward-once-arbitrate(reason)/fail-fast(status,retryable,class)/cooldown/steady-state/congestion) with each member documented against its exit site. No runtime wiring yet — wiring lands with the transition table in step 2 where the kinds become load-bearing.src/server.tsrewired through the facade (net −59 lines): baseline block → facade call (the DSH: 切换模型后,preflight 在窗口远未满时提前触发压缩 #1933 F2 demotion log stays byte-identical), probe condition /noOverflowEvidence/estimateOnlynow read graded evidence instead of raw stats strings; the old refusal-store block deleted (moved).Zero behavior change — how it is proven
Every substitution is provably equivalent:
source === "usage"/=== "overflow-arm"comparison, including unknown-string sources (they project to estimate, which all old checks treated as non-evidence);hasOverflowEvidence≡ ¬(oldnoOverflowEvidence), including thelastInputTokens === undefinededge (limit > 0 past the trigger guard);baselineEvidence.tokens > 0≡session.stats.lastInputTokens > 0;normalizeUpstreamOrigin's undefined semantics exactly (absent/empty/unparseable origin ⇒ no demotion, same as before), so the log fires on exactly the same inputs.Metadata keys are untouched and no persistence format changed (phase-1 compat rule; §7.4 gate 4 holds: no config schema / persistence / wire change). Local verification: typecheck clean + 55 targeted tests green across 11 suites covering every touched path (issue3846 refusal store, issue3918 verdicts, issue3977 pins, preflight-client-abort, issue1933 F2+calibration, issue2313 probe, issue857 image baseline, issue1800 image arbitration, preflight-fail-fast estimate-only note, fix-arm-headroom-clamp, issue1493 outbound payload); full-suite verdict = CI lanes on this head.
查重: 不重复 — this IS migration step 1 of #3977's own plan; the suites above are the behavior pins it must keep green (they do).
Fixes #3977
(孤儿认领:标题本已指向 #3977,补上关闭关键字 —— 第三批清理)