Repository navigation
fix(launcher): isolate launches on a random free port; drop proxy attach (#446) - #465
ranxianglei wants to merge 1 commit into
Conversation
…ach (#446) Launcher mode (`bili pi`, `bili codex`, ...) now always spawns its own proxy on a random free port instead of defaulting to 8787 and attaching to a running one. Root cause of the reported crash: the attach-or-spawn path (#394/#417) was keyed by the instance file, not the requested port, so two launchers could share one proxy. When one client exited, its stopProxy killed the shared proxy and took down every other launcher attached to it. - launcher: no explicit --port -> pickEphemeralPort() (OS-assigned free port); removed the attach-or-spawn share path + now-dead compat/probe helpers; stopProxy always kills its own child - server/instance: per-launchToken handshake report file so N concurrent isolated launchers don't clobber the single proxy-origin record; cleared on graceful shutdown. Retains the #407 EADDRINUSE-retry self-bind handshake - standalone `bili start` is unchanged (still defaults to 8787) — explicit sharing happens there, per the owner's direction Pre-flight: typecheck + build clean; npm test 913/914 (only the pre-existing resolveClientCommand environment failure).
📦 Built Package ArtifactBranch: Option A — Install from npm PR tag (recommended)npm install -g billion-context@pr-465Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf billion-context-pr465.tgz
npm install -g packageThis comment is automatically updated on each push. |
[bot] 🏷 Review of #465 — LGTM, no blockers. Two minor notes at the end. Root cause & approach — verified correct. The old attach-or-spawn path decided share-vs-spawn by reading the shared Verified on
Pre-flights I ran:
Minor notes (non-blocking):
Happy to push the one-line indent fix onto this branch if you want it included. |
Closing as superseded by #526 (plan 1: port isolation only).
This PR over-interpreted 「启动器模式都是隔离」 as process isolation — dropping the #417 attach-or-spawn share path and adding per-token handshake files. Per the issue thread, the intent was port isolation only: launcher proxies shouldn't squat on 8787, but a healthy compatible instance (including an explicitly-started
bili start) should still be attached, keeping the single-writer property #417 was built for.The crash-root-cause narrative here also predates part of #417's guards; the residual owner-exit cascade was accepted in the issue thread. Thanks for the groundwork — the ephemeral-port portion lives on in #526.