Repository navigation
fix: bili codex pins embedded mode via probed --no-daemon (#1867) - #2089
Conversation
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.2134-pr.2089.23f13ceThis exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr2089.tgz
npm install -g packageInstall instructions are refreshed on each push. |
10a4310 to
a88cb34
Compare
…aemon attach/bypass (#1867)
…1867) runClient plans the spawn via planClientSpawn BEFORE calling deps.spawnImpl — on win32 a .cmd fake arrives wrapped as 'comspec /d /s /c "<line>"', so the 'cmd === fakeCodex' capture guard never matched: the client child was a plain fake without the exit override and runClient's promise stayed pending forever, draining the event loop ('Promise resolution is still pending...') and cascading into every later test in the file. Match the embedded path instead and unwrap the comspec line back to client tokens with a quote-aware splitter (round-trips buildWindowsCommandLine), pinned by a platform-neutral round-trip unit test.
a88cb34 to
2fe98fd
Compare
PR #2089 审查完成 — 结论:可合(等最后 4 个 test job 转绿) 先过方向关(①原 issue):#1867 triage 已定位根因是会话级 proxy 与 codex 共享后台守护进程的生命周期错配,警告只是表面现象;owner floor 9 批准 Phase 0(probe 注入 结构化七问:
验证与历史(透明记录):
判定:可合,待 4 个 test job 转绿(重点 windows)。合并由人执行:#2089 |
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.7-master.d47f468 # this exact build
npm install -g billion-context@master # always the newest merged build
|
What & why
bili codexauto-injects-c model_context_window=… -c model_auto_compact_token_limit=…(#321 budget alignment). On Codex ≥0.156 those command-line overrides exclude the TUI from its shared background server (config_exclusion()incodex-rs/tui/src/daemon_startup.rs— the two budget keys are not on the allowlist), so every launch printsRunning without the shared background server: … requires embedded mode.and falls back to embedded.The fallback itself exposes the real defect: without any
-cinjection (user self-setmodel_context_window, or an unresolvable model) the TUI silently attaches to an existing shared daemon whose env was frozen at daemon start — all model traffic then bypasses bili's per-session proxy and compression silently stops working. And if bili cold-starts the daemon first, the surviving daemon keeps pointing at a proxy port that died with the session. The launcher's proxy is session-scoped by design, so embedded is the only deterministic run mode forbili codex.Per owner decision in #1867 (Phase 0, resident-proxy direction deferred): pin embedded explicitly instead of relying on the accidental exclusion.
Changes
src/launcher.tscodexSupportsNoDaemon(command, prefixArgs, platform)— probescodex --helpfor a line-anchored exact--no-daemonoption line; spawns throughplanClientSpawn(same cmd.exe-wrap parity asrunClient, [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); 5 s timeout; any failure defaults to false (injecting an unknown flag breaks the launch; skipping restores pre-probe behavior); cached per resolved command path. Mirrors theopencodeMajorVersion()precedent. UsesspawnSyncbecauseexecFileSyncoptions don't acceptwindowsVerbatimArguments(same rationale assrc/dsh-channel.ts).codexRunModePinned(args)— true when the user already passed--no-daemonor--remote [url]/--remote=url(codex hard-errors on--no-daemon+--remote).runLaunch(codex lane): when not pinned and the probe passes, prepend--no-daemonand log one line. Direct-URL mode untouched. The REQ: codex 压缩预算协调 + 匿名代理模式拦截伪造(根本解决方案) #321-cbudget injection is unchanged (embedded mode honors-cidentically).CLIENTS.md— Codex section: new "Run mode:bili codexpins embedded" note (why embedded, escape hatches, shared-server users run native codex).tests/launcher.test.ts— 4 regression tests: pinned-args truth table; probe unit test (flag present/absent/dead binary/missing binary/cache); runLaunch integration (fresh launch gets budget args AND--no-daemon; self-aligned window and unresolvable-model variants still get--no-daemon— the silent-bypass guard; user--no-daemonnot duplicated;--remotesuppresses); old-binary launch unchanged (probe fail-safe).Behavior change (intentional)
On Codex builds that support
--no-daemon(~≥0.156):bili codexrun mode changes from auto-selected (attach to / auto-start shared background server, with the per-launch fallback warning when budget args present) to explicitly embedded. The warning disappears; compression routing becomes deterministic in all cases. Older binaries are probed and launched unchanged. Users who pass--no-daemonor--remotethemselves are never touched.Config surface
None — no new config fields, env vars, or CLI flags. Capability detection is by probing the installed binary's own
--helpoutput; the only observable addition is one launcher log line (bili: codex pinned to embedded mode (--no-daemon) — …) when the flag is injected.Pre-flight
npm run typecheck— cleannode --import tsx --test tests/launcher.test.ts— 259/259 pass (incl. 4 new; pre-existing codex budget test unchanged and green)npm run build— successCloses #1867