Skip to content

[PR] fix(diagnostics): register the attribution topic the banner already reports to - #7054

Merged
ranxianglei merged 1 commit into
masterfrom
2026-11-17_attribution-diagnostics-topic
Nov 17, 2026
Merged

ranxianglei merged 1 commit into
masterfrom
2026-11-17_attribution-diagnostics-topic

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

What

The takeover-attribution banner (added in #3581, report buttons in #3651) ships "copy diagnostics / report on GitHub" buttons wired to topic=attribution. But attribution was never registered in the diagnostics TOPICS map, so buildDiagnostics("attribution") fell back to the generic title and printed topic: attribution (no topic-specific section registered). The report a user copies into a GitHub issue therefore carried none of the attribution evidence a maintainer needs to adjudicate a takeover-broken episode — which agent degraded, its state, refusal count, the error text, and the endpoint.

This is exactly what the reporter's issue shows: the blob has the generic title and the "no topic-specific section registered" line, with no --- takeover attribution --- section.

Fix

Register the attribution topic in src/web/diagnostics.ts with a section that renders the latest per-agent attribution report from attributionStatusWire() (src/server/attribution-status.ts):

  • per-agent state / refusals / since
  • the error text (threw episodes) and the masked endpoint
  • the banner policy + remedy note

The host-supplied error/endpoint bytes pass the sink-level redactForPublish like every other section, so no per-field scrubbing is needed upstream.

Also updated the stale facility header comment to list all four consumers.

Tests

New tests/web-diagnostics-attribution-topic.test.ts pins:

  • the registered topic produces the specific title + section (not the generic fallback)
  • the empty-map note
  • the per-agent line shape (state/refusals/since/error/endpoint)
  • the URL round-trip
  • the publish-boundary redaction of the error text

Targeted suites green: the new test + web-diagnostics-enrichment + issue3581-attribution-health. npm run typecheck and npm run build pass.

Config surface

None — no config field, env var, or CLI flag added.

Model-facing text

None — the diagnostics blob is copied into a GitHub issue by a human; the model never sees it.

Closes #7053

…eports to

The takeover-attribution banner (src/web/client.ts, #3581/#3651) ships
"copy diagnostics / report on GitHub" buttons wired to topic=attribution,
but that topic was never registered in the diagnostics TOPICS map — the
blob fell back to the generic title and printed "topic: attribution (no
topic-specific section registered)", so the report carried none of the
attribution evidence (which agent degraded, state, refusals, error,
endpoint) a maintainer needs to adjudicate a takeover-broken episode.

Register the topic with a section that renders the latest per-agent
attribution report (attributionStatusWire): state/refusals/since per
agent, the error text (threw episodes) and the masked endpoint, plus the
banner policy + remedy note. The host-supplied error/endpoint bytes pass
the sink-level redactForPublish like every other section, so no
per-field scrubbing is needed upstream.

Regression test pins the registered topic (specific title + section, not
the generic fallback), the empty-map note, the per-agent line shape, and
the publish-boundary redaction of the error text.

Closes #7053
@ranxianglei ranxianglei added bug Something isn't working p2 scope/ui labels Nov 17, 2026
@ranxianglei ranxianglei changed the title fix(diagnostics): register the attribution topic the banner already reports to [PR] fix(diagnostics): register the attribution topic the banner already reports to Nov 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-11-17_attribution-diagnostics-topic (b21a76d)

Latest build — install this exact version

npm install -g billion-context@0.0.10628-pr.7054.57bea2f

This exact version is immutable and reproducible. The rolling pr tag tracks the newest test build across all PRs.

Recent builds (commit → version)

commit version build
b21a76d billion-context@0.0.10628-pr.7054.57bea2f build

Download artifact

  1. Download the artifact from the Actions run
  2. Extract the tarball and install:
tar xzf billion-context-pr7054.tgz
npm install -g package

Install instructions are refreshed on each push.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

Reviewed PR #7054 against current master. The fix is correct, the regression test has real teeth, and the diff is clean.

Verified

  • Code (src/web/diagnostics.ts): registers attribution in TOPICS with a specific title + a section rendering the latest per-agent report from attributionStatusWire() — per-agent state/refusals/since, the error text (threw episodes) + masked endpoint, plus banner policy + remedy note. Empty map degrades to an explicit "no diagnosable failure observed" note, not a blank. Error is redacted per-field (so the 500-char truncation lands on the redacted length) and the whole blob passes the sink-level redactForPublish — same guarantee as every other section.
  • Tests: tests/web-diagnostics-attribution-topic.test.ts (2 subtests) + web-diagnostics-enrichment + issue3581-attribution-health — green locally (9 pass / 0 fail). The new test asserts the specific title (not the generic fallback), the --- takeover attribution --- section, the per-agent line shape, <private-host> endpoint masking (raw relay.example.com must not survive), and that a credential-shaped error value (sk-live-…) is scrubbed at the publish boundary.
  • npm run typecheck — exit 0.
  • CI (head b21a76db): static-gates (ubuntu24/windows22) ✅, mysql-contract ✅, 11 test shards in_progress, 16 e2e lanes skipped (gated). No failures so far.

Regression review (existing behaviors in the touched path)

  • Purely additive: one new TOPICS entry + one new attributionDiagnosticsLines() + one new test file. The three pre-existing topics (storage-legacy-only, snapshot-shadow, conflict-banner) and the generic fallback are untouched. The only non-additive edit is the facility header comment (docs — now lists all four consumers). No wire / config / persistence / kernel change.

Auto-merge gate (§7.4): all green — single-module, regression test present, no config/wire/kernel touch, pure fix:, clean 2-file diff, references #7053. CI test shards still running; once green, ready for owner merge (merge is human-only).

结构化八问

  1. 是什么问题: 接管归因横幅的「复制诊断 / 上报 GitHub」按钮指向 topic=attribution,但这个 topic 从没在诊断 TOPICS 表里注册——用户复制出的报告只有通用标题加一行 "no topic-specific section registered",完全缺了维护者判定一次 takeover 故障所需的证据(哪个 agent 降级、状态、拒绝次数、报错文本、endpoint)。
  2. 什么原因导致的: 横幅(压缩接管失效后完全静默:面板与 /__bili/status 看不出压缩已停,用户全价直连直到重启才恢复 #3581)和上报按钮(Model request is connecting directly (uncompressed) | 模型请求正在直连(不压缩) #3651)加进来时引用了 topic=attribution,但对应的 TOPICS 注册项漏加了——是「漏注册」,不是逻辑 bug;buildDiagnostics("attribution") 落到了通用兜底分支。
  3. 影响范围与严重程度: 任何遇到 takeover 故障(throw)后点「上报」的用户,复制出的诊断块都没有归因段,维护者无法仅凭报告判定该 episode。触发条件 = takeover 故障 + 用户点上报。严重度 p3:横幅本身照常工作(可见性没坏),只是复制出的报告少了证据段,是「可诊断性缺口」,不是可用性破坏。
  4. 怎么修复的: 在 TOPICS 注册 attribution topic,配一个专门 section 渲染 attributionStatusWire() 里最新的 per-agent 报告:每个 agent 的 state/refusals/since、threw episode 的报错文本 + 掩码 endpoint、外加横幅策略 + 处置建议。报错先做字段级 redact(500 字截断落在 redact 后长度上),整块再过 sink 级 redactForPublish(host 掩成 <private-host>、凭据形态被清)——和其它 section 同一套保证。
  5. 是否有回归问题: 无。改动纯增量(一个新 topic 项 + 一个新函数 + 一个新测试文件);三个既有 topic 和通用兜底都没动,唯一非增量处是设施头注释(文档)。没碰 wire/config/persistence/kernel。typecheck 绿、定向测试绿。
  6. 是否破坏缓存: 不涉及——没碰任何缓存/重试/游标/去重逻辑。
  7. 是否改了设计方向: 没有。完全沿用既有诊断 topic 设施(一个 topic = 一个标题 + 一个 section,sink 级 redact),无新架构或新数据流。
  8. 是否引入了新的配置: 没有——无新 config 字段、env、CLI flag(500 字报错上限是内部具名常量,非用户可调项)。

合并判定: 可合。CI 测试分片仍在跑(static-gates + mysql-contract 已绿),转绿后等 owner 合并(合并仅人工)。

@ranxianglei
ranxianglei merged commit 30fb448 into master Nov 17, 2026
84 of 120 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

📦 Merged Build Published

This merge to master was published as 0.0.1222-master.30fb448 (rolling master tag).

npm install -g billion-context@0.0.1222-master.30fb448  # this exact build
npm install -g billion-context@master  # always the newest merged build

npm view billion-context@master prints the current version at any time.

ranxianglei pushed a commit that referenced this pull request Nov 17, 2026
Master advanced 33 commits (v0.1.216 release, #7054 attribution diagnostics,
#6592 dsh-go-client docs, #6922 responses section joiner, #4313
timestamp-rendering default flip, …). Overlap on 2 of the PR's 6 files:
relay.ts auto-merged cleanly (PR's armFailureShrink sidePassthrough gate at
the function top vs master's createHandoffReply signature change — disjoint
regions, both intents kept). The one conflict,
tests/issue2929-codex-fold-double-miss.test.ts, resolved by taking master's
version: master rewrote the probe to arm SCHEDULE-INDEPENDENTLY (first
nudge-carrying request with >=11 refs), which supersedes this branch's
anchor recalibration (0bea490, 6/7 -> 7/8) — a hardcoded index anchor
broke on every nudge-gate schedule shift and the schedule-independent
arming is the durable fix. Verified locally: 2929 + issue4974 +
side-lane-invariants = 21/21 pass; typecheck clean.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working p2 scope/ui

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bili diagnostics report (v0.1.216, node v24.21.0, win32-x64)

1 participant