Repository navigation
feat: make takeover-attribution failures visible (panel + /__bili/status) | 压缩接管失效可见化 - #3593
Conversation
When a host plugin's injection breaks at runtime (#3578 shape: disposed agent scope after a version swap), model traffic silently goes direct and uncompressed until the host restarts — requests succeed, sessions never register, tools 404, and the panel just shows "0 running". - /__bili/status + /__bili/overview gain an additive `attribution` field: per-agent { state: ok|none|threw, refusals, since }, latest report wins (src/server/attribution-status.ts, mirrors runtime-status.ts). - New loopback endpoint POST /__bili/plugin/attribution accepts the reports (validated; 400 on malformed bodies). - The dsh-native gate reports event-driven only: first refusal, state change, refusal-count doubling, give-up latch, recovery. Healthy lanes never POST — zero healthy-path overhead, no polling, no per-request disk writes. - Give-up latch: after giveUpStreak=3 consecutive requests whose settle-retry exhausted still threw, the gate stops re-settling (a disposed ctx stays disposed for the host's lifetime, #3578); the per-request attributionOf probe keeps self-heal alive. - Web panel: new attribution banner when an agent is degraded AND no session is live; stale-banner wording now says "restart the host" (injected code lives in the host process). - Docs: README/AGENTS auto-update sections state that injected code only takes effect after a HOST restart.
6641d29 to
3e0fe5a
Compare
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.4245-pr.3593.4c4d0d2This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr3593.tgz
npm install -g packageInstall instructions are refreshed on each push. |
(ai: vllm-qwen/qwen3.8-27b) 查重:不重复。 检索了 open/closed issue 与 PR(关键词 attribution / 接管 / 可见化):本 PR 是「压缩接管失效可见化」(#3581)的唯一在途实现。最接近的邻居都不重叠——#3595 只改 dead-scope 拒绝文案、不碰可见化面;#2940(已合并)是本 PR 在其上扩展的 settle-retry 机制;#3333 是 acp-cache 报告面,不同域。无重复立项。 当前状态:
接下来:拉取分支对 master 做完整 diff 回归审计,本地跑定向测试(dsh-native、issue3581-attribution-health、web banner 相关套件,遵循本地只跑定向的纪律),等 CI 全量判定后按八问体例给结论。 |
(ai: vllm-qwen/qwen3.8-27b) 审核完成:可合并 ✅CI 最终判定 @ diff 已对当前 master(merge-base 结构化八问
已知限制(不阻塞):attribution 表为内存态,standalone 代理重启会丢外部宿主进行中 degradation episode 的记录,需等下一次事件驱动报告补回(有界、自愈;插件模式下代理与宿主同进程,重启本来就两边一起重置);fire-and-forget 乱序时可能短暂陈旧值(latest-wins,下一事件纠正);面板只展示第一个 degraded agent。 判定:可合并。 代码、测试、CI、文档全部通过,行为变更完整披露。请自行合并:#3593 |
(ai: vllm-qwen/qwen3.8-27b) 上游冲突已解决,分支已 rebase 到当前 master 并推送,CI 全绿。 做了什么
结构化八问
行为变更披露:无运行时行为变更(未动 wire/config/persistence/阈值/时序)。唯一动作是去掉三个仅内部使用类型的 判定:可合入。所有必需检查已绿,merge state 为 |
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.541-master.dcea82a # this exact build
npm install -g billion-context@master # always the newest merged build
|
(ai: vllm-qwen/qwen3.8-27b)
Closes #3581
What
When a host plugin's injection breaks at runtime (#3578 shape: disposed agent scope after a version swap), model traffic silently goes direct and uncompressed until the host restarts — requests succeed, sessions never register, injected tools 404, and the panel just shows "0 running". This makes the failure visible on all three surfaces the issue asks for, plus the docs line.
How
Proxy side
src/server/attribution-status.ts(mirrorssrc/storage/runtime-status.ts): latest-report-wins registry keyed by agent name.POST /__bili/plugin/attribution(validated: agent ≤64 chars, state ∈ ok|none|threw; 400 malformed) →handlePluginAttributioninsrc/plugin.ts./__bili/statusand/__bili/overviewboth gain the additive fieldattribution: Record<agent, {state, refusals, since}>(empty{}until the first report). The issue spec sketched a single object; keyed by agent so multiple plugin lanes can coexist without clobbering each other — same per-entry shape.Plugin side (dsh-native gate)
giveUpStreak = 3consecutive requests whose settle-retry exhausted still threw, the gate stops re-settling (a disposed ctx stays disposed for the host's lifetime — [Bug][dsh-native] 运行中自动换版后接管静默失效:旧 fetch hook 持有已 dispose 的 ctx,currentInitiator() 永久 threw,重启才恢复 #3578 proved the fix(dsh-native): threw gate attribution gets a bounded settle-retry; provably-oversized bodies fail locally #2940 transience assumption breaks). The gate's single cheapattributionOfprobe per request keeps self-heal alive: the first ok claim clears the streak, resets the episode, and resumes normal retries. One log line marks the transition.Web panel
attribution-banner(page/client/i18n zh+en): shown when ≥1 reported agent is degraded ANDoverview.live === 0— i.e. traffic is actually going direct. Text: 「接管已失效({agent}):模型请求正在直连(不压缩),已拒 {n} 次 — 重启宿主可恢复」.Docs: README Self-update + AGENTS.md KDD #3 state that auto-update replaces disk files/proxy process only; injected code takes effect after a host restart, and since #3581 the broken state is visible via banner + status.
Behavior changes (old → new)
/__bili/status,/__bili/overviewattributionfield ({}until first report)POST /__bili/plugin/attribution(loopback-gated like siblings)threwsettle-retry_setThrewRetryForTestNo new config surface:
giveUpStreakis an internal constant exposed only through the existing test hook. No kernel/ or pi-subagents/ changes. No version bump.Tests
tests/issue3581-attribution-health.test.ts(new, proxy-side): endpoint validation incl. malformed bodies, status/overview parity, default{}, page ships the banner element, client renders it escaped.tests/dsh-native.test.ts: two new tests — dead-scope episode (reports captured event-driven, latch arms at streak 3, per-request probe cost drops 4→3, give-up log line) and recovery (episode reset, settle-retry re-armed, ok report). All 57 pass, including the untouched 方式一安装的dsh 原生插件:llm-pi-ai 传输(OpenAI SDK + options.fetch 注入)绕过 globalThis.fetch 拦截,模型请求不进代理、压缩完全不生效 #1158 L2 exact log-count assertions and #2924a/#2924b.