Skip to content

[PR] fix: Context tab — plugin/status follows the live |sub: fork when the bare row went stale (#4686) - #4703

Open
ranxianglei wants to merge 7 commits into
masterfrom
2026-10-25_status-follows-live-fork
Open

ranxianglei wants to merge 7 commits into
masterfrom
2026-10-25_status-follows-live-fork

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Closes #4686

What changed

GET /__bili/plugin/status now serves the requested conversation's live |sub: fork when the bare parent id has gone stale — under exactly the criteria the #2601 tool-call routing already uses (livePersonaDescendant): fork born after the parent's last traffic (birth order, #3442/#3647), ref-holding (#2948 aux-lane breaker), fresh ≤ 10 min, freshest wins among several qualifying forks (#3397). The response keeps the requested conversationId (client ownership gates trust exact hits) and adds an additive personaFork: true field marking the follow — absent on every pre-existing resolution shape.

Why

After a persona-anchor drift forks a dsh conversation onto base|sub:<fp>, the host keeps stamping the RAW id on every Context-tab poll. An exact hit on the frozen bare row beat fallback=latest (that only fires when the id has NO record), so the tab pinned its embedded frame on the dead row forever while the live lane kept folding. Management TOOL calls already followed the fork (#2601 routing) — the reporter's own data shows the asymmetry: the 503-request live lane still folding while the 43-request bare row sat frozen. The read path simply never got the follow.

Behavior change disclosure (old → new)

Config surface: none — additive read-only JSON field on an existing endpoint; no config key, env var, or CLI flag added. Kernel: untouched (no change under kernel/).

Tests

New tests/issue4686-status-follows-live-fork.test.ts — 6 cases covering both directions of the gate (#3617): positive follow; negatives = parent still live after fork birth (#3442 shape), ref-less aux fork (#2948 shape), idle > 10 min fork, direct fork-id hit (no chained follow); plus multi-fork recency pick. Verified RED without the fix (the two positive cases fail) and GREEN with it. Targeted adjacent suites green locally (plugin-protocol, plugin-fork, plugin-status-provenance, native-caller stamping/host, side-lane-invariants, dsh-persona-fingerprint, advisory-panel, update-notes, issue404/2029/3862); full-suite verdict = remote CI.

…ent stale (#4686)

The dsh Context tab polls GET /__bili/plugin/status with the RAW conversation id; after a persona-anchor drift forks the conversation onto base|sub:<fp>, an exact hit on the frozen bare row beat fallback=latest forever, pinning the embedded frame on the dead row while the live lane kept folding. Management tool calls already followed the fork (#2601 routing); the read path never got it.

Follow the live fork under the exact criteria livePersonaDescendant already enforces for tool calls (birth order #3442/#3647, ref-holding #2948, freshness <= 10 min, recency pick #3397). Additive personaFork:true response field marks the follow; absent otherwise. Regression suite tests/issue4686-status-follows-live-fork.test.ts pins both directions of the gate (#3617).
@github-actions

github-actions Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-10-25_status-follows-live-fork (30f008f)

Latest build — install this exact version

npm install -g billion-context@0.0.6154-pr.4703.63815aa

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
30f008f billion-context@0.0.6154-pr.4703.63815aa build
9f70384 billion-context@0.0.6069-pr.4703.904a3d5 build
d2bbf09 billion-context@0.0.5967-pr.4703.95c6c88 build
424f038 billion-context@0.0.5891-pr.4703.f584861 build
888e0b8 billion-context@0.0.5823-pr.4703.351435e build
d4df610 billion-context@0.0.5730-pr.4703.588e5d7 build

Download artifact

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

Install instructions are refreshed on each push.

@ranxianglei ranxianglei changed the title fix: Context tab — plugin/status follows the live |sub: fork when the bare row went stale (#4686) [PR] fix: Context tab — plugin/status follows the live |sub: fork when the bare row went stale (#4686) Oct 25, 2026
@ranxianglei ranxianglei added bug Something isn't working dsh p2 scope/wiring labels Oct 25, 2026
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

查重: 不重复——检索了 open/closed 全部 PR:唯一触碰 plugin/status 跟随语义的是本 PR;#4691(stale MCP session binding)是 MCP 绑定自愈,机制与消费面均不同;#4118/#3886 是 Context tab 嵌入帧本身的历史 PR。无并行修复在途。

标签: bug / dsh / scope/wiring / p2(协议接线边界的读侧缺陷,dsh 车道受益方;已同步补到 #4686——此前镜像写入没持久化,这次直接落 GitHub)。

审核结论(独立重审,非复读 issue)

① 方向关 — 通过。 自己核过 v0.1.207 代码路径与 master 现状:写侧(工具调用)自 #2601 起就按 livePersonaDescendant 跟随 fork(宿主无关),读侧 handlePluginStatus 只做精确 id 解析、fallback=latest 仅在 id 完全无记录时触发——读写不对称就是缺陷本体。PR 选了 issue 选项 1(服务端解析到活车道、客户端零改动),打在根因上,不是治标。

② 回归审查 — 逐项清点 diff 触碰路径的既有行为:

既有行为 结论
父会话仍活跃时的精确命中 保持——出生序判据(fork 须诞生于父最后流量之后)天然排除,负例测试 2 钉住
ref-less 辅助车道(auto-review blob) 保持不可选——holdsRefs 断路器原样复用,负例测试 3 钉住
fork 闲置 >10min 保持不跟随——PERSONA_LINEAGE_FRESH_MS 常量未动,负例测试 4 钉住
直接请求 fork id 不链式跟随——livePersonaDescendant/personaDescendantsOf 双重 contains("|sub:") 守卫 + 负例测试 5
fallback=latest 路径 零触碰——follow 块只在精确命中后运行,无记录分支逻辑逐行未变
dsh ownership gate(client L821-825) 通过——follow 响应 viaFallback=false 且 conversationId 保持请求值,gate 无条件信任,iframe 下一轮轮询自动挪到活车道;客户端零改动属实
mcp.ts adoptLatestActiveConversation 不触发——采纳要求 fallback===true && conversationId 变化,follow 两者皆不满足
zcode/kimi/dsh 字面量探针 不可达——无 session 时走 pre-first-request 分支,follow 代码到不了
entry.lastSeen bump 语义不变——仍打在 conversations map 的请求 id 条目上,不是 Session.lastSeen,无法反噬出生序判据(不会自我失效循环)
webUrl/runtimeInfo 有意变更且已披露——现在来自被服务会话(fork)的页面/信息,正是修复目的
工具调用路由(src/plugin.ts L1924-1983) 零改动,无语义漂移

高危模式逐项过:无 fail-fast 变吞错、无阈值/时序漂移(常量全复用)、输出格式纯加性。未发现无意回归。

③ 代码审查 — 通过。 判据函数原样复用而非复制一份新逻辑(单一事实源,后续 #2944 v2 resolver 切流时读侧自动跟上);放置位置正确(fallback 之前、no-session 分支之前);personaFork || undefined 保证旧形状字节不变。一个非阻塞小观察:info 日志在陈旧窗口内每 10s 轮询打一行(约 6 行/分钟,仅限真实 fork 流量期间)——与 #2601 工具路径「每次跟随打一行 info」的既有模式一致且有界,可接受;若嫌吵可降 debug,不拦。

④ 测试有效性 — 真测试。 本地验证 RED/GREEN 牙齿:把 src/plugin.ts 换回 master 版本后恰好 2 个正例失败、4 个负例仍绿,换回修复后 6/6 绿——断言有牙,bug 回归时抓得住。负例覆盖每个判据维度(#3617 双向 gate 纪律);多 fork 取最新也钉住。定向套件本地全绿:issue4686 + plugin-protocol + plugin-fork + plugin-status-provenance + side-lane-invariants + dsh-persona-fingerprint = 103 用例,再加 issue404/2029/3862/side-lane-truth-table/issue3397 = 27 用例,typecheck 干净。行为变更类功能有 e2e 兜底:CI 的 e2e-dsh-plugin-lane(真实 dsh 客户端过代理)在本 head 上绿。

⑤/⑤b diff 整洁度与代码质量 — 通过。 2 文件 +149 行,每一行都服务于本 PR 目的;命名达意(followedLiveFork/live)、注释讲为什么且带 issue 锚点(仓库既有风格)、无死代码、无魔法数字、无新依赖。

CI 状态(关键判断:红不是本 PR 的)

判定:可合。 本 PR 无任何自身引入的回归,核心 lane 全绿,红 shard 为继承性 born-red(已在 #4599 留痕)。合并权在你:若想合入时看板全绿,需先等存储家族在 ci-fixes/#4599 收敛——但那不该阻塞这个修复本身(其正确性已由 RED/GREEN + 130 定向用例 + e2e-dsh-plugin-lane 三重钉住)。

ci-check added 4 commits October 26, 2026 10:16
master window commits 293ae65/de5e03659 bumped kernel/package.json to
0.0.165 without regenerating the lockfiles; lock-sync re-resolution then
rewrites the stale recorded versions (root 0.0.163, kernel 0.0.164) and
fails. Pure recorded-version sync via npm install --package-lock-only;
no dependency or semantic change.

This branch has not been deployed

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

Labels

bug Something isn't working dsh p2 scope/wiring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(dsh): Context tab freezes on the stale bare row after a session forks to a |sub: lane

1 participant