Skip to content

[PR] feat: DSH shell.overlay upstream-unavailable pill (#4254) - #4267

Closed
ranxianglei wants to merge 2 commits into
masterfrom
2026-10-22_4254-dsh-upstream-banner
Closed

ranxianglei wants to merge 2 commits into
masterfrom
2026-10-22_4254-dsh-upstream-banner

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Defect ② render half of #4254 (the DSH-side banner), pairing with the read surface shipped in #4257.

What

bili's DSH client (src/agent/dsh-native-client.ts) now registers a frame-level shell.overlay slot that:

Division of labor (per the #4254 design thread): the frame-level banner says which upstream is down; the in-conversation error (#4257 defect ①) says why yours failed this time. Both coexist.

Boundaries / decisions

  • Display identity = forwarded host:port. bili is a transparent pipe — it only sees the forwarded URL's host:port, not session identity. Provider/model reverse lookup ("provider ai @127.0.0.1:7864") stays host-side (DSH reads its own baseURL); this draft deliberately does NOT attempt it.
  • Defensive parse never throws — a malformed or partial report yields fewer rows and never breaks the DSH client.
  • Purely additive UI — no request-path changes. Deferred injection is fail-open on hosts whose build lacks the shell.overlay slot (same discipline as the existing session Context tab).
  • i18n zh/en kept in sync.

Deps / sequencing

Depends on #4257 (the endpoint). The banner is inert until that lands (a 404 → empty report → null). Safe to review now; merge after #4257.

Behavior changes

Additive only — one new optional slot registration plus one loopback-gated read route consumed client-side. No existing behavior, wire shape, config, or persistence changes. Config surface: None.

Tests

Deterministic render test added to tests/dsh-settings-ui.test.ts (populated / healthy-auto-dismiss / multi-host), exercising the real bundled client through the existing vm harness. Typecheck + full dsh-settings-ui suite (17/17) + production build all green locally on this head.

Not verified here

The final visual check in a live dsh build (slot contract + wording) is the reporter's to confirm — this environment has no live dsh. Flagging explicitly rather than claiming it.

Part of #4254 (renders the ② half; pairs with #4257).

Defect 2 render half of #4254, pairing with the GET /__bili/upstreams read surface shipped in #4257. bili's DSH client registers a frame-level shell.overlay slot that polls /__bili/upstreams every 10s and renders one row per unreachable upstream (host:port, kind, errno code, consecutive-failure tally, and a retry ETA while the circuit is open); it returns null while every upstream is reachable, so the banner auto-dismisses when circuits close + alerts clear.

- Display identity is the forwarded host:port (bili is a transparent pipe); provider/model reverse lookup stays host-side (DSH reads its own baseURL).

- Defensive parse of the report never throws: a broken health report cannot break the DSH client.

- Purely additive UI, no request-path changes; deferred injection is fail-open on hosts whose build lacks the shell.overlay slot.

- i18n zh/en in sync; deterministic render test (populated / healthy / multi-host).
@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-10-22_4254-dsh-upstream-banner (3c20151)

Option A — Install this exact build (recommended)

npm install -g billion-context@0.0.5073-pr.4267.fa758a8

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

Option B — Download artifact

  1. Download the artifact from the Actions run
  2. Extract the tarball and install:
tar xzf billion-context-pr4267.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

[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b)

查重: 不重复——本 PR 是 #4254 设计线程的「渲染半」(frame-level banner),与 #4257(读取面:/__bili/upstreams 端点 + 会话内错误)是同一 issue 的两个互补面,分工已在正文写明;open/closed PR 与 issue 里无其他做 DSH shell.overlay 横幅的条目。

收到,开始审核:拉取分支、对当前 master 核对代码、跑定向验证,结论按八问回复。

…rse gate

The 'defensive parse never throws' claim had no negative test row — only
the empty-report case. Add a mixed garbage list (non-object entry, host-less
entry, empty-host entry alongside one valid entry) asserting the banner keeps
only the well-formed row and counts it in its header.
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

标签:dsh + scope/ui + p3(dsh 车道纯增量 UI 展示面;非缺陷类不打 bug)。

Review 结论(独立审过 diff、跨 PR 契约与 CI,未照抄 PR 描述)

审过的既有行为清单及结论:

  • 既有 slot 注册(settings.section / plugins.bundle.config / conversation.view):未动;新 shell.overlay 是独立 slot 命名空间,order:100 只在该 slot 内排序 → 保持。
  • 请求路径 / wire 形状 / 配置面 / 持久化:diff 零触碰(src/agent/dsh-native-client.ts 仅新增组件+注册+解析;i18n 表加 4 个 key)→ 保持。
  • loopback 门禁:GET /__bili/upstreams([PR] Make upstream-failure egress diagnosable (#4254): informative error, 503+Retry-After on circuit-open #4257 侧)注册在 handleAdminRoute 内,与 /__bili/status 等全部管理端点同一层 loopback-only 策略(src/server.ts 启动日志明示 "/__bili/ management endpoints stay loopback-only")→ 无新暴露面;报告内容(host:port/kind/count)不超过既有 admin 端点已暴露的信息量。
  • 轮询纪律:10s 周期复用现有 CTX_POLL_MS 节奏;fetch 失败 catch→空报告→渲染 null(fail-open);unmount 取消定时器(测试已钉);origin 探测复用 contextPanel 同款模式 → 与既有 Context tab 行为一致。
  • 测试基线:slotsOrder 断言 3→4 是注册数变化的有意更新,与新注册一一对应。
  • CI:新 head 3c20151d3 全绿——static-gates(ubuntu/windows)、kernel-guard/lane-guard/version-guard/config-surface-guard/docs-sync 等静态门 + test 分片 ubuntu/windows × node22/24 × 3 全部 success,零失败。

顺手小修(已直接提交到本分支):「defensive parse never throws」这个降级门原来只有正向用例(空报告),缺负向断言行——按 #3617 双向断言纪律补了一行混合垃圾列表(非对象条目 / 无 host 条目 / 空 host 条目 + 1 条合法数据),断言只有合法行存活且 header 只数幸存者。commit 3c20151d3,定向套件 17/17 绿,CI 新 head 绿。

未验证项(作者已声明,我确认属实): live dsh 构建里的最终视觉验证(slot 契约 + 措辞)需要 reporter 确认——本环境无 live dsh,不冒认。


结构化八问

  1. 是什么问题:功能实现(Circuit-open 502 keeps an opaque error string, and connect-refused alerts never reach the host GUI | [Bug][dsh] 熔断/连接失败时客户端只见常量 "acp-proxy failure":detail/upstreamFailure/alerts 全都没到用户眼前 #4254 的渲染半):DSH 上游模型服务不可达时,dsh 客户端 Web UI 没有框架级横幅,用户只能等会话内报错才知道上游挂了。本 PR 给 bili 捆绑的 dsh 客户端加了 shell.overlay 横幅:每 10s 轮询 /__bili/upstreams,每个不可达 host 一行,全部恢复自动消失。
  2. 什么原因导致的:不适用(非缺陷)。缺口本身 = 此前没有该展示面;数据源是 [PR] Make upstream-failure egress diagnosable (#4254): informative error, 503+Retry-After on circuit-open #4257 提供的 loopback admin 端点。
  3. 影响范围与严重程度:仅 dsh 车道 Web UI 展示层,纯增量。构建里没有 shell.overlay slot 的宿主 → deferred injection fail-open(与既有 Context tab 同纪律),零影响;[PR] Make upstream-failure egress diagnosable (#4254): informative error, 503+Retry-After on circuit-open #4257 合入前横幅 inert(404→空→null),不会误报。无请求路径/wire/配置/持久化变更。
  4. 怎么修复的:复用已验证的 origin 探测+轮询+健康即 null 模式(与 session Context tab 同构);防御式解析永不抛错,畸形报告只会少出行;显示身份取 forwarded host:port(bili 是透明管道,provider/model 反查刻意留给宿主侧,不在本 PR 做);i18n zh/en 同步。
  5. 是否有回归问题:无。上面「既有行为清单」逐项过完:全部保持或有意更新(slotsOrder 3→4 对应新注册);高危模式(语义漂移/fail-fast 变吞错/阈值时序输出格式漂移)逐项排除——唯一新增的定时行为是 UI 侧 10s 轮询,unmount 即停,不碰任何请求路径。CI 新 head 全绿。
  6. 是否破坏缓存:不涉及(未触碰任何缓存/重试游标/去重键逻辑)。
  7. 是否改了设计方向:不涉及。分工沿用 Circuit-open 502 keeps an opaque error string, and connect-refused alerts never reach the host GUI | [Bug][dsh] 熔断/连接失败时客户端只见常量 "acp-proxy failure":detail/upstreamFailure/alerts 全都没到用户眼前 #4254 设计线程:框架级横幅说「哪个上游挂了」,会话内错误([PR] Make upstream-failure egress diagnosable (#4254): informative error, 503+Retry-After on circuit-open #4257 defect ①)说「你这次为什么失败」,两者共存。
  8. 是否引入了新的配置:不涉及(Config surface: None,PR 声明属实)。

判定:可合并。 顺序上建议 #4257 先合(横幅依赖其端点;早于它合入也安全——inert 不误报)。合并由人来执行。

@ranxianglei

Copy link
Copy Markdown
Owner Author

(ai: zhipuai-lb/glm-5.3)

已并入合并列车 #4551(master 合并,merge commit 保留原作者署名)。本 PR 关单收尾;回滚点为 #4551 单提交 revert。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant