Skip to content

fix: 修掉 #3088/#3112 引入的两个测试回归(#3166 合并树 CI 暴露) - #3172

Closed
ranxianglei wants to merge 2 commits into
masterfrom
2026-10-14_master-ci-repair
Closed

ranxianglei wants to merge 2 commits into
masterfrom
2026-10-14_master-ci-repair

Conversation

@ranxianglei

@ranxianglei ranxianglei commented Oct 14, 2026 •

Copy link
Copy Markdown
Owner

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

来源: #3166 review 时发现(master 侧缺陷,与 #3166 的存储改动无关——#3166 未触碰本 PR 涉及的任何文件)

是什么问题

master 今天合入的 #3088(guardrails 迁移)和 #3112(test-suite-lock)各自带坏了一个既有测试。master 自己的 push-CI 按 #2637 分层设计跳过 test 车道(skipped 视为 satisfied),全量套件只在 PR 合并树上跑——所以这两个回归在 master 上是「绿灯不可见」,直到 #3166 的合并树运行把它们顶出来:

  1. #2185: factory wiring 确定性崩溃(ubuntu/windows × node22/24 四腿全红):Migrate pi tool-output guardrails from billion-context-pi (#3066) #3088 把 wireToolGuardrails(pi) 无条件接进 createBiliPlugin,其 input/session_shutdown/tool_call handler 读 ctx.sessionManager?.… 却没防 ctx 本身为 undefined;而 factory 测试按 harness 约定用 ctx=undefined 触发 session_shutdown → TypeError: Cannot read properties of undefined (reading 'sessionManager')(src/agent/tool-guardrails.ts:292)。纯 master 本地复现同样失败。
  2. resolveLockPath mirrors paths.ts cacheDir() Windows 断言失败(win 腿):实现里 path.resolve(XDG_CACHE_HOME) 与 paths.ts xdg() 完全一致(mirror 是对的),但测试期望值用 join() 计算——Linux 上两者恰好相等,Windows 上 POSIX 风格路径会解析到当前盘符(D:\tmp\x\… vs \tmp\x\…)→ 每个 Windows 腿必挂。

怎么修的(两个独立 commit)

  1. guardrail 三个 handler 的 ctx 读取全部 null-safe(ctx?./!ctx ||);bash timeout 注入不依赖 ctx,保持先行。ctx 存在时行为零变化(真实宿主永远传 ctx),只消灭崩溃路径。
  2. 测试期望改用 resolve() 计算,跨平台钉住 mirror 语义;实现与锁文件位置不变,纯测试修正。

验证

本地定向:pi-subagent-registry 10/10、tool-guardrails-pi 35/35、test-suite-lock 16/16(共 61/61);typecheck 0 错。全量交给 CI。

行为变更披露

仅一处且属修复而非漂移:事件不带 context 时,guardrail 从「抛 TypeError」变为「该事件 no-op」。ctx 存在的路径无任何变化。无 config/kernel/wire/version 变更。

对 #3166 的意义

此 PR 合入 master 后,#3166 下一次 CI(新 push 或 re-run 都会重算合并树)即可转绿;在此之前 #3166 的 test 车道红是这两个 master 回归,不是它的存储改动。

记录 issue:#3173(带 [no-dispatch],owner 直接合并本 PR 即可)。

