Repository navigation
feat: surface active advisories in acp_status, /acp panel and bili doctor (#1577) - #1585
Conversation
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.1858-pr.1585.c5ed5d8This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr1585.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 Review complete — verified against current master, one hardening commit added during review (head is now Base freshness. merge-base of the PR head and master = ① Original issue (#1577) — direction correct. The diagnosis holds: native/plugin lanes spawn the proxy child with stdio→log fd on an ephemeral port, so the stderr warn, web banner and ② Regression audit — existing behaviors on touched paths, each verdict:
③ Code review — found and fixed one defect (commit ④ Test validity. All four surfaces are pinned with teeth: panel test asserts the clean case stays advisory-free AND the active line sits before the footer (stripper invariant); ⑤ Diff cleanliness. 9 files, +300/−3, every line serves the stated purpose; no whitespace churn, no generated/lockfile drift. My follow-up commit is +13/−1, clearly labeled. Behavior changes — confirming the PR's disclosure, plus two honest addenda:
Pre-flight on the new head (local): typecheck clean · full suite 3058 pass / 0 fail / 12 skip · tsup build success. CI was 12/12 green on the previous head; re-running on Verdict: mergeable once CI is green on 中文摘要:审查了 advisory 可见性 PR(acp_status / /acp 面板 / bili doctor 三个表面),方向正确、既有行为全部保持;发现并直接修复了一个远程公告文本中 |
[bot] 🏷 CI confirmed green on |
…ctor (#1577) In native/plugin lanes (bili pi, opencode/dsh plugin) the proxy child runs on an ephemeral port with stdio->log fd, so #1483's advisory loud channels -- stderr warn line, Web UI banner, /__bili/status -- are all unreachable by the user. The force-install still works; what was missing was visibility. Adds three human-facing surfaces for an active instance-level advisory: acp_status + the /acp panel gain an instance-level section (mirrors the #897 UNDECRYPTED TRAFFIC pattern; the /acp line is inserted before PANEL_BOX_FOOTER so the LLM-context stripper still matches, byte-exact when no advisory), and bili doctor gains one advisory line (active reason+manual cmd / none / check-failed unknown). Shared describeAdvisory() wording plus read-only evaluateAdvisories() used by doctor (it runs in its own process with no watcher, so it evaluates against the disk version). No wire/turn injection (visibility only, per non-goal); no new config fields.
…t renders verbatim (#1577) The /acp panel inserts the pre-footer block through String.replace(FOOTER, replacement); $ sequences in the replacement are pattern syntax ($& = matched footer, \$\$ = text before match, $' = after). Advisory reason/id come from the remote advisory doc, so a $ sequence there would corrupt the rendered line (e.g. $& splices the footer text into the advisory sentence) — this is the first dynamic content flowing into that replacement string. Escape each $ to $$$. Byte-identical output for all inputs without $ (Web UI URLs never contain any). Regression test pins a $5M/$& reason rendering verbatim with the footer appearing exactly once.
a84bb7e to
8c3bb96
Compare
Closes #1577
What & why
#1483's advisory mechanism (broken-version detection + force-install) works end-to-end in native/plugin lanes — the watcher lives in the spawned proxy child. But all of its loud channels are unreachable there:
ensureProxyRunning(src/launcher.ts) spawns the child withstdio:["ignore",logFd,logFd]on an ephemeral port, so the stderr warn line, the Web UI banner and/__bili/statusall land somewhere the user never looks. The/acppanel is the one surface a native-lane user actually sees, and it had no advisory section.This adds human-facing visibility for an active instance-level advisory, without touching the wire:
acp_statusgains an instance-levelCRITICAL ADVISORYsection while one is active — same pattern as the existingUNDECRYPTED TRAFFIC (instance-level)(CodeBuddy 直接使用httpProxy 不能压缩上下文的问题 #897)./acppanel gains a⚠️ CRITICAL ADVISORY:line, inserted beforePANEL_BOX_FOOTERso the LLM-context stripper (which anchors its whole-message match on that footer) still matches; byte-exact when no advisory is active.bili doctorreports oneadvisoryline: active reason + manual command /none/check failed (…) — status unknown. Doctor runs in its own process with no watcher, so it performs a read-onlyevaluateAdvisories()against the disk version (no install side effects — doctor never writes).Shared wording lives in a new
describeAdvisory();evaluateAdvisories()is a self-contained, fail-open, state-free variant so the load-bearingrunAdvisoryCheckforce-install path stays byte-stable.Config surface
No new fields. This only reads the already-resolved
advisoryUrl(BILI_ADVISORY_URL/advisory.advisoryUrl, both introduced by #1483) in the doctor path. Nothing is added, renamed, or re-semantics'd.Behavior changes (flagged per policy)
All three are additive and gated on an active advisory; when none is active every output is byte-identical to before:
bili doctor: the global section gains oneadvisoryline (previously absent). Unreachable/malformed source →check failed (…) — status unknown, exit 0 (fail-open). Old→new: no line → one line.acp_statusoutput: gains aCRITICAL ADVISORY (instance-level): …section only while active./acppanel: gains a⚠️ CRITICAL ADVISORY: …line before the footer only while active.No wire/turn injection (the stated non-goal): these are on-demand diagnostic surfaces for humans, not model context.
Design decision — optional item #3 skipped
The issue's optional
bili advisory statussubcommand was deliberately not added:bili doctor --jsonalready exposes the advisory as scriptable structured output, and a dedicated subcommand would duplicate that without a distinct use case. Happy to add it if you'd prefer the explicit verb.Pre-flight (rebased onto current master
e258bc80= v0.1.166 + relanded #1483)npm run typecheck— cleannpm test— 3058 pass / 0 fail / 12 skipnpm run build(tsup) — successtests/advisory-panel.test.ts(/acp panel before-footer insertion + byte-exact clean case), plus cases intests/advisory.test.ts(evaluateAdvisories/describeAdvisory),tests/acp-status.test.ts(acp_status section),tests/doctor.test.ts(doctor line incl. fail-open).