Skip to content

test: add Windows codex overlay MCP-registration check (#686) - #688

Merged
ranxianglei merged 2 commits into
masterfrom
2026-09-10_windows-codex-overlay-ci
Sep 16, 2026
Merged

ranxianglei merged 2 commits into
masterfrom
2026-09-10_windows-codex-overlay-ci

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

What

Adds a windows-latest CI job + scripts/windows-codex-mcp-check.ps1 that closes the real-machine gap in #686: it confirms that codex accepts the <CODEX_HOME>-bili overlay produced by bili codex and registers the bili MCP server from it.

Why headless / key-free

bili codex mcp list starts the proxy, points CODEX_HOME at the generated overlay (win32), and forwards mcp list to codex. codex mcp list only reads config.toml and enumerates MCP servers -- it never calls a model -- so no E2E_UPSTREAM_* secrets are required. The existing secret-backed ubuntu e2e (ci-e2e.yml) still covers the full model round-trip; this adds the Windows MCP-registration layer for free.

How the script verifies

  • Asserts on codex stdout only (2>$null drops bili's own stderr log lines), so bili's own "injecting native bili MCP tools" line cannot cause a false positive.
  • Hard pass = mcp list shows bili; soft check = mcp get bili shows BILI_MCP_PROXY.
  • Writes a transcript artifact for reporting.

Pre-flight (run here, on Linux)

Review note

The verify step uses continue-on-error: true deliberately until one clean run proves codex boots unauthenticated on windows-latest (this agent runs on Linux and could not drive real Windows/codex). The transcript artifact shows exactly what happened so it can be flipped to a hard gate with confidence. This does not close #686 -- the interactive/compress-tool + concurrent-window acceptance items still need a human on a real box (step-by-step instructions posted in the issue thread).

Refs #686


中文摘要:新增一个 windows-latest 的无密钥 CI job(用 codex mcp list,只读配置、不调模型)来自动化验证"真机 codex 接受 CODEX_HOME overlay 并注册 bili MCP server"这一 #686 缺口;本机已验证 typecheck/build/launcher 测试全绿、空格路径产出合法 TOML、无需上游即可启动代理并转发 mcp list;verify 步骤暂设 continue-on-error,待一次干净运行后转硬门禁,供你评审拍板。

Headless, key-free verification for the real-machine gap in #686:
confirm that codex accepts the <CODEX_HOME>-bili overlay produced by
`bili codex` and registers the bili MCP server, on a hosted Windows
runner. Uses `codex mcp list` (reads config.toml only, never calls a
model) so no E2E_UPSTREAM_* secrets are needed.

Refs #686
@github-actions

github-actions Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-09-10_windows-codex-overlay-ci (1413fab)

Option A — Install from npm PR tag (recommended)

npm install -g billion-context@pr-688

Each push to this PR publishes a new version under the pr-688 npm tag.

Option B — Download artifact

  1. Download the artifact from the Actions run
  2. Extract the tarball and install:
tar xzf billion-context-pr688.tgz
npm install -g package

This comment is automatically updated on each push.

The verify script invokes 'bili' by bare name, but a workspace-local node_modules/.bin/bili is not on the GitHub Actions runner PATH (only 'npm run' scripts get it). Without a global link the prerequisite check exited 2 (MISSING) every time and continue-on-error masked it as a pass. Link the just-built package globally; dist is self-contained so this needs no extra fetch.
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 Reviewed PR #688 against its actual base (99fa258, which includes #679/#681/#682/#683) and the real pr-688 tree. Diff is clean — two new files only, zero changes to existing code.

Pre-flight claims verified (they hold up):

  • tsup bundles all runtime deps (noExternal: acp-kernel/fzstd/node-forge/tar/undici) → dist/index.js is self-contained, so a global install needs no extra fetch.
  • The win32 mechanism is present exactly as described: prepareCodexMcpInjection → <CODEX_HOME>-bili overlay carrying merged [mcp_servers.bili] + CODEX_HOME env-patch (src/launcher.ts:688, prepareCodexHome at :1319); quoteWinToken/buildWindowsCommandLine/planClientSpawn all intact ([bug] Windows: a space in the client or -e path truncates the launch (spawn shell:true, unquoted) — and silently kills compression when only the command is quoted #679).
  • BILI_LAUNCHER_PLUGIN=1 does force MCP injection (launcherInjectMcp, src/launcher.ts:618), so the check exercises the overlay path deterministically rather than relying on default heuristics.
  • Install/build steps match the existing ci.yml convention (which already runs --ignore-scripts + build on windows-latest), so no new build risk.
  • Stream contract holds: the child codex inherits stdio, bili's status lines go to stderr, and the ps1 asserts stdout only — correct, so bili's own "injecting native bili MCP tools" line can't cause a false positive.

Found one functional bug (fixed directly on the branch): the workflow builds the local package but never installs it globally, so bili was not on the runner PATH. A workspace-local node_modules/.bin/bili is not added to PATH by GitHub Actions (only npm run scripts get it prepended). As written, the ps1 prerequisite Get-Command bili would exit 2 (MISSING) every single time, and continue-on-error: true would mask that as a green pass — meaning the job proved nothing. Your Linux fake-codex harness wouldn't have caught this because it invokes bili differently than the CI wiring does.

Fix: added a npm install -g . step right after build (safe because dist is self-contained). Commit 1413fab pushed to 2026-09-10_windows-codex-overlay-ci; YAML re-validated (7 steps, correct order).

Kept as-is (intentional): continue-on-error: true stays until one clean run proves codex mcp list boots unauthenticated on windows-latest. I run on Linux and can't drive a real Windows/codex box, so I can't produce that proof myself — the transcript artifact will reveal whether codex demands auth before enumerating MCP servers. Once you see a clean PASS there, flip it to a hard gate. This still does not close #686 (interactive/compress-tool + concurrent-window acceptance need a human on a real machine).

Minor, non-blocking: the verify step shells out to powershell (Windows PowerShell 5.1) from within a pwsh (PS7) step. Harmless — and arguably deliberate for 5.1 semantics around #Requires/native redirection — but you could simplify to pwsh -File … if you prefer.

Not merging — that's your call. With the PATH fix in, the job should now actually exercise the overlay instead of silently no-op'ing.

中文摘要: 修复了 Windows CI job 找不到 bili(本地构建未做全局安装、不在 runner PATH 上)导致校验被 continue-on-error 掩盖成假绿的 bug —— 已在 PR 分支直接补了 npm install -g . 步骤(commit 1413fab);其余设计(无密钥 codex mcp list、仅断言 stdout、transcript 产物、暂留 continue-on-error 待一次干净运行后转硬门禁)均合理。待你在真机看到一次干净 PASS 后,此 PR 可合并。

@ranxianglei

Copy link
Copy Markdown
Owner Author

是否真的e2e?

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 分两层看,答案是「是,但只到它声称的那一层」。

这一层是真端到端(全程无 mock):
真 Windows runner + 真 @openai/codex 二进制 + 本 PR 分支构建的真 bili,完整跑通 win32 投递链:起代理 → prepareCodexHome 写出 <CODEX_HOME>-bili/config.toml(合并后的 [mcp_servers.bili])→ CODEX_HOME env-patch → .cmd shim 经 cmd.exe 的引号处理 → spawn codex → 真 codex 解析该 config.toml 并枚举出名为 bili 的 stdio server。OS、codex、config 文件、Windows 路径处理全是真的,没有模拟。所以针对「#686 的 CI 缺口=真机 codex 接受 overlay 并注册 bili MCP server」这个具体目标,它确实是端到端集成测试。

但它不是「完整对话回路」意义上的 e2e(这是刻意设计,不是缺陷):

  • 不调模型:mcp list 只读 config.toml,无密钥、无 LLM 请求。因此它不能证明压缩在 Windows 上真的工作。真正调模型的 e2e 在 secret-backed 的 ubuntu ci-e2e.yml(真 Responses upstream),而那条只在 ubuntu 跑 —— Windows 的模型回路目前没有自动化 e2e。
  • 不触发会话绑定:代码注释写得很清楚,stdio shell(dist/mcp.js,command=node)用 BILI_CONVERSATION_ID 自注册,「首个创建 NEW session 的真实模型请求」才消费该注册并绑定会话(src/launcher.ts:654-676)。mcp list 永远走不到那一步,所以 注册→绑定→原生工具调用 这条链没被这条 job 覆盖。
  • 交互式 / compress tool / 并发窗口(E2E verify on real Windows: codex accepts CODEX_HOME overlay and registers the bili MCP server (#681 / PR #683) #686 剩余验收项)无法在 CI 自动化,仍需真机人工。
  • 另外两点现状:目前它是观察性的(continue-on-error,尚未硬门禁);且在我修 PATH 之前它根本没跑起来(一直假绿)。

若想把它推得更接近真 e2e(可选,超出本 PR 范围,你拍板):
补一个同样无密钥的检查——直接 spawn node dist/mcp.js(带 BILI_MCP_PROXY/BILI_CONVERSATION_ID),经 stdin 发一个 MCP initialize JSON-RPC,断言能收到握手响应。这能验证「Windows 下 stdio shell 进程确实能拉起并应答」,正好补上 .cmd shim 引号那条最高风险的链路,且依旧不需要模型或密钥。要做的话我另开一个 commit 加进去。

一句话: 对「MCP 注册/配置接受」是真 e2e;对「模型回路 + 会话绑定」不是(后者靠 ubuntu e2e + 真机人工兜底)。

@ranxianglei
ranxianglei merged commit fb00f1b into master Sep 16, 2026
7 checks passed
This was referenced Sep 17, 2026
@ranxianglei
ranxianglei deleted the 2026-09-10_windows-codex-overlay-ci branch October 15, 2026 05:32
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.

E2E verify on real Windows: codex accepts CODEX_HOME overlay and registers the bili MCP server (#681 / PR #683)

1 participant