awork added 2 commits October 14, 2026 19:53
#3088 wired wireToolGuardrails unconditionally into createBiliPlugin, and its
input/session_shutdown/tool_call handlers read ctx.sessionManager without
guarding ctx itself. The #2185 factory test fires session_shutdown with
ctx=undefined (harness contract), so every pi plugin instance crashed the
moment that event fired — deterministic red across all four OS/node legs of
any merge-tree CI run. Null-safe reads change nothing when a context IS
present (the real host always passes one); they only stop the crash.
…in32 (#3166 review)

#3112's resolveLockPath does path.resolve(XDG_CACHE_HOME) exactly like
paths.ts xdg() does — the mirror is correct. But the test computed its
expectation with join(), which only agrees on Linux: on win32 a POSIX-style
value resolves against the current drive, so the assertion failed on every
Windows leg. Expect via resolve() so the mirror is pinned cross-platform;
the implementation (and thus the lock file location) is unchanged.
@github-actions

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-10-14_master-ci-repair (ac43a9d)

Option A — Install this exact build (recommended)

npm install -g billion-context@0.0.3635-pr.3172.a52d740

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

判定:与 #3170 完全重复,本 issue 关闭。

共同点一句话:#3172 与 #3170 报告的是同两个 master 侧测试缺陷、同一组根因、同一套修法——唯一差异是发现入口(本 issue 出自 #3166 review,#3170 出自 #3163 review),缺陷清单无新增项。

独立核验(非照抄 issue 结论):

  1. 在纯净 origin/master 7f96abe0d 本地复现了缺陷①:tests/pi-subagent-registry.test.ts 的 "[pi] native 模式第三方 pi-subagents 深度测试与修复:extension registry 自注册(方案 A)落地 #2185: factory wiring — session_start self-registers, session_shutdown disposes" 确定性失败,TypeError: Cannot read properties of undefined (reading 'sessionManager') @ src/agent/tool-guardrails.ts:292 —— 与本 issue 描述逐字一致(其余 9 项通过)。
  2. 缺陷②按构造确认:scripts/test-suite-lock.mjs:48 的实现用 path.resolve(XDG_CACHE_HOME),与 src/paths.ts 的 xdg()(path.resolve(v))完全一致——mirror 是对的;测试期望值却用 join() 拼 POSIX 字面量 /tmp/x/cache-home,Linux 上两者恰好相等、Windows 上 POSIX 风格路径会解析到当前盘符必挂。本地 Linux 跑该文件 16/16 绿,与「仅 win 腿红」的描述吻合。
  3. 既有修复 PR #3171(挂 master 侧两个测试缺陷把每个 PR 的 CI 测试通道卡红(pi 工厂测试必崩 + 测试锁路径断言不兼容 Windows) #3170)已完整覆盖范围,diff 已逐行核对:tool_call/input/session_shutdown 三个 handler 共 5 处 ctx 直读全部 null-safe(bash timeout 注入不依赖 ctx,保持先行);锁路径测试把 fixture 从 POSIX 字面量改为 tmpdir() 原生绝对路径(与本 issue 建议的「期望值改用 resolve()」效果等价,且不用在测试里复刻实现语义);另新增回归测试钉住「ctx 缺失时三 handler 不抛错、且第 5 次相同调用仍被 block」。
  4. PR fix: guard pi tool-guardrails against undefined ctx + Windows-safe lock-path test (#3170) #3171 当前 CI:24 个 check 处于 queued/in_progress(push 后重算中),尚无最终结论;全量裁定以该 head 的远程 CI 为准。其合并后,fix: per-session ingest watermark — storage saves cost O(new messages), not O(full log) (#3133) #3166 及所有在途 PR 的合并树 CI 即转绿。

处置: 本 issue 打 duplicate 标签并关闭;工作统一在 #3170 + PR #3171 跟踪(PR 正文含 Closes #3170,合并自动收口)。不再为本 issue 另提第二个 PR 修同样两处——重复修复会在同一批文件上互相冲突,后合者变成噪音。

@ranxianglei ranxianglei added the duplicate This issue or pull request already exists label Oct 14, 2026
@ranxianglei

Copy link
Copy Markdown
Owner Author

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

本 PR 的两个修复已由 #3171 先行合入 master(c776b5a ① undefined-ctx 容错 + 44a6460 ② resolveLockPath fixture 平台中性化 + 17b5186 follow-up 断言钉住),与本分支同题同修。按重复纪律关闭:#3170 为记录 issue,本 PR 与其 #3173 均为重复立项。#3166 已 rebase 到含 #3171 的 master 978e27d。

@ranxianglei
ranxianglei deleted the 2026-10-14_master-ci-repair branch October 14, 2026 12:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

duplicate This issue or pull request already exists

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant