Skip to content

[PR] verif: responses-ingress judge (#3837 family) + path-guarded mutation replay - #4103

Merged
ranxianglei merged 1 commit into
masterfrom
verif/ingress-judge
Oct 21, 2026
Merged

ranxianglei merged 1 commit into
masterfrom
verif/ingress-judge

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

接 #4073。为 #3837(出站不纯追加)所属的入站管线建判官,并修掉判官逼出来的引擎可靠性问题。

判官(tests/verif-responses-ingress.test.ts + verif/drivers/responses-ingress-driver.ts)

翻译 真实的三个入站函数(src/loop/adapter-responses.ts: normalize / sanitize / drop,按 prepare-responses.ts 的真实顺序组合),输入为全符号 3 条消息(覆盖每个分支:msg-proxy-/marker-/>64 长 id、type 有无、role 自由、ws-only content):

  • Q1 幂等 P(P(x)) ≡ P(x) — UNSAT(重发同一请求,盖章/删除/重写/丢弃都稳定)
  • Q2 规范化 type 缺失 ≡ 显式 "message" 的孪生输入 → 管线输出相同 — UNSAT(钉死 normalize→sanitize 顺序;顺序换了 type 缺失孪生会漏删 bili id)
  • Q3 局部性 非消息项(reasoning/function_call)不被管线动 — UNSAT
  • E1/E2/E3 非空性:每个 heal 阶段可达(盖章可达 / bili-id 删除可达 / ws 丢弃可达) — SAT
  • 60 轮随机形状跑真代码,二跑无操作(回放锚)

引擎修复(全部由判官失败逐层逼出,verif/symbolic.ts)

  1. splice 符号下标(倒序丢循环):elems[j]=ite(i>j, old[j], ite(len>j+1, old[j+1], undef))、newLen=If(len>i,len-1,len)。
  2. K 上限循环退出断言:tb 恒真时推 ¬tb = 恒假断言,毒死整个查询([cache][kernel] Ref migration during durable carrier replacement rewrites sent history, causing a prefix cache seam | [cache][kernel] durable 载体替换时 ref 迁移改写已发送历史,导致前缀缓存接缝 #3805 回归的根因)。只对符号 tb 断言;恒真=有界欠近似(注释说明)。
  3. Map.get 扇形读:值通道 iteStrict(live, got, acc) + 精确空性;旧 neutralFor 包装丢键匹配守卫。
  4. 恒等合并 a===b → a:跨迭代/分支合并保留对象恒等,别名回放才能找到容器。
  5. 标量 vs nullish 合并:打标(undefUnder/nullUnder)而不是丢弃 undefined 侧。
  6. 调用边界容器突变回放:mutations 共享数组 + 记录点 + param-final 先行(带守卫的终值)+ 裸 pair 兜底 + 跨层链式组合 + callerFrame(嵌套深度 2+ 回放写到调用者帧)。
  7. pathCond 门控(Q1 根因):守卫路径上的写不再推裸 mutation pair——pair 的 next 是单臂对象,无守卫回放会把别名持有者(调用者快照数组)用不可达臂的值污染;守卫写经 mergeBranch → param-final 传播。最小复现:1 条消息 double-sanitize,role=system(全分支不可达)时模型说 id 会变——修复后 UNSAT。
  8. 模板字面量丢字面文本、join 丢首元素/分隔符、slice 2 参折叠、charAt/toUpperCase 折叠、数组展开 declaredLen(numAdd 常叶安全)。
  9. delete 别名镜像(delete 原地改,所有持有 base 的容器必须看到)。

验证

  • 全套 verif 测试 30/30 绿(含此前 29 个判官)
  • tsc 干净(仅存量 pi-subagents/mysql)
  • anthropic 测试删了 10 个已提交的 DBG 块

@ranxianglei 人工合并

… replay

Judge (tests/verif-responses-ingress.test.ts + verif/drivers/
responses-ingress-driver.ts): the three REAL ingress fns from
src/loop/adapter-responses.ts (normalize → sanitize → drop, the order
from prepare-responses.ts) over fully-symbolic 3-item inputs:
- Q1 idempotence P(P(x)) ≡ P(x) — UNSAT
- Q2 canonicalization (type-less ≡ explicit-type twin) — UNSAT
- Q3 locality (non-message items untouched) — UNSAT
- E1/E2/E3 non-vacuity (each heal stage reachable) + 60-run random
  real-pipeline replay anchor.

Engine (verif/symbolic.ts) — soundness fixes the judge forced:
- splice(i,1) with SYMBOLIC index (reverse-loop drop shape): per-slot
  ite(i>j, old[j], ite(len>j+1, old[j+1], undef)); newLen = If(len>i,
  len-1, len).
- K-cap loop-exit asserts: pushing ¬tb when tb is CONST-TRUE emitted a
  const-false assert and killed every query (allocateFreeRef's
  while-loop can never exit within K). Assert only when tb is symbolic;
  const-true = bounded under-approximation (documented).
- Map.get fan: value channel = iteStrict(live, got, acc) with exact
  nullness from the acc chain (scalar undefUnder/arr-obj nullUnder);
  the old neutralFor wrap dropped key-match guards (rec["missing"] !==
  undefined folded true).
- mergeVal/mergeValStrict identity merge (a === b → a): preserves
  object identity across loop-iteration/branch merges — without it,
  every merge cloned untouched slots and alias replay found nothing.
- mergeValStrict scalar-vs-nullish: tag (undefUnder/nullUnder) instead
  of dropping the undefined side.
- Call-boundary container-mutation replay: RunState.mutations shared
  across state copies; recording at writeLValue/PropertyAccess/
  ElementAccess/delete; param-final replay FIRST (guarded final param
  binding), raw pair pass after; chain-composition across call levels;
  inlineCall callerFrame (mutation replay writes the CALLER's frame —
  the top-level frame capture lost them at depth 2).
- pathCond gating (THE Q1 fix): mutation pairs from writes on a guarded
  path are SKIPPED — the pair's next is the single-arm object and
  replaying it unguarded clobbers alias holders (the caller's snapshot
  array) with the arm's value even when the branch cannot fire. Guarded
  writes propagate via mergeBranch → param-final instead.
- Template span literal text dropped ("a\${b}c" evaluated "ac"); join
  lost element 0 and separators past k=2 (Set spread len contribution);
  slice/substring 2-concrete-arg fold; charAt + ASCII toUpperCase fold;
  array-spread declaredLen via numAdd (const leaves carry no methods).
- Delete alias mirror: delete rec.k pushes {old,next} + in-frame alias
  replace (delete mutates in place).
- numAdd/strEqF const-leaf-safe helpers; assignment (=, +=, -=) routed
  through writeLValue in evalBinary (was silently lost with the
  drop_block cleanup — restored).

terms.ts: Sort union += "RegLan" (Re-sorted define-funs).
anthropic test: removed 10 committed DBG blocks.
@ranxianglei ranxianglei changed the title verif: responses-ingress judge (#3837 family) + path-guarded mutation replay [PR] verif: responses-ingress judge (#3837 family) + path-guarded mutation replay Oct 21, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: verif/ingress-judge (5b440c3)

Option A — Install this exact build (recommended)

npm install -g billion-context@0.0.4892-pr.4103.0435c34

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-pr4103.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)

查重: 不重复。最接近的在途条目是 #4089(verif anthropic round-trip harness 在他人机器上红),失败域不同——它审 harness 机器可移植性,本 PR 是 responses-ingress 判官 + 符号引擎 mutation replay 语义;open issue/PR 中无第三份覆盖同一工作。

标签: scope/ci + p3(测试基建:verif 判官与符号引擎可靠性,无用户可见行为面;非缺陷类立项,不打 bug)。

这是 [PR] 唤醒:PR #4103(head verif/ingress-judge @5b440c36,base master,mergeable=behind)已完成待人工合并。我不重做,按规范独立审核:先对 #4073/#3837 核方向,再做既有行为回归清点、代码与测试有效性审查、diff 整洁度,结论按八问体例跟进。

CI 现状(head 5b440c3):guard 类 19 项全绿(kernel-guard / pi-subagents-guard / version-guard / lane-guard / docs-sync / build-artifact 等),real-client e2e 11 项按门控 skip,mysql-contract / config-surface-guard / unused-exports 3 项 queued,test 分片尚未出结果——最终判定以远端 CI 全绿为准。

@ranxianglei
ranxianglei merged commit fb0d91d into master Oct 21, 2026
72 of 107 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

📦 Merged Build Published

This merge to master was published as 0.0.708-master.fb0d91d (rolling master tag).

npm install -g billion-context@0.0.708-master.fb0d91d  # 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant