Repository navigation
[PR] feat: invariant judge GA — default-on L1 advisory, egress chokepoint, loop continuity, bounded exemptions (#3938 PR-A) - #3944
Conversation
…und cores (#3842) Reconciles inbound vs outbound message cores on the live request path to enforce two cache-stability invariants machine-checkably: I1 (no fold) requires every inbound message to reappear at egress in order, core-identical, modulo tail growth plus a closed exemption list (chain carriers, acp_summary carriers, reasoning drops, crush envelopes); I2 (fold) confines all divergence to [earliest fold coverage .. end) with the frozen prefix identical and the carrier position pinned. Exit cores are re-parsed from the exact outbound body through its own wire codec, so the comparison reflects what crossed the wire and is wire-neutral (same-wire and cross-wire unified via the kernel canonical core). Render-tag scaffolding (renderTags=text-only) is normalized away on both sides, so the exemption list closes without documenting a carve-out. The judge is advisory and disarmed by default (zero hot-path cost); it is armed in tests today, and production arming on real traffic is deliberately left as an owner decision (perf/event-noise tradeoff and the point at which a config knob would enter). CI enforcement is active: a seeded host-behavior generator (append/edit/retry/model-switch/restart) drives the real proxy through the judge with zero false positives, and injected rewrite/reorder/drop/mid-insertion faults are all caught. Tests: unit oracle (positive controls + five-shape negatives + fold boundary) and a real-proxy e2e generator + defect fixtures. Fixes nothing upstream; the referenced defects (#3805/#2483/#3691/#3769/#3676) stay scheduled separately per the issue.
…entity (#3842) Review findings on the I1/I2 judge (PR #3866): - The call site sat right after runPrepare(), BEFORE preflight compression. A fold-CREATING request was judged on its pre-fold bytes, so I2 never reconciled the one traffic class it exists for. Move the call to the resolved prepared value (after preflight / reforge), where prepared.body is the exact byte stream relayed upstream. - The scan skipped every exit carrier while the entry side only skipped reasoning: a stateful host that re-sends previously-injected acp_summary / chain-checkpoint carriers false-positived on every steady-state post-fold turn (even entry==exit). Carrier entries now match their own twin by identity, and the gap budget counts non-carrier elements only. - The sink delivered violations only, so folded-but-clean verdicts were invisible and the live I2 path could not be asserted. Every judged request now reports its verdict (test-only surface; prod stays disarmed). Tests: unit fixtures for carrier echo (summary + chain), five-consecutive carrier gap, and the carrier-text-drift design boundary; e2e gains a real preflight fold through the live path (tiny window) - zero false positives across the folded stream, and post-fold prefix corruption fires.
…ontinuity; bound the exemption list (#3938 PR-A) - Arm by default (#3938 decision 2): violations log at warn, clean verdicts at debug, never blocks. Knob diagnostics.invariantJudge / BILI_INVARIANT_JUDGE=0 to disarm (CONFIGURATION en+zh). - Move the main-lane hook from the pre-send site (handle.ts) to the universal egress chokepoint (relay.ts noteForwardedBody block): judges the EXACT bytes after compat-role / steering / chain-stamp / shed rewrites. - New loop-lane continuity check (loop/core.ts fetchUpstream): rounds 2+ have no client inbound, so I1's entry ground truth is the previous outbound; clipped/oversized forensics silently skip. - #3842 count-bounded exemption list: carrier/reasoning/crush volume rides every verdict (exempt ledger) and beyond the cap (128 default) is itself an exemption-overflow violation. - e2e now proves all three wires live (openai + anthropic + google): zero false positives on legitimate growth, teeth on injected mid-history defects. Rebased from #3866 (its 2 content commits ride as the first two commits of this branch).
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.4701-pr.3944.df0c88aThis exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr3944.tgz
npm install -g packageInstall instructions are refreshed on each push. |
(ai: vllm-qwen/qwen3.8-27b) 查重: 不重复。 #3866 是本 PR 的前身(同一判官的「测试专用、默认关闭」版;本分支前两个 commit 即其 rebase),两者是演进关系而非平行工作——本 PR 合入后 #3866 应以 superseded 关闭(留待 owner/作者处置)。#3938 是总跟踪 issue,按设计保持 open 给 PR-B/C/D,不构成重复。无其他在途 PR 触碰同一出口判官面。 标签: pr / scope/wiring / p3(纯观测层特性——只加日志不改流量,挂点在出口协议接线层;非缺陷类)。 正在做完整 review:分段通读 diff(9 文件 +936/-4)、核查 CI、本地跑定向测试。结论按八问体例随后补上。 |
…ION en/zh (#3944) Review fix for #3944: the config-surface-guard / docs-coverage / docs-sync gates failed because the CONFIGURATION tables were hand-edited while the single source of truth (website/config-reference/*.yaml, #2107) got no entry. Add the diagnostics.invariantJudge seed entry and regenerate both doc tables from it. Net effect vs the previous commit: wording drops backticks (generator constraint), and the BILI_INVARIANT_JUDGE env row moves to its alphabetical slot. No behavior change.
(ai: vllm-qwen/qwen3.8-27b) 审核结论方向正确、实现扎实、测试有牙。审核中发现 1 个阻塞问题(CI 红)——已直接修掉并推送到本分支(独立 commit 我做了什么
回归清点(diff 触碰路径的既有行为)
八问
后续项(不阻塞,已记入 #3938 清单)主车道体积守卫(每请求全 body 重解析,#3128 后多 GB 请求合法)· 重试/重发路径判官覆盖 · 判官内部异常可见性(现空 catch 静默失武)· snapshot-render D 车道交互确认(rollout >0% 时)· 马拉松会话 reasoning 溢出边缘。 CI 状态与判定新 head |
(ai: vllm-qwen/qwen3.8-27b) CI 全绿,可以合并新 head
PR 状态:open / mergeable / 仅等你合并(agent 不能合 PR)。 合并后建议:把 #3866 按 superseded 关闭——它的两个内容 commit 就是本分支的前两个 commit,留着只会造成「两个 PR 修同一件事」的误读。关闭说明写一句「已并入 #3944 并 GA」即可。 |
(ai: zhipuai-lb/glm-5.3)
Part of #3938 (PR-A step of the ladder; judge promotion) — the umbrella stays open for PR-B/C/D. Rebased from #3866 (its two content commits are the first two of this branch).
这是什么
把 #3866 的 I1/I2 出站不变量判官从「测试专用、默认关闭」升级为「默认开启的 L1 advisory」,并补齐 #3938 拍板的三件事:判官挂到真正的出口字节上、补上 loop 车道、给豁免清单上计数封顶。纯观测层:只记日志(warn/debug),绝不阻塞流量。
改动
diagnostics.invariantJudge(默认 true)/BILI_INVARIANT_JUDGE=0静默(CONFIGURATION en+zh 已同步)。exempt台账),超过默认 128 即exemption-overflow违规 —— 防止缺陷伪装成豁免。Config surface
diagnostics.invariantJudge: boolean(默认 true),envBILI_INVARIANT_JUDGE。依据:现有 diagnostics 段的布尔开关惯例(同 renderNone);owner 已在 Unified Prefix Cache Fix: Transactional Folding Boundaries + Single Exit Arbiter (Global Tracking) | 前缀缓存统一修复:折叠边界事务化 + 出口单一判官(总跟踪) #3938 决策② 批准「默认开、全量、不采样」,此键只是它的关停开关。迁移:无(纯新增,默认即目标行为)。测试
testlanes 为准。边界(有意不做,留给后续)