Skip to content

[PR] fix: sessions UI — live means active (recent), hide :side:/:sub: children by default - #7894

Open
ranxianglei wants to merge 3 commits into
masterfrom
2026-11-28_sessions-live-active-side-filter
Open

ranxianglei wants to merge 3 commits into
masterfrom
2026-11-28_sessions-live-active-side-filter

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Closes #7876

What

Two fixes for the Web UI sessions page (/__bili/#/sessions):

P1 — the Live filter was a no-op. live in GET /__bili/sessions meant "resident in the in-memory pool". The pool only evicts when full (count/byte cap), so on a long-running daemon every session seen since process start stayed live: true — the reporter saw 104/104 rows marked live while ~3 were actually active. A restart just moved the same sessions to "History".

live is now recency-gated active: in memory AND seen within 10 min (the repo's existing active/fresh convention — SPLIT_CANARY_FRESH_MS / PERSONA_LINEAGE_FRESH_MS). The state filter, the overview live count, and the row/detail badges all key off the active state.

P2 — :side: / :sub: sessions flooded the list. Client-minted child conversations (one-shot auxiliary calls, e.g. omp's auxiliary calls) were listed as top-level rows — 65 of them vs 39 real sessions — and showed the UA-sniffed claude instead of the real client. They are now hidden by default (new "Show side/sub sessions" toggle) and inherit the parent's clientHint (so omp's auxiliary calls read as omp).

Behavior changes (old → new)

  1. live field in GET /__bili/sessions / session detail: "in memory since daemon start" → "active in the last 10 min". A recently-used restored session is now Live (the old !restored exclusion is dropped). Any script/automation keying on live: true now gets only recently-active sessions, not every resident one.
  2. :side: / :sub: sessions are hidden from the list by default (new ?children=1 opt-in). The unfilteredTotal in the list response reflects the child-hidden view.
  3. Child sessions inherit the parent's clientHint (e.g. omp) instead of their own UA-sniffed hint (e.g. claude).

No new config knob (the 10-min window is a module constant; the config surface is owner-gated). No model-facing prompt text touched.

Tests

  • tests/web-sessions.test.ts: 2 new regression tests —
    • #7876 P1: live = active (recent), not merely resident (idle-2h resident → live:false; fresh → live:true; state filter discriminates; overview live = 1)
    • #7876 P2: child sessions hidden by default, inherit parent clientHint (default hides children; showChildren reveals + marks + inherits omp)
  • Local: npm run typecheck clean; tests/web-sessions.test.ts 31/31, tests/web-i18n.test.ts 11/11 (zh/en parity).

…dren by default (#7876)

The sessions page's Live filter was a no-op: `live` meant "resident in the
in-memory pool", and the pool only evicts when full, so on a long-running
daemon every session seen since process start stayed live (104/104 rows
marked live while ~3 were actually active). A restart just moved the same
sessions to History.

P1: `live` is now recency-gated active — in memory AND seen within 10 min
(the repo's existing active/fresh convention, SPLIT_CANARY_FRESH_MS /
PERSONA_LINEAGE_FRESH_MS). The state filter, the overview live count, and
the row/detail badges all key off the active state.

P2: client-minted child conversations (:side:/:sub:, one-shot auxiliary
calls) are hidden from the list by default (new "show side/sub sessions"
toggle) and inherit the parent's clientHint, so omp's auxiliary calls read
as omp instead of the UA-sniffed "claude".

Closes #7876
@ranxianglei ranxianglei changed the title fix: sessions UI — live means active (recent), hide :side:/:sub: children by default [PR] fix: sessions UI — live means active (recent), hide :side:/:sub: children by default Nov 28, 2026
@ranxianglei ranxianglei added bug Something isn't working omp p2 scope/ui labels Nov 28, 2026
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

Reviewing PR #7894 (Closes #7876). Early status before the full verdict:

Duplicate screening: not a duplicate — related to the already-merged #7594, different mechanism and population. Master's #7594 ("filter top-level and child sessions") added a kind=top|child dropdown keyed on the host-stamped parentSessionId (fork/derived lineage via derivedFromSessionId). It filters on demand and hides nothing by default. This PR targets a different population — client-minted :side:/:sub: auxiliary calls that never declare lineage (the 65 clientHint: "claude" rows in #7876 would still appear under master's kind=top filter) — and adds the P1 live-recency fix that master does not have at all. The two are complementary; the integration keeps both.

Live state of the PR (verified just now):

  • Head 91412dc351d is 588 commits behind master; mergeable: false / dirty — real content conflicts in 5 files (13 hunks: src/server/admin.ts, src/web/client.ts, src/web/i18n.ts, src/web/page.ts, src/web/sessions-data.ts). All hunks are same-region additions (the kind filter vs the children toggle), plus one i18n key collision (ses.badge_child is defined by both sides with different values).
  • CI has never run on the head (0 check runs) — the conflict blocks it.

Plan: merge current master into the PR branch, resolve the 13 hunks as a union of intent (keep #7594's kind filter + this PR's default-hide toggle, recency-gated live, and clientHint inheritance; de-collide the badge i18n keys), run the targeted suites (web-sessions, web-i18n, side-window-inherit) + typecheck locally, push, and post the full 8-question review. No history rewrite — the merge commit is additive on top of your commit.

Conflict resolution (union of intent, 5 files):
- admin.ts / sessions-data.ts / client.ts / page.ts: keep BOTH master's
  kind=top|child filter (parentSessionId lineage, #7594) and this branch's
  showChildren toggle (id-suffix :side:/:sub: auxiliary calls, #7876) —
  they address different populations and compose.
- i18n.ts: de-collide ses.badge_child (master: derived-lineage badge) vs
  the branch's auxiliary-call badge -> renamed to ses.badge_aux/_tip;
  the client-cell chip is guarded with !s.parentSessionId so a
  declared-lineage child is not double-badged.
- i18n.ts: added the 4 new keys to the ko locale (added to master after
  the branch point) and updated ko ses.badge_live_tip to the recency
  wording — required by the #1024 catalog-parity test.
- state filter: keep this branch's recency-gated live (drop !restored);
  master's kind lines kept verbatim.

Verified: typecheck clean; tests/web-sessions.test.ts + web-i18n +
side-window-inherit 57/57 pass.
@github-actions

github-actions Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-11-28_sessions-live-active-side-filter (6e19d19)

Latest build — install this exact version

npm install -g billion-context@0.0.12286-pr.7894.51894a0

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
6e19d19 billion-context@0.0.12286-pr.7894.51894a0 build
34ab7ba billion-context@0.0.12285-pr.7894.762fbed build

Download artifact

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

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

Review complete — the branch was 588 commits behind master (CI had never run on it); I merged master in, resolved all 13 conflict hunks as a union of intent, and pushed. CI is now green on the new head.

What I did to the branch

The branch predated master's kind=top|child filter (#7594, merged since the branch point) — the two features touch the same toolbar/filter code and both defined an i18n key ses.badge_child with different values. Conflict resolution (2 merge commits, head 6e19d1921):

  • Both filters kept, they compose: kind (declared lineage via parentSessionId) and the children toggle (id-suffix :side:/:sub: auxiliary calls) address different populations — a session can be neither, one, or both.
  • i18n de-collision: the branch's auxiliary-call badge is renamed ses.badge_aux / ses.badge_aux_tip (master's ses.badge_child = "derived from parent" stays as-is).
  • Double-badge guard: the client-cell "side" chip is now gated on !s.parentSessionId, so a declared-lineage child doesn't carry two child badges.
  • ko locale: master added a Korean locale after the branch point; the Web UI 英文翻译开关(i18n)— 社区 PR #807 (@amirzamli) #1024 catalog-parity test requires every new key in every locale. Added the 4 new keys + updated ko ses.badge_live_tip to the recency wording.

Review findings

① Direction (source issue #7876). Correct root-cause framing on both counts. P1: live meant "resident in the in-memory pool", and the pool only evicts when full — on a long-running daemon every session seen since start is live:true (104/104 in the report, ~3 actually active). The fix is the recency gate (in memory AND lastSeen within 10 min — the repo's existing active/fresh convention, same 10-min window as SPLIT_CANARY_FRESH_MS/PERSONA_LINEAGE_FRESH_MS), not a cosmetic filter tweak. P2: the 65 :side: rows are client-minted one-shot auxiliary calls; hiding them by default + inheriting the parent's clientHint (omp, not UA-sniffed claude) fixes the reported flood and mislabel.

② Regression audit (existing behaviors on the touched paths):

  • keepalive stays keyed on pool residency (src/web/sessions-data.ts:1016), not the new recency live — unchanged.
  • Non-paged buildSessionList (src/web/sessions-data.ts:1141) still returns children — script compat preserved.
  • master's kind filter kept verbatim; admin.ts paged-mode check now also triggers on the new kind/children params (new params — no existing consumer affected).
  • unfilteredTotal now reflects the child-hidden view — disclosed in the PR body.
  • lastSeen is real activity (updated on every request via stampExisting/adoptOrCreate); disk-only paths always pass resident=false → never live.
  • No cache/retry/incremental-cursor impact (web read path only). No kernel, no config surface, no model-facing text.

③ Code. WEB_ACTIVE_WINDOW_MS as a module constant (no magic number; no config knob — correct, config surface is owner-gated). parentConversationId() reuses the existing CHILD_CONVERSATION_SUFFIX regex from src/plugin.ts (no new parsing; no circular import — verified). clientHint inheritance degrades gracefully (parent absent from the summary set → own hint kept).

④ Tests. The two new regression tests assert real behavior in both directions (idle-2h resident → live:false, fresh → live:true, state filter discriminates, overview count; children hidden by default / revealed with showChildren + omp inheritance). Not tautologies. The i18n parity test now pins the ko keys.

⑤/⑤b Diff & code hygiene. Clean: 8 files, every line on-topic; clear naming, no dead code, no new dependencies, trilingual i18n consistent with the repo's style.

结构化八问

  1. 是什么问题:Web UI 会话页的 Live 筛选是空操作(长驻 daemon 上 104/104 全标 live,实际只有 ~3 个活跃);且 65 个 :side:/:sub: 一次性辅助会话以顶层行形式刷屏列表、并显示 UA 嗅探出的错误 client(claude 而非 omp)。
  2. 什么原因导致的:live 字段语义 = "在内存池中驻留",而池只在达到数量/字节上限时才驱逐——长驻进程里自启动以来见过的会话全部 live:true;子会话是客户端铸造的一次性辅助调用,列表未将其与顶层会话区分。
  3. 影响范围与严重程度:仅 Web UI 会话页(列表筛选/概览计数/行与详情徽标)+ GET /__bili/sessions 的 live 字段契约——以 live:true 为键的脚本/自动化现在只拿到最近 10 分钟内活跃的会话(PR 正文已披露)。p2:可用但明显误导。
  4. 怎么修复的:P1 = recency-gated active(在内存中 AND lastSeen 10 分钟内,复用仓库既有 active/fresh 惯例常量);P2 = 子会话默认隐藏(?children=1 显式开启)+ 子会话继承父会话 clientHint。
  5. 是否有回归问题:逐项审过——keepalive 仍按池驻留计(不变);非分页 buildSessionList 仍含子会话(脚本兼容);master 的 kind=top|child 筛选([PR] feat(web): filter top-level and child sessions #7594)原样保留且与新开关可组合;unfilteredTotal 语义变化已披露;无缓存/重试/游标影响。无回归。
  6. 是否破坏缓存:不涉及——纯 web 读路径。
  7. 是否改了设计方向:不涉及——无架构/边界/数据流转向,仅 live 字段语义(旧→新已披露)。
  8. 是否引入了新的配置:无——10 分钟窗口为模块常量(config surface owner-gated,未加 knob)。

判定:可合。 head 6e19d1921,CI 30 项全绿(27 success / 3 skipped / 0 failed),mergeable。等你合并:#7894

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

CI-engineer run: no merge conflict to resolve — the PR is already up to date with master.

I verified the live state before touching the branch, and there is nothing for this lane to fix:

  • No merge conflict. The PR head 6e19d1921dd already contains the latest master 24ba3ad09e8. git merge-base --is-ancestor confirms master is an ancestor of the head, and a real test-merge of master into the head returns "Already up to date". The head commit itself is Merge branch 'master' into 2026-11-28_sessions-live-active-side-filter (fastpath #7891, no overlap) — i.e. the conflict this lane was triggered on was already resolved by that merge (a prior run / the author) before this run started.
  • CI is green. All 30 checks on head 6e19d1921dd are success/skipped — 0 failed, 0 pending.
  • No [ework:ci-held] marker on the head — it is the final commit and its full CI pass has already completed.

So there was nothing to rebase, resolve, or push. I made no push (no changes to push; pushing would only churn the branch and re-trigger CI) and did not merge or approve (human-only).

The mergeable_state: blocked is not a conflict — it is the branch-protection review gate: the PR currently has 0 reviews and master requires an approving review. That step is owner/human-only.


八问

  1. 是什么问题: 任务触发原因是「PR 与 base 分支冲突 (merge state: dirty)」。但实测不存在合并冲突——PR head 已包含最新 master。
  2. 什么原因导致的: 触发信号已过期。PR head 提交 Merge branch 'master' into …(fastpath #7891, no overlap) 表明 master 早已被合入 PR 分支(上一轮或作者已完成),冲突在到达本轮前已解决。
  3. 影响范围与严重程度: 无影响。PR 已与 master 同步,30 项 CI 全绿,无用户可见影响。
  4. 怎么修复的: 无需修复。用 git merge-base --is-ancestor(master 是 head 的祖先)+ 真实 test-merge(返回 "Already up to date")双重确认无冲突;未做任何 push。
  5. 是否有回归问题: 不涉及——本轮无代码改动、无 push。
  6. 是否破坏缓存: 不涉及——无改动。
  7. 是否改了设计方向: 不涉及。
  8. 是否引入了新的配置: 不涉及。

收工判定: 本 PR 无合并冲突、CI 全绿,CI-engineer 侧无可做之事。剩余 blocked 状态是分支保护要求的 review 审批(当前 0 reviews),属 owner/人工步骤——满足 review 后即可合并。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[ework] CI fix verified green ✓

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 omp p2 scope/ui

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Web UI] Sessions page: Live filter matches every in-memory session; :side: sessions flood the list

1 participant