Repository navigation
fix: route attach startup banners through the host-safe diag channel (#3404) - #3415
Conversation
…3404) The two normal-startup banners in ensureProxyRunning (attachTo's 'attaching to running proxy' and waitForOtherStarter's 'another bili launch ...') went out through raw console.error. In native host processes (pi/omp/dsh lanes) stderr IS the TUI screen — host-log.ts documents that a raw console.* write lands on the physical cursor line, e.g. Pi's input draft after herdr session restore. Route both through the #3200 defaultAttachDiag channel instead: durable log file by default, one controlled stderr copy under explicit debug. Message text, origin/PID detail, watcher registration and all attach/spawn/lifecycle logic are unchanged; failure-path console.error lines (gate refusals, squatter announcements, child-death notices) stay visible. Regression tests pin: non-debug attach/wait emit zero terminal bytes with the banners in bili.log; debug emits exactly one controlled copy; user-actionable gate refusals still reach the terminal.
…e channel too (#3404) Same-mechanism sweep found while implementing #3404: rediscoverAfterChildExit's successful-attach announcement ('bili: attached to ... after the initial discovery') was a third raw console.error success banner in the same function — same class as attachTo, same TUI-pollution risk on host lanes. Converted to the shared attachDiag channel with its own regression test; the adjacent child-death failure notice deliberately stays visible.
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.4012-pr.3415.4e30488This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr3415.tgz
npm install -g packageInstall instructions are refreshed on each push. |
(ai: vllm-qwen/qwen3.8-27b) PR review(独立重审,未沿用 #3404 线程结论) 查重: 不重复。 这是 #3404 的唯一实现 PR;近期 open/closed PR 中无其他触碰这三条 banner 或 独立验证过程:拉取分支逐行读 diff(对照改动前代码);核对 按八问:
行为变更复核(旧→新,PR 描述准确):三条 banner 默认从「总是上 stderr」改为「只写 测试有效性:5 条新测试断言有牙——回退到 判定:可合并(CI 绿、base 无冲突、diff 干净每行相关;合并由人工执行)。 |
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.563-master.f5fee79 # this exact build
npm install -g billion-context@master # always the newest merged build
|
Closes #3404
What
The two remaining startup banners in
ensureProxyRunningwent out through rawconsole.error:attachTo():bili: attaching to running proxy at <origin> (pid <pid>)waitForOtherStarter():bili: another bili launch is bringing up a proxy — waiting for it instead of spawning a secondIn native host processes (pi/omp/dsh lanes) stderr IS the TUI screen —
src/agent/host-log.tsdocuments that a rawconsole.*write lands on the physical cursor line bypassing the host renderer (e.g. Pi's input draft after herdr session restore, the #3404 screenshot). A healthy attach needs no user action, so both banners now ride the #3200 host-safe channel (defaultAttachDiag): durable log file by default, one controlled stderr copy under explicit debug. Message text, origin/PID detail, watcher registration and all attach/spawn/lifecycle logic are unchanged.Behavior change (deliberate, disclosed per policy)
Old -> new for these banners: before they were always written to process stderr (visible in host TUIs AND CLI terminals); after they go to the durable log file (
~/.local/state/billion-context/bili.log) by default, with a stderr copy ONLY when launched with explicit debug (host lanes hard-codedebug:falseand stay silent; CLI--debugkeeps seeing them). Reason: in-host raw terminal writes corrupt the rendered UI (#2827/#2831 mechanism), and normal startup progress is not user-actionable. User-actionable output is UNTOUCHED — gate refusals (#1335), squatter announcements (#1753), child-death/slow-start/killed-child notices all keep their visible channels; a new test pins that boundary.Same-mechanism sweep (second commit)
While implementing #3404 I found a third instance of the same class:
rediscoverAfterChildExit()'s successful-attach announcement (bili: attached to ... after the initial discovery, src/launcher.ts:4304 pre-fix) — converted the same way, own labeled commit + regression test. Its adjacent FAILURE notice (spawned proxy exited before becoming healthy — re-checking...) deliberately stays visible.Not changed
attach/spawn selection, compatibility checks, shared-proxy dedup, lifecycle logic; no global console mute; no config surface change; no kernel/pi-subagents change; no version bump.
Regression tests (tests/launcher.test.ts)
attaching to running proxy at ... (pid ...), watcher registration unchanged;Local: typecheck clean, targeted
tests/launcher.test.ts307 pass / 0 fail; full-suite verdict = CI.查重: 无(与 #2827/#2831、#3200/#3210 的区别见 issue 正文)。