Skip to content

[PR] #3862: Context tab embeds the web UI's own session page - #4086

Merged
ranxianglei merged 1 commit into
masterfrom
2026-10-20_dsh-ctx-embed
Oct 21, 2026
Merged

ranxianglei merged 1 commit into
masterfrom
2026-10-20_dsh-ctx-embed

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

What / why

Follow-up to #3886 (which added the dsh client 「上下文」/Context tab as a native re-rendering of the proxy's contextView payload). Per owner direction, the tab now embeds the web UI's OWN session page instead of drawing a second card:

{origin}/__bili/?embed=1&lang=<zh|en>&theme=<host>#/session/<sessionId>

One place for the data — compression tree, fold ledger and switch attribution stay in the frame; no hand-drawn duplicate of the kernel categorization or cache-ledger trail to keep in lockstep forever. Net −182 lines.

How it works

  • Session id from the same URL the lane uses. The tab polls GET /__bili/plugin/status?conversationId=dsh&fallback=latest (identical form to the server-side /acp command) and reads its sessionId field — the tab can never frame a different session than the dsh lane. String-nonempty guard: older/foreign builds answering without one fall through to honest hints, never an empty frame.
  • Shared pre-flight discipline with the settings panel(): probeOrigin (fast→slow phases) now drives the per-origin embed verdict cache (#3100) too, mid-session re-binds re-probe automatically; #2559 host-theme pin is passed into the frame URL; the #3816 remote-blocked notice was extracted to a module-level renderRemoteBlock() so fix text, relay snippet and jump target cannot drift between the two placements.
  • Honest state tree: degraded (no proxy / unparseable body) → remote-blocked → stale build (frozen pre-embed proxy) → waiting-first-request → iframe → connecting / not-yet. chain-advisory answers read as not-yet and are NEVER rendered as a "restart fixes it" claim. First paint before verdict+id frames nothing.
  • i18n: all card-only keys removed from both dictionaries; EN/ZH sets remain equal (gen-config-docs gate verifies).

Tests

The existing #3862 pin in tests/dsh-settings-ui.test.ts is rewritten for the embedded face: exact iframe src/title on happy path, single 10 s poller (delta-counted fetches), refresh click re-polls without duplicating the interval, unmount cancels the loop, and every degraded sub-state pinned (pre-first-request / chain-advisory-not-stale / stale-route / unparseable-body→degraded / all-throws→degraded-no-buttons). Server-side issue3862-context-view.test.ts untouched and green (the endpoint still serves contextView for the web UI itself).

Verification (local, base master 2e13a70)

  • tsc --noEmit: 0 errors
  • dsh-settings-ui.test.ts: my pin ✔; remaining failure set byte-identical to clean master in this environment (#1590 index-inject ×2, #1809 /bili/origin ×3 — pre-existing local env reds, verified via stash)
  • issue3862-context-view.test.ts + dsh-panel-embed-cors.test.ts: 7/7 ✔
  • gates: tools/gen-config-docs.mjs generate ✓ (238 keys, EN/ZH equal), scripts/check-unused-exports.mjs ✓ clean (5 waived)
  • npm run build: ✓

@ranxianglei ranxianglei changed the title #3862: Context tab embeds the web UI's own session page [PR] #3862: Context tab embeds the web UI's own session page Oct 21, 2026
@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-10-20_dsh-ctx-embed (b877ebd)

Option A — Install this exact build (recommended)

npm install -g billion-context@0.0.4888-pr.4086.c2b1f77

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-pr4086.tgz
npm install -g package

Install instructions are refreshed on each push.

@ranxianglei

Copy link
Copy Markdown
Owner Author

CI failure triage (ubuntu-22 shards 1 & 3)

All three distinct failing tests are the pre-existing SMT-solver environment red, not regressions from this diff:

test failure
`view-latch discipline: quiet turns replay latched bytes verbatim` (shard 1) `no solver available (set VERIF_SOLVER_CMD / VERIF_PYTHON): python3 ModuleNotFoundError: No module named 'cvc5'; z3: spawnSync z3 ENOENT`
`generic append-only stability …` (shard 3) `# SKIP no SMT solver available` counted as not-ok (known quirk of the verif family on solver-less runners)
`wire-anthropic round-trip` ×2 (shard 3) same `no solver available` — reproduced identically on a local dev box (broken cvc5 module there too); these assert solver-checked round-trip properties

This diff only touches `src/agent/dsh-native-client.ts` + its test pin; it cannot affect wire serialization or view-latch verification. Same solver-red family as master baseline run 39437368167 (see #3971 evidence comment). Everything my change gates is green in-CI and locally: tsc 0, rewritten #3862 pin ✔, issue3862-context-view + dsh-panel-embed-cors 7/7 ✔, gen-config-docs + unused-exports clean, build ✓.

…-drawing a card

The dsh conversation.view tab shipped in #3886 as a native re-rendering of
the proxy's contextView payload (categories bar + anchor + event trail).
It works, but the same data now lives in TWO places: the web UI session
page (compression tree, fold ledger, switch attribution) and this second
hand-drawn card that must be kept in lockstep with the kernel's buildStatusPanel
categorization and the cache-ledger fold trail forever.

Per owner direction, embed the web UI's own session page instead:
?embed=1&lang=..&theme=..#/session/<id> in the shared EMBED_HEIGHT frame —
one place for the data, zero duplicated rendering to maintain.

- session id resolved from the SAME status URL the /acp command uses
  server-side (/__bili/plugin/status sessionId field), so the tab can never
  frame a different session than the lane; string-nonempty guard, older or
  foreign builds answering without one fall through to honest hints
- full pre-flight discipline shared with the settings panel(): probeOrigin
  (+per-origin embed verdict cache, mid-session re-binds re-probe), #2559
  host-theme pin into the frame URL, #3816 remote-blocked notice extracted
  to renderRemoteBlock() so fix text/relay snippet/jump target cannot drift
  between the two placements
- state tree stays honest end-to-end: degraded (no proxy) / remote-blocked /
  stale-build (frozen pre-embed proxy) / waiting-first-request / connecting /
  not-yet; chain-advisory reads as not-yet, never as 'restart fixes it';
  first paint before verdict+id never frames anything
- i18n: card-only keys removed from both dictionaries (EN/ZH sets stay equal);
  remaining keys are the shared set
- tests: the #3862 pin is rewritten for the embedded face — happy path
  asserts the exact iframe src/title, 10s single poller, refresh click
  re-polls without duplicating the interval, unmount cancels; every degraded
  sub-state pinned (waiting / chain-advisory-not-stale / stale-route /
  unparseable-body→degraded / all-throws→degraded)
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

查重: 不重复。 本 PR 是 #3886(新增 dsh 「上下文」tab)的后续,按 owner 指示把 tab 从原生卡片重渲改为嵌入 web UI 自己的会话页;标题里的 "#3862" 指原始已关闭 bug(dsh 压缩后上下文统计不一致),是命名来源而非重复报告。检索 open/closed issue+PR 无同主题在途条目。
标签: dsh / scope/ui / p3(纯 dsh 客户端展示面重构,非缺陷、无新配置;保留系统 pr 标签)。

结构化八问

  1. 是什么问题:按 owner 方向,dsh Context tab 不再自己画第二张卡片,改为 iframe 嵌入 web UI 自身的会话页(?embed=1&lang&theme#/session/<id>),数据展示收敛到一处(net −182 行)。
  2. 什么原因导致的:原实现([PR] feat: dsh client Context tab with accurate post-compression stats (#3862) #3886)是 kernel 分类/缓存账本数据的第二渲染层,必须与 web UI 永久 lockstep 维护;嵌入后重复展示面消失,数据源唯一。
  3. 影响范围与严重程度:仅 dsh 客户端 Context tab 的展示;wire/协议零改动,服务端端点零改动,其他面板不受影响。属 UX/展示改进,无可用性影响。
  4. 怎么修复的:① session id 轮询 GET /__bili/plugin/status?conversationId=dsh&fallback=latest(与 server 侧 /acp 命令同一 URL)读 sessionId,string-nonempty 守卫——旧版/外部 build 不返回时落诚实提示,永不空帧(tab 不可能框到与 dsh lane 不同的会话);② 复用 settings panel 的 pre-flight 纪律:probeOrigin 驱动 dsh admin UI returns no such management endpoint after profile auto-update #3100 embed verdict 缓存(mid-session re-bind 自动重探,dsh admin UI returns no such management endpoint after profile auto-update #3100 语义:进程冻结期内 verdict 页内有效)、【ui】dsh 嵌入面板不跟随宿主深色主题——深色底上文字不可读 #2559 theme pin 进 frame URL、feat(dsh): suggest enabling adminRelay by default in DSH plugin mode or prompting on remote access | feat(dsh): 建议在 DSH 插件模式下默认开启 adminRelay 或在远程访问时给出提示 #3816 remote-blocked 通知抽成模块级 renderRemoteBlock() 两处共享(fix 文案/relay 片段/跳转目标不会漂移);③ 诚实状态树 degraded → remote-blocked → stale build → waiting-first-request → iframe → connecting/not-yet,chain-advisory 一律读作 not-yet,绝不渲染成"重启就好";首帧在 verdict+id 齐备前不框任何东西。代码逐段核对过:双 probeEmbedRoute 调用路径被 in-flight set 去重(无重复 fetch);polling effect [origin, reloadTick] refresh 换环不叠环、unmount 取消;服务端 handlePluginStatus 主分支返 session.id、advisory/pre-first-request 分支返 null,与解析器一一对应;web UI 路由确认支持 #/session/<id> 深链(src/web/client.ts route())。
  5. 是否有回归问题:逐项清点——settings panel() 行为不变(renderRemoteBlock 逐字提取,文案/目标一致);服务端 contextView/plugin-status 端点未动(issue3862-context-view.test.ts 未触碰);i18n 删除的 key 全部 card-only,全仓 grep 无残留引用,EN/ZH 集合相等(gen-config-docs gate 绿);check-unused-exports 绿。两个有意的行为细节(非回归,列出供知悉):① status 轮询瞬时失败时保留最后一次已知 sessionId(iframe 继续指向最后会话直到下次成功轮询,≤10s)——旧实现保留 stale 卡片+"数据可能过期"注记,新实现帧更稳定,判定为更诚实;② embed verdict 页内缓存(dsh admin UI returns no such management endpoint after profile auto-update #3100 既有语义,与 settings panel 共享):会话中途 proxy 以新 build 重启仍显示 "stale" 直至页面刷新——既有语义,非本 PR 引入。
  6. 是否破坏缓存:不涉及(零 wire 改动,prefix-cache 路径未触碰)。
  7. 是否改了设计方向:无架构转向——两处展示面合一(single source of truth),正是 owner 指定的方向。
  8. 是否引入了新的配置:无。

CI 诊断(关键发现)+ 已采取行动

推送时 6 个 test shard 中 5 个红。拉了 job 日志逐个核对:失败全部集中在 verif 求解器测试(verif-view-latch-discipline.test.ts view-latch induction、verif-wire-anthropic-roundtrip.test.ts 两条 round-trip)——报错 no solver available ... ModuleNotFoundError: No module named 'cvc5' / z3: spawnSync z3 ENOENT,即这些测试在无求解器时直接 throw 而不是 skip(同文件其他 verif 测试 skip 正常);Windows shard 另含 #3769 EBUSY。这是 base(56a0f5a)继承的破损,与本 PR 的两个文件完全无关;master 上已由 #4084(0fd63d177+321d3ec21,恰好给这几个测试补 haveSolver 门)和 #4087(9a497802e)修掉,master 最新 run(9a97169)全绿。
已把本分支 rebase 到 master 9a97169 并 push(无冲突,diff 内容不变:2 files, +198/−380;新 head b877ebd),CI 正在新 head 上重跑。本地未复跑套件(本地环境未装依赖且资源共享,CI 为权威门禁);PR 内 local verification 声明按原文采信。

判定:代码审查通过(八问如上,无拦下项);rebased head b877ebd 的 CI 转绿后即可由人工合并。CI 结果出来我再跟一条确认。

@ranxianglei
ranxianglei merged commit b5d7b22 into master Oct 21, 2026
84 of 125 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

📦 Merged Build Published

This merge to master was published as 0.0.707-master.b5d7b22 (rolling master tag).

npm install -g billion-context@0.0.707-master.b5d7b22  # 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.

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