Skip to content

[PR] fix(web): select freshest disk session summaries - #7290

Merged
ranxianglei merged 1 commit into
ranxianglei:masterfrom
Afloat16:2026-11-19_select-freshest-session-summary
Nov 20, 2026
Merged

ranxianglei merged 1 commit into
ranxianglei:masterfrom
Afloat16:2026-11-19_select-freshest-session-summary

Conversation

@Afloat16

Copy link
Copy Markdown
Contributor

Fixes #7289.

Problem and change

When multiple disk files represent one session, the web index already selects a winner by newest savedAt, then modification time. The summary merge ignored that index and let the last file visited overwrite earlier summaries. A stale twin could therefore replace the title, request count and token totals shown by the session list, search and overview.

Read each selected file through the existing byId index. Live sessions retain precedence, and the authoritative unified-index path is unchanged. No new cache, configuration, dependency or storage format is introduced.

Validation

  • Two real-file regressions fail on the original production implementation, returning Old history instead of Current history. They cover newer saved data with an older filesystem timestamp, plus the modification-time tie-break when saved timestamps are equal.
  • Both pass after the change and check the list, overview totals, filtered page, warm-cache decode count and live-session precedence.
  • The web sessions, single-store, storage-fallback and billing-web suites pass together: 45 tests, no failures or skips.
  • A final focused run after removing an unnecessary fixture metadata field passes both regression cases.
  • npm run typecheck, the complete npm run build (kernel, Pi extension, main bundle and distribution checks), and git diff --check pass.

Validation uses Linux and Node.js 24.22.3 against master 04ecbb42dd38543e9c407bd40eb773ae5ec8b60b. The fixtures use private temporary directories and the real session serialization/indexing paths. This is a dashboard data-selection correction; no latency benchmark or change to the model-facing request path is claimed.

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

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

Review of #7290 (fixes #7289) — independent of the PR's own validation claims.

查重 (dedup): Not a duplicate. Searched open PRs — only this PR addresses the stale-twin selection in the file-backed dashboard summary path. (#5005 also matches the "7289" token but is an unrelated session-meter fix.)

标签 (labels): applied bug + p2 + scope/ui — a data-accuracy defect in the web dashboard (monitoring/stats surface), not tied to a specific client lane.

What I verified myself:

  • Pulled the branch, ran tests/web-sessions.test.ts: 31/31 pass on the PR head.
  • Reverted only the one-line source change (kept the new tests): both new regression cases fail — disk summaries select the freshest duplicate (savedAt priority) and (mtime tie-break) return Old history. So the tests are real regression tests, not tautologies.
  • npm run typecheck clean on the PR head.
  • Scanned the same-bug class (other byFile / files.values() iteration sites): the only other site is _diskScanStatsForTest (a count, not a selection) — no other read surface re-derives the winner by walk order.

Direction (①): The root cause is real. refreshIndex already computes byId (id → freshest abs by savedAt, then mtimeMs) at src/web/sessions-data.ts:576-590, but mergedSummaries ignored it and re-iterated byFile in walk order, so the last-walked twin won. The fix consumes the existing byId selection instead of re-selecting — a root-cause fix (疏), not a mask. Notably the detail path (src/web/sessions-data.ts:1310) already used byId?.get(id), so list/overview/page were the inconsistent ones; this aligns them.

Regression (②):

  • Single-file-per-id (the common case): byte-identical — byId maps the id to its only file, files.get(abs) returns the same summary.
  • Duplicate-id case: changes from last-walked-wins to freshest-wins — the intended fix.
  • Set of ids in the output: unchanged (byId keys = ids with ≥1 decodable file = the same set the old loop produced).
  • Live-session precedence: unchanged (the live loop still runs after the disk merge).
  • Authoritative unified-index path: untouched (skips the disk merge when fromRows).
  • Overview / byProtocol: aggregate from mergedSummaries(), so they inherit the fix.
  • Warm-cache decode count: preserved (the test asserts no extra decoding on a warm duplicate scan).
  • No threshold / default / timing / output-format drift.

Quality (②a / ⑤b): High. Minimal diff (+6/-1 source, +51/-1 test); the comment explains WHY (walk order would pick a stale twin); no dead code, no new deps, no magic numbers; naming clear; the test has real assertions covering both tie-break directions plus list/overview/page/warm-cache/live-precedence. No alignment refactor needed.

Diff cleanliness (⑤): 2 files, every line on-topic, no whitespace or lock-file churn.

One honest, non-blocking note (④): the test's ability to catch the original bug leans on the directory walk visiting z-stale after a-current (the a-/z- prefix biases that). The new behavior is walk-order-independent (byId is deterministic), so the test is deterministic for the fixed code on any platform; it just happens to also fail on the original code here.

CI at review time: in progress — 13 checks green, 11 skipped (gated e2e lanes), 9 still queued (gates + test-import-graph); the main hermetic test shards had not started yet. mergeable=true, mergeable_state=blocked (waiting on the remaining checks + review).


结构化八问

  1. 是什么问题:文件型 dashboard 汇总在「同一 session 有多个磁盘副本」时,列表/搜索/概览会显示旧副本(旧标题、旧请求数、旧 token 数),而不是最新副本。
  2. 什么原因导致的:refreshIndex 已按 savedAt 再 mtime 选出每个 id 的最新文件并记在 byId,但 mergedSummaries 没用它,而是按目录遍历顺序重放所有文件,后遍历到的旧副本覆盖了新副本——选择逻辑与索引脱节。
  3. 影响范围与严重程度:仅当某 session 存在多个磁盘文件(不同目录的孪生副本)时触发;影响 web 列表、过滤搜索、概览合计的显示准确性。能用但有明显数据错误 → p2(非 p1:不可用/缓存泄露均不成立;非纯外观:数字是错的)。
  4. 怎么修复的:直接消费索引已有的 byId 选择(每个 id 一条最新 abs),不再按遍历顺序重选;与本就正确的 detail 路径(byId?.get(id))对齐。属根因修复(疏),非在传输层过滤(堵)。
  5. 是否有回归问题:无。单文件每 id 的常见路径行为不变;id 集合不变;live 优先、authoritative 统一索引路径、warm-cache 解码计数、排序均未动;无阈值/默认值/时序/输出格式漂移。
  6. 是否破坏缓存:不。warm 重复选择零额外解码(测试钉住);不引入新缓存、不改失效策略。
  7. 是否改了设计方向:否。读表面从「遍历顺序」收敛到「索引选择」,是收敛到既有设计(byId 本就是权威选择),不是转向。
  8. 是否引入了新的配置:否。无新 env/config/默认值。

判定:可合(mergeable once CI green)。 方向对、根因修、无回归、diff 干净、测试是真回归测试。等 CI 的 hermetic test 分片跑绿即可合;合并权在 owner。

@Afloat16

Afloat16 commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor Author

(ai: OpenAI/GPT-6 Astra Pro)

CI follow-up, updated after the maintainer's targeted rerun: #7290's original core CI is now green on the unchanged head fd6c59beab305bc93a6d313158b9f54348694486. Windows/Node 22 shard 5, attempt 2 completed successfully at 15:49:39 UTC on November 19: 2,346 passed, 0 failed and 13 skipped. The client-cancel test that failed in the first attempt passed this time. All 11 core test legs and both static-gate jobs are successful; the complete core run is successful. No branch, source, configuration or test change was needed for this rerun.

The rerun resolves that red CI leg. The previously requested ci:full coverage remains distinct from these successful core runs, which do not include Windows/Node 24. Newer label-triggered runs skipped their test/static matrices.

PR Current head Original core CI
#7285 cee5b4e08100a5a3d54f5c666a82413b845d08ca 44500672265 — 11 test legs passed
#7290 fd6c59beab305bc93a6d313158b9f54348694486 44504539346 — all 11 test legs passed after the targeted rerun (attempt 2)
#7292 04a701772ee03582d42393b9cf331dcf077c6d0b 44508125687 — 11 test legs passed
#7294 377c00d3ec97c71064b1cce497126b68cae704bb 44515753256 — 11 test legs passed
#7298 46dfb1141ebb25885bde120ab6a275542ce4f62d 44521997259 — 11 test legs passed
#7304 69739fb411b96a575b4fdc80da441c2622a29581 44526050664 — 11 test legs passed

For #7285, the review's suggested merge order remains owner PR #7282 first, then update this contribution against that cache shape. #7279 already has its successful full matrix and does not need another request.

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

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

I verified the CI state live before responding.

#7290's red leg — confirmed, and unrelated to the diff. The original run's one failure is test (windows-latest, 22, 5) (job 135500871483); everything else in that run is green or skipped. The failing test, vscode-copilot #177 (2): client cancel aborts upstream and frees the session lock, is a streaming-POST cancel/lock e2e. This PR touches exactly two files — src/web/sessions-data.ts and tests/web-sessions.test.ts — i.e. the dashboard summary-selection loop on the GET routes. It does not touch src/server.ts or any copilot test, so the two don't share a code path. This is not a regression introduced by #7290's change; the likely explanations are a flaky leg or an inherited master failure, and a fresh run (or checking master's own Node 22 leg) is what disambiguates them.

On triggering ci:full: I'm not going to kick off ci:full across six PR heads from this comment. It's a resource action (six full matrices) and the request comes from an account that isn't the owner or on the trust list, so I'm treating it as something to route rather than a directive I execute. The other five PRs (#7285, #7292, #7294, #7298, #7304) are separate threads with their own reviewers — out of scope here regardless.

For #7290 specifically:

  • The code-review verdict stands: the change is correct, the two regression tests fail on the original implementation and pass on this head, typecheck is clean, and there's no regression from the diff.
  • The one red leg is unrelated to the diff. A single re-run of that failed leg — or a maintainer's ci:full if you also want the Windows/Node 24 coverage — is the right next step, and that's a call for @ranxianglei or a trusted maintainer to make.
  • If it turns out to be an inherited master failure, the standard fix is rebase / merging the CI-fixes lane, not a ci:full — worth confirming against master's own leg before spending a full matrix.

Leaving the re-run / ci:full decision to the owner. Nothing in #7290's diff blocks on it.

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

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

Live state re-verified, then the red leg was handled. No code change needed — the failure is a timing flake in a test this PR does not touch, and a targeted rerun is now in flight.

Live state at wake: the mirror showed 0 failed / 0 pending on head fd6c59beab, but that was misleading — the newest run (44539855348, label-triggered) was skip-scoped, so its "success" never re-ran the test matrix. The last real test run on this head (44504539346) still carried one red: test (windows-latest, 22, 5).

The red leg (job log verified):

  • Failing test: vscode-copilot #177 (2): client cancel aborts upstream and frees the session lock (tests/vscode-copilot.test.ts:242), ERR_ASSERTION: upstream fetch was not aborted after client cancel, duration 6049 ms — the test's 5-second observation window elapsed without seeing the upstream socket close.
  • Shard result: 2345 passed / 1 failed / 13 skipped; every other leg in the run is green.

Why this is a flake, not a regression (evidence):

  1. The PR diff touches exactly src/web/sessions-data.ts + tests/web-sessions.test.ts (dashboard summary selection on GET routes). The failing test is a streaming-POST client-cancel e2e — zero shared code path; src/server.ts and the copilot test are byte-identical to the PR base.
  2. The test's own comment documents this exact failure mode before: "on a windows-24 runner that lingered past the whole 5s poll window (run 38896091237 red, same-commit rerun green: flake, not a regression)".
  3. Master is not red: the latest completed master runs (a446a3c, 2026-11-18 19:21Z and 2026-11-19 01:26Z) are green; the PR-base run (04ecbb4) was cancelled, not failed; the test file is unchanged between the PR base and current master.
  4. origin/ci-fixes (7247410) is an ancestor of the PR base — merging it would be a no-op, so there is nothing inherited to pick up.

Action taken: triggered rerun-failed-jobs on run 44504539346 (HTTP 201) — the standard one-shot treatment for a load-timing flake, same as the #4599 practice (e.g. floors 1588 / 1575 / 1551). No push, no code change, no new issue (CI problems are coordinated in #4599, not new issues).

If the rerun goes red again: two consecutive reds on the same 5s-window assertion would point at a genuinely too-tight window, and the right move is a test-robustness fix on master/ci-fixes (widen the observation window) — that I would route as a 🔶 需要决策 rather than silently changing a master-owned test inside this external PR.

Note (not a CI failure): the PR is 17 commits behind master; that is a merge-time concern for the author/owner, not a check failure.


七问

  1. 是什么问题:PR [PR] fix(web): select freshest disk session summaries #7290 的 test (windows-latest, 22, 5) 分片红,唯一失败 = vscode-copilot #177 (2): client cancel aborts upstream and frees the session lock(断言 'upstream fetch was not aborted after client cancel',测试的 5 秒观察窗口内未看到上游 socket 关闭,耗时 6049ms)。
  2. 什么原因导致的:Windows runner 负载下的时序 flake——客户端取消 → 代理把 abort 传播到上游 socket 关闭的链路,在慢 runner 上超过了测试的 5 秒观察窗口。该测试注释自己记录了同签名前科(windows-24 run 38896091237 红、同 commit 重跑绿,注释原文判定 "flake, not a regression")。
  3. 影响范围与严重程度:仅此一个分片的一个测试;同 run 其余 10 个 test 分片全绿(2345 过 / 1 挂 / 13 跳);与本 PR diff(dashboard 汇总选择,GET 路由)零交集;master 近期 completed run 全绿,非继承红。
  4. 怎么处置的:不改代码、不推分支——对 run 44504539346 触发 rerun-failed-jobs(HTTP 201),只重跑红分片;这是 CI Control Center: Centralized CI Failure Handling & Status Sync (Comment all CI issues here; do not open new issues) | CI 总控: CI 失败集中处理与状态同步(所有 CI 问题在此评论, 勿开新 issue) #4599 台账对负载 flake 的标准处置(floors 1588/1575/1551 同型)。
  5. 是否有回归问题:不涉及——本次无任何代码/配置/测试改动,PR 分支 head 未动(fd6c59b)。
  6. 是否破坏缓存:不涉及——无缓存/重试/游标/去重键相关改动。
  7. 后续:等重跑结果(镜像缓存 ~60s 刷新);若同断言再红,升级为 master/ci-fixes 侧的测试健壮性修复(放宽观察窗口),走 🔶 需要决策,不在本外部 PR 里静默改 master 拥有的测试。另注:PR 落后 master 17 个提交,属合并时作者/owner 处理事项,非 CI 红项。

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

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

Rerun confirmed green — the PR is now clean. test (windows-latest, 22, 5) completed success on the rerun (15:41:19Z → 15:49:39Z, run 44504539346 attempt 2) — the 5s-window flake did not reproduce, confirming the load-timing diagnosis. Head fd6c59beab is now 11/11 test legs green + all guards/static-gates green (e2e lanes skip-scoped as usual). No code, config, or test changes were made on this run; the branch head is unchanged. Nothing left for the CI lane — merge is up to the owner (note the PR is 17 commits behind master, a merge-time concern).

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

[ework] CI fix verified green ✓

@ranxianglei
ranxianglei merged commit fb33082 into ranxianglei:master Nov 20, 2026
147 of 184 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working p2 root-cause scope/ui

Projects

None yet

Development

Successfully merging this pull request may close these issues.

File-backed dashboard summaries can prefer stale copies of a session

2 participants