Skip to content

[PR] test: Form Matrix Completion — Full Profile, Proxy Mode & EMERGENCY Reverse Guardrail (#3617 D) | test: 形态矩阵补全——全 profile、proxy 模式与 EMERGENCY 反向护栏(#3617 D) - #3625

Merged
ranxianglei merged 1 commit into
masterfrom
2026-10-18_lane-matrix-completion
Oct 18, 2026
Merged

ranxianglei merged 1 commit into
masterfrom
2026-10-18_lane-matrix-completion

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

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

Part of #3617 item D(形态矩阵补全)。纯测试 PR,无源码改动。

背景

#3617 复盘:#3401(dsh 压缩面误抑制)漏出时,矩阵只有「该抑制时抑制」的正向行;#3600 补了 run_code 行但 profile 仍只覆盖 omp/dsh 两个,proxy 模式的结构性 on 没有对照行,#3461 的 EMERGENCY 覆盖也没有在门层面钉过反向行为。本 PR 把 tests/lane-decisions-matrix.test.ts 的组合列全。

新增 7 行 × 4 wire = 28 个测试

行 断言 钉什么
pi 无工具 nudge+standingPrompt 都在 registry 里 toolsHostScopedByDefault:false 的两个 profile 之前从未走过真实 prepare 链——现在走
opencode 无工具 同上 同上
omp 单一普通工具 [get_weather] 都在 非 host-scoped 的 lane 无视工具表(与 dsh 精确行的对照孪生)
proxy 模式对照(不带 x-bili-plugin 头) 都在 「结构性 on」的对照组:非插件请求永远可达(#3417 纪律的锚点)
EMERGENCY:omp @45k/64k=70% 注入 #3461 反向护栏:内核按 cadence 拒发时,宿主 override 必须把 nudge 顶上去
EMERGENCY:dsh 无工具 @70% 不注入 反向:紧急压力也不能打穿不可达的工具表——门是双向的
EMERGENCY:dsh run_code @70% 注入 PTC 形状在压力下同样可达(#3600 家族的压力版)

EMERGENCY 行的构造依据(为什么它真的测到了 override)

教给代理的 usage 是 45_000/64_000 = 70.3%,卡在宿主升级线 0.7(EMERGENCY_NUDGE_ESCALATION_PCT)和内核超限线 0.75(maxContextLimitPct)之间,所以:

harness 加了一个 teachTokens 参数(默认仍是 50_000,既有行不受影响),用于把 usage 教到任意水位。

验证

  • 本地:node --import tsx --test tests/lane-decisions-matrix.test.ts → 58/58 通过(原 30 + 新 28);
  • 本地 npm run typecheck 干净;
  • 全量回归以 CI 为准。

Closes 无——本 PR 是 #3617 六项之一,issue 待六项全部合入后关闭。

…EMERGENCY guard (#3617-D)

Adds 7 rows (x4 wires = 28 tests) to tests/lane-decisions-matrix.test.ts: pi/opencode no-tools (registry host-scoped default false exercised through the real prepare chain), omp single regular tool (non-host-scoped ignores tool table — contrast twin of the dsh precision rows), the proxy-mode structural-on control (no x-bili-plugin header), and the #3461 EMERGENCY override pair: taught usage 45k/64k = 70% sits between the host escalation line (0.7) and the kernel over-limit line (0.75), so the kernel declines on cadence (verified by direct kernel probe: shouldInject=false, 'growth 0 < floor 22500') while 6K executable mass clears minPressureBenefit — the nudge can only arm via the host override. Rows pin: it injects where the surface is reachable (omp + dsh run_code) and must NOT punch through an unreachable dsh tool table. No source change: test-only.
@github-actions

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-10-18_lane-matrix-completion (05ff3f8)

Option A — Install this exact build (recommended)

npm install -g billion-context@0.0.4266-pr.3625.d2de1fa

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-pr3625.tgz
npm install -g package

Install instructions are refreshed on each push.

@ranxianglei ranxianglei changed the title test: 形态矩阵补全——全 profile、proxy 模式与 EMERGENCY 反向护栏(#3617 D) [PR] test: Form Matrix Completion — Full Profile, Proxy Mode & EMERGENCY Reverse Guardrail (#3617 D) | test: 形态矩阵补全——全 profile、proxy 模式与 EMERGENCY 反向护栏(#3617 D) Oct 17, 2026
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

查重: 不重复 —— 本 PR 是 #3617 六项中 D 项(形态矩阵补全)的唯一实现;同系在途的 #3620(A 反向断言纪律)、#3627(B 假上游严格化)、#3626(F PTC e2e)各管各的范围,无重叠。

审核结论:可合(等最后一个 CI shard 跑完即可)。独立核验如下:

① 方向关:与 #3617 D 项要求逐字对齐——profile×wire×工具形状组合列全 + #3461 EMERGENCY 反向护栏。这是复盘后的覆盖补全(characterization/regression pin),不是修 bug,方向正确。

② 回归审查:diff 只碰 tests/lane-decisions-matrix.test.ts 一个文件(+40/-9),零源码改动。既有行为清点:原 7 行 × 4 wire 逐字节未变——teachTokens 默认 50_000 保持旧语义,send() 对非 proxy lane 仍发同样的 x-bili-plugin 头。结论:无任何既有行为被触碰,回归面为零。 漂移检查:merge-base(fd3232f)之后 master 新增 4 个提交(dsh attach、persona-lineage),不碰 lane-decisions/budget/host-profiles/prepare-*/nudge 任何文件,GitHub 报 mergeable=true,无语义冲突风险。

③ 代码审查(机制独立验证过,不是照抄 PR 描述):

  • EMERGENCY 行的构造是真的测到了 override:EMERGENCY_NUDGE_ESCALATION_PCT = 0.7(src/server/budget.ts:40)、内核超限线 maxContextLimitPct: 0.75(kernel/src/config.ts:10)——教给代理的 45k/64k=70.3% 确实卡在两线之间;emergencyNudge()(budget.ts:344)要求 !shouldInject && contextUsage≥0.7 && maxPending≥minPressureBenefit,emergencyNudgeArmed() 首次注入必 arm(无 gate 状态),所以 omp 行的 nudge 只能来自宿主 override 路径(modelWantsIt = shouldInject || emergencyNudgeArmed(...),四个 prepare 适配器一致);
  • 反向行为由门本身保证并被钉住:nudgeOn()(src/server/lane-decisions.ts:208)把 compressSurfaceOn 与 modelWantsIt 做 AND——dsh 无工具时 compressReachable=false(host-profiles.ts:71 toolsHostScopedByDefault:true),即使 override arm 了也注入不出去。反向行断的正是这个 AND,override 路径或门任一回归都会红;
  • registry 默认值核对:host-profiles.ts:72-74 pi/opencode/omp 均 toolsHostScopedByDefault:false,与「pi/opencode 从未走过真实 prepare 链」的说法一致;
  • 测试卫生达标:env/tmpdir 隔离、listen(0)+有界重试(lane 统一决策点收尾:四处 B 类名字旁路迁入 + nudgeOn 单点(#3482) #3490 模式)、60s 超时、closeAllConnections 收尾,无 as any/@ts-ignore;注释讲构造依据(为什么),符合规范。

④ 测试有效性:真测试。outcome() 检查的是转发到上游的 wire 字节(nudge 尾部 user 消息形状 + standing prompt 里 acp_status marker),不是内部标志位;每行正反两个断言(nudge + standingPrompt)deepEqual,非恒真。走的是真实 startServer + 真实 prepare 链 + 假上游,保真度恰好在契约该钉的层次。

⑤ diff 整洁度:单文件、单提交、每一行都与目的相关;-9 行是头注释块重写 + 类型/签名扩展,无无关改动、无空白噪音。

验证证据:本地定向跑 node --import tsx --test tests/lane-decisions-matrix.test.ts → 58/58 通过(175s,与 PR 声明一致);CI 静态门禁全绿(kernel-guard/config-surface-guard/docs-sync 等)、test 分片 6 个里 5 个绿,剩 ubuntu-latest node24 shard 1 在跑,跑完我补一句确认。


八问

  1. 是什么问题:[bug] #3177 的 DSH compress-surface 抑制在「agent 能看到 bili 工具」的 DSH 环境下误伤:nudge 与 compress 系统提示被永久关闭 #3401/[bug] 0.1.198 PTC(run_code)会话压缩面被永久压制:顶层 tools 只有 run_code ⇒ declaredTools.has("compress") 恒 false ⇒ nudge 从不注入 #3600 修完后矩阵只有正向行——pi/opencode profile 没走过真实链路、proxy 模式没有结构性 on 对照、EMERGENCY override 没有门层面的反向钉法。
  2. 什么原因导致的:覆盖缺口而非代码缺陷——修复时只钉了「该抑制时抑制/该放开时放开」的正向面,压力版和反向面留白,未来同类回归(如 override 打穿不可达工具表)无测试兜底。
  3. 影响范围与严重程度:纯测试 PR,零用户面影响;价值在于把三个留白面变成回归红线。
  4. 怎么修复的:扩 Lane 类型(pi/opencode/proxy 三新列)+ harness 加默认 50k 的 teachTokens 参数教任意水位;EMERGENCY 对用 70% usage 卡在内核拒发线与宿主升级线之间,使 nudge 只能出自宿主 override,正反两行分别钉「可达面必须顶上去」「不可达面必须保持静默」。
  5. 是否有回归问题:无。既有 30 个测试逐字节未变(默认参数保行为),未碰任何 src/ 文件,master 侧 4 个新提交与本 PR 触碰域零交集。
  6. 是否破坏缓存:不涉及(无运行时路径)。
  7. 是否改了设计方向:不涉及——纯粹把 根本原因立项:按 lane 名的大面积特判拷贝在 4 张 wire 适配器里各自漂移(#3293/#3401 同形 bug 家族),需要抽象重构 #3417 单点决策 + Three issues found during real-model stress testing: WS passthrough can't connect — HTTP upstream is guaranteed to die; | 真模型压测发现的三个问题:WS 直通连不上 HTTP 上游必死、超限时死锁+紧急提示风暴、compress 激活本身太重 #3461 override/backoff 的既有设计钉进测试。
  8. 是否引入了新的配置:不涉及。

判定:可合(待最后一个 CI shard 转绿;我已盯,结果出来补一条)。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

上一条说的最后一个 CI shard(ubuntu-latest node24 shard 1)已跑完:全量 CI 绿——check runs 合计 28 success + 12 skipped(gated e2e lane,按门跳过)+ 0 failure。本地定向 58/58 与此一致。

收工判定维持:可合。

@github-actions

Copy link
Copy Markdown
Contributor

📦 Merged Build Published

This merge to master was published as 0.0.553-master.50d9215 (rolling master tag).

npm install -g billion-context@0.0.553-master.50d9215  # 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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant