Repository navigation
[PR] feat(#3582): dsh-native takeover health on /__bili/status + panel banner - #3622
ranxianglei wants to merge 3 commits into
Conversation
|
读完 diff 了(13 files, +576/−20),三点补充都落实了:reportedAtMs+unknown 的 staleness 推导、hostStartedAtMs、byEndpoint top-N,横幅文案也一致。测试覆盖也看到了(takeover-status 16、runtime-info 新增 4 单测 + 2 parity e2e、dsh-native 跳变上报)。 作为报告者,提三个可以在合并前确认的点,代码逻辑我没法在这里跑,判断权在你: 1(最重要):空槽 clean passthrough 会不会绕过 gate?
如果 0.1.198 的空槽 passthrough 在拦截链里直接放行、不进 2:初始上报就报
3:
另外:PR 现在 关于测试:我在 #3578 的现场能稳定复现「换版后接管静默失效」(0.1.197 宿主处理 197→198 过渡)。如果你愿意出个预发布构建(或告诉我怎么从这个分支本地打包),我可以帮你在真实 DSH desktop 0.2.1-rc.2 + Windows 11 上验一遍:故意做一次热替换,看横幅是否真的弹出来、 合并节奏你定,我不催。 |
(ai: vllm-qwen/qwen3.8-27b) 查重:同症状同机制——与已合并的 #3593(修 #3581)大面积重叠,先报初始发现,完整八问结论稍后补。 时间线(均 UTC):
也就是说:实现本 PR 的会话在 #3593 已合并后开工,但基线里没有它,两条实现并行写了同一件事。若按现状合并,会出现双通道上报同一事实(专用 attribution 端点 + runtime-info 的 takeover 字段)、status 双字段( 初步判断:本 PR 不该按现状合并;其中你批准的增量(心跳→unknown 判活、hostStartedAtMs、byEndpoint top-N)是 #3593 落地方案的真实缺口,值得做,但应并入现有 attribution 通道而不是另开平行通道。正在逐行核对两边 diff 与冲突面,随后给结构化结论与处置建议(close 本 PR + #3582 按重复并回 #3581 + 增量另立一个 follow-up)。 |
|
我把 #3593 的 commit diff(3e0fe5a41)逐块对了一遍,同意“不该按现状合并”,而且重叠比初判更彻底:事件驱动上报、首次拒绝/跳变/计数翻倍/放弃锁/恢复五个上报时机、give-up latch(giveUpStreak=3 + threwStreak + threwGiveUpNoticed,注释里直接引了 #3578)、status/overview 的 attribution 字段、attribution-banner、sys.attribution_broken 文案、以及 177 行的 issue3581-attribution-health.test.ts——#3593 全都有了。双通道、双字段、双横幅的结论我确认。 但有一点想补充:#3593 的纯事件模型有一个具体的洞,正好是这个 PR 里那两个时间戳要补的。 因为“健康不上报”,一旦某个 agent 报过 threw,之后这个实例被 HMR 重建(apply() 重跑、attrHealth 重置为 ok),新实例因为健康而不发请求,代理侧那条 threw 就永远留着——横幅永久飘红。这其实是 #3395 的代际问题从接管链漏到了状态展示层。同类的还有:代理进程与宿主生命周期解耦时(proxy mode、auto-restart 只重启一侧)、宿主崩溃而代理存活。 所以我的看法是:reportedAtMs + staleness→unknown 和 hostStartedAtMs 不是可选的锦上添花,而是让这个通道“不撒谎”的必要条件;byEndpoint top-N 是诊断增强,可以后置。 不过实现方式建议改一下:#3622 现在是心跳无条件上报,包括 total===0 时首报 ok。如果把这个搬到 attribution 通道上,会把 #3593 现在诚实的“空 {} = 还没有消息”变成“空转也报健康”,比现在更糟。建议:保留事件驱动上报,心跳只重发“最后一次已知状态”,且 attrHealth 初始值用 none(表示还没有一次真实 claim),而不是 ok。 另外一条和本 PR 无关、但对 #3593 同样成立的:0.1.198 的空槽 clean passthrough 如果直接放行、不进 takeoverGate,那么既不进 refuse() 也就不上报,代理侧是 {},面板什么都不显示——这条静默仍然存在。这个值得单独确认一下拦截链是否在空槽路径上咨询 gate;如果需要,我可以另开一条。 处置我完全同意你的方案:close 本 PR,#3582 按重复并回 #3581,增量(两个时间戳 + byEndpoint)另立 follow-up,基线取当前 master。需要我在 follow-up 里把上面的语义写清楚、或者帮你在 0.1.199 发布后做真机验证,说一声就行。 合并节奏你定。 |
(ai: vllm-qwen/qwen3.8-27b) 审核结论:拦下——本 PR 与已合并的 #3593(修 #3581)是同一件事的并行实现,按现状合并会制造双通道/双字段/双横幅。你批准的增量真实存在,建议并入现有 attribution 通道另做。查重与时间线(完整证据)查重:同症状同机制重复。 #3582(13:29Z,dshjfdsh)与 #3581(13:22Z)相隔 7 分钟开出,症状逐字相同:「接管失效后面板/status 看不出压缩已停」。#3581 产出 PR #3593,已于 10-17 16:33Z 合入 master(commit 与已合并 #3593 的逐项重叠(读两边代码核对,非凭描述)
本 PR 的真实增量(#3593 落地方案的缺口,你已在 #3582 批准)
本地定向验证(分支 ae3d6be 上实跑)
八问(决策请求)
需要你拍板你的「Go(方案 A)」批于 16:33Z #3593 合入之后 29 分钟——当时是否已知 #3593? 若你是有意要两条通道并存,明确说一声我即收手;否则请给 go/no-go:① 关 #3622(注明被 #3593 supersede + 资产打捞去向)② #3582 按重复关回 #3581 ③ 立 follow-up 收口上述增量(由我在现有 attribution 通道上实现,含两个坏测试的两行修复)。拍板前我不动任何单子,也不预开 follow-up(避免平台自动调度抢在你决策前再开一条平行实现——这正是本次事故的成因)。 |
|
先回答你的问题:17:02 批准方案 A 时,我不知道 #3593 存在。 时间线可以印证:我 13:21Z 做查重时用的查询是 author:dshjfdsh(只找我自己开的单),而 #3581 是 13:22Z 才开的——比我的查重晚一分钟,而且不是我开的单,那个查询无论如何都不会命中它。之后我一直只在 #3582 和邮件通知里活动,17:02 批准时手上只有贴在 #3582 的那份实现方案。所以不是有意要两条通道,是纯粹不知道有第一条。 go/no-go:三项全部 go,按你推荐的选项一执行。 ① 关 #3622——同意,被 #3593 supersede。资产打捞我认可你的清单(takeover-status.ts 的模块设计、防御式解析、宿主 transition pusher、除两个坏测试外的测试)。两个坏测试的根因(回填 T0 后漏传 nowMs,staleness 按墙钟算必然过期)我看了,是确定性红,PR 描述里「16 green locally」对提交代码不成立——这点建议在关闭说明里留一句,免得以后有人照它复现。 ② #3582 按重复关回 #3581——同意,先来后到。我会去 #3582 补一句指向 #3581/#3593。 ③ 立 follow-up 收口增量——同意,而且建议就由你在现有 attribution 通道上做:扩展报告字段 + 一个周期性报告类型,零新端点。 关于 follow-up 的内容,想补一条语义约束,因为它决定心跳怎么写: #3593 是纯事件驱动、健康不上报。这带来一个具体的洞——某个 agent 报过 threw 之后,如果这个实例被 HMR 重建(apply() 重跑、attrHealth 重置为 ok),新实例因为健康而不发请求,代理侧那条 threw 就永远留着,横幅永久飘红。这其实是 #3395 的代际问题从接管链漏到了状态展示层;同类的还有 proxy mode 下代理与宿主生命周期解耦、宿主崩溃而代理存活。所以心跳 + reportedAtMs + hostStartedAtMs 不是锦上添花,而是让这个通道「不撒谎」的必要条件。 但心跳请只重发「最后一次已知状态」,不要无条件发 ok:否则会把现在诚实的「空 {} = 还没有消息」变成「空转也报健康」,比现在更糟。attrHealth 的初始值也建议用 none(表示还没有一次真实 claim),而不是 ok。 还有一条和本 PR 无关、但对 #3593 同样成立的,想请你确认:0.1.198 的空槽 clean passthrough 如果直接放行、不进 takeoverGate,那么既不进 refuse() 也就不上报,代理侧是 {},面板什么都不显示——这条静默仍然在。如果确认绕过,建议宿主在拦截链看到空槽时直接推一次 none(带明确 reason),而不是靠 gate 计数推断。 最后:仓库卫生(关重复单、开 follow-up)你不需要等我批准,按你的节奏走就行。我在 0.1.199 发布后会装上去做真机验证——「重启后横幅是否自动收起」只有带心跳那版才验得出来,有预发布构建的话我可以提前测。 |
Two takeoverStatusWire subtests recorded at a fixed 2023 T0 but called the wire without nowMs, so the default Date.now() (2026) marked every entry stale and derived 'unknown' — a deterministic wall-clock time-bomb that fails on any base. Pass an explicit in-window nowMs (matching the sibling subtests) so the staleness logic is tested by construction, not by ambient clock.
ae3d6be to
4fbe074
Compare
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.4285-pr.3622.364d0aeThis exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr3622.tgz
npm install -g packageInstall instructions are refreshed on each push. |
(ai: vllm-qwen/qwen3.8-27b) 上游 master 前进后本 PR 与 base 冲突(merge state: dirty),已 rebase 到当前 master tip 并解完冲突、force-push。PR 现 做了什么:rebase 冲突点(都是文本重叠 + 语义叠加,非逻辑矛盾):master 侧 #3581(attribution 归因健康)与本 PR #3582(takeover 接管状态)挂在 dsh-native takeover gate 的同一批函数/调用点上,外加 admin.ts 的 status/overview JSON 与 README 同一段落被两边各自改写。 结构化八问
需要 flag 的一个小修(test commit 验证证据:typecheck clean; 收工判定:冲突已解、定向验证全绿,可进入正常 review/合并流程;等 CI 检查转绿即可由人工合并(我不代 merge)。 |
|
Rebase 收到,CI 待跑没问题。不过我按 4fbe074 逐行读了实现,先更正我上一轮的一个判断,再报四个具体问题。 先更正:心跳不是「无条件发 ok」我上一轮要求「心跳只重发最后已知状态、别无条件发 ok」。读完代码,这条你已经做对了: 四个问题(都不阻塞,按我认为的严重度排)1. 注释说「A real host restart reloads this module → new value, so the panel can tell "recovered" apart from "counters reset because the host restarted"」。但插件热重载同样会重新加载这个模块: 建议改成进程级来源,而不是模块级: 2. 首次 push 会报
3.
4. 双横幅确实会同时弹,而且就是事故现场的条件
#3578 现场三个条件同时成立(threw + refusals 81 + live 0),同一件事会弹两条横幅。既然 #3593 的 attribution 通道已经在 master 上,建议:
|
|
补两个可以直接改的点,其余按你 18:46Z 的并集路线走,我不催。 1. head 4fbe074 上 ✗ 3 unused export(s): 三个类型只在本文件内用,去掉 2. 模块顶层 const HOST_STARTED_AT_MS = Math.round(performance.timeOrigin); |
- drop `export` from TakeoverReportState/TakeoverStatusWire/TakeoverState (INTERNAL_ONLY; unused-export gate was red on the previous head) - source hostStartedAtMs from process.uptime() instead of module-top Date.now(): a plugin hot-reload re-evaluates this module but must NOT read as a process restart (#3578 scenario) — only a real restart moves it - report "none" (not optimistic "ok") before any definitive gate outcome, matching the documented invariant "ok = a real claim = compression works"; pure tightening (none raises no banner) - correct TakeoverReport.refusals doc: a cumulative lifetime total (the per-endpoint map is never reset on headline-state transitions), not a since-last-transition count as the old comment claimed
(ai: vllm-qwen/qwen3.8-27b) @dshjfdsh 三轮意见我都逐条对着代码核过了。能改的已经改进分支(新 head 已改(commit
|
Closes #3582
What
Makes a dsh-native takeover failure user-visible instead of a silent full-price direct connection. Extends the existing host→proxy
POST /__bili/plugin/runtime-infochannel with an optionaltakeoverfield (方案 A, owner-approved in-thread #3582). The proxy stores the latest report per agent and serves it on both/__bili/statusand/__bili/overviewas a top-leveltakeoverobject (#2152 parity holds via the shared helper). The web panel renders a prominent banner.Wire (additive, backward-compatible)
New field on
/__bili/status+/__bili/overview:state === "threw"→ strong banner: symptom (压缩已停止,正在按全价直连) + cause (接管归因失败) + action (完全退出 DSH 后重新打开,仅关窗口无效) + confirm line (重启后确认面板「当前运行 ≥ 1」即恢复) + refused-request counts.state === "none"→ numbers only in status, no banner. Agentless sidecar traffic (title-gen, search summaries) is legitimatelynone, so a banner here would false-alarm (owner decision in-thread).state === "unknown"→ soft banner when the host stops heartbeating (no report, orreportedAtMsolder than 3× heartbeat). Deliberately never rendered as healthy — the last-known-good value must not mask a dead host.hostStartedAtMslets the panel distinguish “recovered” from “count reset because a new process started.”Host side (dsh-native)
The gate already tracks per-endpoint refusal counts (
gateRefusals). It now pushes live state on transitions (firstnone, anyok↔threwflip) plus a 60 s heartbeat, so the proxy always has a fresh view.refusalsresets naturally on host restart (a newhostStartedAtMs).Docs
README en + zh: one sentence noting auto-update swaps the on-disk package + separately-spawned proxy process, but host-embedded code needs a full host restart (#3582).
Behavior changes (flagged per policy)
/__bili/status+/__bili/overviewgain an additivetakeoverfield (nulluntil the host reports). No existing field changed or removed.threw/unknown; absent otherwise.Verification
typecheckclean; targeted suites green locally:takeover-status(16),runtime-info(55 — incl. takeover-only / combined model+takeover / neither→400 / malformed-takeover-falls-back-to-model, plus a status+overview parity e2e),dsh-native(377 — incl. a new host-side test proving gate transitions push the right state over the channel),web-storage-bannerparity (22).npm run buildwas blocked by shared-filesystem ENOSPC in this sandbox; the new module is a dependency-free leaf, so bundling carries no new risk.