Repository navigation
fix(#2827): route native fetch-chain diagnostics to bili.log instead of console.* - #2829
Conversation
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.3138-pr.2829.644ee40This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr2829.tgz
npm install -g packageInstall instructions are refreshed on each push. |
48ef4ac to
6461eff
Compare
[bot] 🏷 ## PR #2829 review 结论(已在当前 master head 上完成 rebase + 定向验证) 重复判定:已检索 open/closed issues+PRs,仅本 PR 引用 #2827,无重复项。 ① 原 issue 审核(方向关)— 通过#2827 证据充分:用户做了隔离复现 + 对照组(真实 TuiAltScreen/Editor、离线 fetch stub),4 个场景污染、对照组干净,且 ② 回归审查(既有行为清单)
高危模式逐项过:无语义漂移、无 fail-fast 变吞错(try/catch 仅包日志写入,主路径不受影响)、无阈值/时序/输出格式漂移。 ③ 代码审查
④ 测试有效性 — 真测试
⑤ diff 整洁度2 files +141/-28,每行都与本 PR 目的相关,无跑题文件、无空白重排、无生成物连带。✓ 验证证据(rebased head)PR base(master@47386e6f0)之后 master 前进了存储域提交(#2825 better-sqlite3 移除)与 v0.1.194 release merge( 结构化八问
分析中发现的新问题(已立项)其他 native 车道仍存在会话中途可能触发的 判定可合并(等本轮 CI 绿即可)。review 期间唯一动作为把分支 rebase 到当前 master head(内容零改动),CI 结果出来后如全绿,请人工合并。 |
…of console.* The four fetch-chain diagnostics (web-access adopt note, third-party install warning, #1410 re-anchor, #1662 re-entry) run inside the host agent process, where stdout/stderr IS the interactive TUI terminal. A console write lands on the physical screen bypassing the host renderer, so the pi-web-access coexistence note appeared appended to the Pi input box until the next redraw (#2827). All events now go through logChainEvent into the shared bili.log with the proxy's own line grammar ([v=...] [native-client] ...), following the established persistClientEvent pattern (dsh-native, #1158-era): best-effort append, reopen-by-path per call so proxy rotation cannot strand writes, never breaks the host. Message wording, severity levels and issue refs are unchanged; routing logic untouched.
6461eff to
aafdee6
Compare
[bot] 🏷 补充(状态更新):上一条 review 后 PR 头又前进了一个提交 当前 CI( 等这 4 个 test 矩阵任务转绿即可人工合并;若其中任何一个红了,我会定向排查并跟进。 |
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.301-master.56b3ca3 # this exact build
npm install -g billion-context@master # always the newest merged build
|
… shared host-safe helper Promote #2829's logChainEvent into a shared logHostEvent(level, origin, msg) in src/agent/host-log.ts and move every remaining mid-session console.* diagnostic in the native lanes onto it (terminal -> shared bili.log). Startup-time banners and the /acp render-failure notices (the host render IS the only user channel there) stay on the terminal by design. Message texts are byte-identical; only the channel changes.
Closes #2827
Problem
In Pi native / plugin mode (and every bili-native lane), the fetch-chain diagnostics fire INSIDE the host agent process, where stdout/stderr IS the interactive TUI terminal. The unconditional
console.logof the pi-web-access coexistence adopt note (#2435) landed on the physical screen bypassing Pi's renderer — text appeared appended to the input-box draft line until the next redraw (#2827).Fix
Route ALL FOUR fetch-chain diagnostics through a new
logChainEvent()into the shared bili.log (~/.local/state/billion-context/bili.log), following the establishedpersistClientEventpattern (dsh-native): best-effortappendFileSync, reopen-by-path per call so the proxy's rotation cannot strand writes, never breaks the host. Line grammar matches the proxy logger so mixed-version hosts self-identify each physical line:<ts> [info|warn] [v=<version>] [native-client] <msg>.Sites moved (wording, severity and issue refs unchanged; routing logic untouched):
Behavior change (intended, per issue request)
Old → new for every diagnostic above: written to host-process stdout/stderr (visible in the terminal, pollutes active TUIs) → written ONLY to the shared bili.log file (visible via the proxy Web UI / log file /
bili doctor; zero terminal traffic). This is the channel fix requested in #2827 ("送至宿主认可的 UI 安全日志通道、日志文件或真正的 debug-only 通道"). Diagnostic capability is preserved and more durable than console output that scrolls away under TUI redraws.Tests (tests/native-intercept-selfheal.test.ts)
[info] … [native-client] … adopted pi-web-access proxy fetch as downstreamline in the log, ZERO bytes on any terminal stream, repeat proxy scopes stay quiet, model routing intact.Local verification on rebased head (master @ 47386e6): typecheck clean; 128/128 across native-intercept-selfheal / native-intercept / issue1958-routed-warn / dsh-native suites; full build green. Full regression left to CI.
No config surface change. No kernel/ change.