Repository navigation
fix(launcher): handle async spawn 'error' in ensureProxyRunning (#835) - #838
ranxianglei wants to merge 1 commit into
Conversation
ensureProxyRunning registered only child.on('exit'), never 'error'. An async spawn failure (EACCES/ENOENT on a mis-resolved runtime) emits 'error', which with no listener becomes an uncaughtException that kills the host process, while the poll loop burns the full SPAWN_WAIT_MS and misreports 'proxy did not become healthy'. runClient already handled 'error' correctly; the proxy-spawn path did not.
Register an 'error' handler, break the poll on it, and reject with the spawn cause ('bili: proxy spawn failed (<detail>)'). Regression test added to tests/launcher.test.ts (asserts an 'error' handler is registered + rejects 'spawn failed').
Found as finding D of #809 while hands-on testing #824; the identical change already lives in open PR #824 (which targets feat/pi-native-plugin, not master). This brings it forward to master independently so the defect is closed on the mainline. Fixes #835.
📦 Built Package ArtifactBranch: Option A — Install from npm PR tag (recommended)npm install -g billion-context@pr-838Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf billion-context-pr838.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 Review in progress. Pulled branch
Currently running independent local verification (typecheck / test / build) on the branch before giving the final verdict. |
[bot] 🏷 Review complete — approved, ready for human merge. Bug verification (triage before review)
Fix quality
Diff cleanliness: single commit Provenance check: verified via API — #824 is open with base CI: 7/7 green on the head commit (ubuntu 22/24, windows 22/24, codex e2e zero-token preflight, build-artifact, version-guard). Independent local verification (checked out the branch): No issues found that needed fixing on the branch. Merge is human-only per repo rules: #838 中文摘要:修复了 |
|
继续 |
|
Closing as superseded — the fix landed on master via the #809/#824 spawn-failure work:
Nothing in this PR's diff remains un-merged. (Queue triage per #1020.) |
What & why
ensureProxyRunning(src/launcher.ts) registered onlychild.on("exit"), neverchild.on("error"). An async spawn failure — EACCES/ENOENT on a mis-resolved runtime (e.g. a badBILLION_CONTEXT_NODEor an exotic runtime path) — emits'error', not'exit'. With no listener, Node turns that unhandled'error'into anuncaughtExceptionthat kills the hosting process, while the poll loop keeps burning the fullSPAWN_WAIT_MSand then misreports "proxy did not become healthy".runClientalready handled'error'correctly; only the proxy-spawn path was missing it. This is shared code — it affects every launcher that spawns the proxy (pi/omp/opencode/codex/…), not just one client. A narrow trigger (bad runtime resolution) escalates into killing the launching client.Change
child.on("error")handler inensureProxyRunning.childExitorchildErroris set — fail fast instead of burning the window.bili: proxy spawn failed (<detail>) (log: <path>).tests/launcher.test.ts: asserts an'error'handler is registered on the spawned child and thatensureProxyRunningrejects withspawn failedwhen the child emits an async spawn error.Pre-flight
npm run typecheck— cleannpm test— 1650 tests, 1648 pass, 0 fail, 2 skipped (pre-existing skips)npm run build— successProvenance / overlap
Found as finding D of #809 while hands-on testing the OpenCode npm-plugin deployment. The identical fix already exists in open PR #824 (commit
54f8fb2), but #824 targets thefeat/pi-native-pluginbranch (base ≠ master), so the defect is still live on master and in every published release. This PR brings the D-fix forward to master independently so the bug is closed on the mainline. The N4 mcp-guard half of that commit is a separate finding (#809 N4) and is intentionally out of scope here.Fixes #835.