Skip to content

feat(web-shell): bridge trajectory history and live lifecycle state - #13952

Merged
qqqys merged 5 commits into
QwenLM:mainfrom
qqqys:codex/trajectory-pr6c
Oct 13, 2026
Merged

qqqys merged 5 commits into
QwenLM:mainfrom
qqqys:codex/trajectory-pr6c

Conversation

@qqqys

@qqqys qqqys commented Oct 12, 2026

Copy link
Copy Markdown
Collaborator

What this PR does

Connects the trajectory's historical window to bounded request and tool lifecycle state through the existing session subscription. Request details expose recorded lifecycle evidence. Reconnects preserve the historical page, selection, filters, and scroll position.

Paged session loads include a bounded in-memory lifecycle supplement at the same event watermark, so events published before persistence are still available. The SDK retains this metadata separately from chat replay and releases it after consumption. Snapshot gaps, epoch changes, and incomplete history remain explicit.

Why it's needed

A transcript file cursor cannot resume the live event stream. Loading a persisted page and subscribing from a bus watermark could miss a lifecycle event that had not reached disk. Replayed starts also cannot prove that an execution is still running. This supplies the continuity contract needed before adding live trajectory rendering and following.

Reviewer Test Plan

How to verify

  1. Open a recorded trajectory and inspect a request with an execution ID. Its recorded lifecycle should be associated with that execution without changing duration or usage totals; older records without identity remain readable.
  2. Browse to an older segment, filter and select a request, then reconnect. The page, filter, selection, and scroll position should remain stable, without another history load.
  3. Publish lifecycle events between snapshot loading and subscription, including while persistence lags. Observe one terminal state per execution after replay; repeated starts must not overwrite a terminal.
  4. Interrupt the stream, evict its ring, or restart the daemon. A recoverable short disconnect resumes; a gap or epoch reset requires a fresh snapshot. A later replay-complete marker alone must not clear the gap. Switching workspaces or sessions must reject the previous owner's events.

Local validation: build, bundle, full workspace typecheck, changed-file ESLint/Prettier, and 1,970 relevant tests passed (Web Shell 821, bridge 999, SDK 93, CLI redaction/Standalone 43, replay routes 5, App/artifact trajectory 9). These are targeted suites, not the entire repository test suite. Pre-commit formatting/lint passed and committed sources match the verification manifest.

Evidence (Before & After)

Controlled Chromium fixture, 1440×1000, using the real trajectory components and synthetic lifecycle data. These screenshots show the same implementation before and after reconnect, not a main-versus-branch visual comparison. The fixture omits the full App theme, so it is functional evidence rather than final visual acceptance.

Before reconnect After reconnect and a new generation
Before reconnect After reconnect

The historical four-page window, qwen filter, selected request #7, scroll offset 518, and history calls [0,1,2,3,4,5,6,7] stayed unchanged. The inspector displays the associated lifecycle evidence.

Real local daemon + controlled provider + SDK/source state tests passed snapshot-to-subscription replay, short disconnect, epoch mismatch, actual daemon restart detection, and ring eviction. A deterministic bridge test covers the unpublished-to-disk window; it is not real filesystem delay injection. A separate comment contains the E2E coverage and limits.

Tested on

OS Status
🍏 macOS ✅ Node 24.14.1; local daemon and Chromium fixture
🪟 Windows ⚠️ Not tested locally
🐧 Linux ⚠️ Not tested locally

Environment (optional)

Isolated local daemon configuration and runtime directories, loopback controlled model provider, and Chromium. No external model calls were needed for these E2E checks.

Risk & Scope

  • Main risk or tradeoff: recovery ordering and lifecycle identity across the bridge, SDK, and UI. Each request/tool collection is capped at 256 entries; paged replay supplements are capped at 1,024 frames, with explicit incompleteness. Replay supplements use the existing skill/workflow redaction paths.
  • Not validated / out of scope: full App-to-daemon browser recovery, real disk-delay injection, and native concurrent subagent/PostToolUse/permission E2E were not rerun. Live bars, automatic following, child pagination, and whole-session statistics remain follow-ups. Historical tool timings have no execution ID, so tool executions stay in a separate bounded collection instead of guessing an association with old rows.
  • Breaking changes / migration notes: optional additive replay metadata; no migration, new route, or additional session subscription. Route ownership remains unchanged; the supplement comes from the resolved runtime's session entry. Consumers are the ordinary and Standalone restore serializers, SDK load/replay consumption, session provider, trajectory projection, and inspector.

Linked Issues

Trajectory PR6C, following #13836.

中文说明

本 PR 的改动

通过现有会话订阅,将轨迹历史窗口接到有界的请求和工具生命周期状态。请求详情可查看已记录的生命周期证据。重连保持历史页、选择、筛选和滚动位置。

分页加载在同一事件水位下补带有界内存生命周期,保证已发布但尚未落盘的事件仍可获取。SDK 将这部分元数据与聊天回放分开保留,并在消费后释放。快照缺口、epoch 变化和历史不完整都有明确状态。

为什么需要

文件轨迹游标不能用于续订实时事件。读取持久化页后从总线水位订阅,可能遗漏尚未落盘的生命周期事件;回放中的开始事件也不能证明执行仍在运行。本 PR 为后续实时轨迹渲染和跟随提供接续契约。

评审验证计划

如何验证

  1. 打开历史轨迹,检查带 execution ID 的请求。生命周期应关联到对应执行,且不改变耗时或 usage 总计;缺少身份的旧记录仍可读。
  2. 浏览较早历史、筛选并选中请求,然后重连。页、筛选、选择和滚动位置应保持,且不额外加载历史。
  3. 在快照加载与订阅之间发布生命周期事件,包括持久化尚未完成的情况。回放后每个执行只有一个终态;重复开始不得覆盖终态。
  4. 中断流、使 ring 淘汰或重启 daemon。短断线可补发;缺口或 epoch 重置需要新快照。后续 replay-complete 标记不能单独清除缺口。切换工作区或会话后必须拒绝旧 owner 事件。

本地 build、bundle、全仓 typecheck、修改文件 ESLint/Prettier 和 1,970 项相关测试通过:Web Shell 821、bridge 999、SDK 93、CLI 脱敏/Standalone 43、replay 路由 5、App/artifact 轨迹 9。它们是相关测试集,不是全仓全部测试。提交钩子的格式和 lint 通过,提交源码与验证清单一致。

前后证据

上表为 Chromium 1440×1000 受控 fixture,使用真实轨迹组件和合成生命周期。截图展示同一实现重连前后,不是主干与分支的视觉对比。fixture 没有完整 App 主题,因此仅作为功能证据。

历史四页窗口、qwen 筛选、选中请求 #7、滚动位置 518 和分页调用 [0,1,2,3,4,5,6,7] 均保持不变。检查器显示对应生命周期。

真实本地 daemon、受控 provider、SDK/源码状态测试通过快照到订阅补发、短断线、epoch mismatch、实际 daemon 重启检测和 ring 淘汰。尚未落盘窗口由确定性 bridge 单测覆盖,不等同真实文件系统延迟注入。独立评论列出 E2E 范围与限制。

测试平台与环境

macOS(Node 24.14.1、本地 daemon、Chromium fixture)已测试;Windows、Linux 未本地测试。使用隔离的本地配置/运行目录及 loopback 受控模型服务;E2E 不需要外部模型调用。

风险与范围

  • 主要风险是 bridge、SDK、UI 间的恢复顺序和执行身份。请求/工具集合各最多 256 项,分页补充最多 1,024 帧,并显式标记不完整。补充回放沿用 skill/workflow 脱敏路径。
  • 尚未重跑完整 App 到 daemon 的浏览器恢复、真实落盘延迟、原生并发子代理/PostToolUse/权限提示 E2E。实时条带、自动跟随、子代理分页和全会话统计留后续。旧工具 timing 没有 execution ID,工具执行保存在独立有界集合中,不猜测与旧行的关联。
  • 协议仅新增可选回放字段,无迁移、新路由或额外订阅。路由归属不变;补充来自已解析 runtime 的 session entry。下游包括普通/Standalone 恢复序列化、SDK 加载及回放消费、会话 Provider、轨迹投影和检查器。

关联

轨迹 PR6C,承接 #13836。

@qqqys

qqqys commented Oct 12, 2026

Copy link
Copy Markdown
Collaborator Author

Independent E2E verification

Reviewed implementation: c39ad80cecbb5db8192023c7000d8efe89002718. Local macOS, Node 24.14.1. The committed product files match the source hashes verified before commit; pre-commit formatting and lint introduced no source changes.

Real daemon + controlled provider + SDK/source trajectory state

  • Snapshot-to-subscription race: replayed 19 frames, including the real read_file tool terminal, and reached live state.
  • Short disconnect: replayed 11 frames from the last applied watermark and recovered live state.
  • Epoch mismatch: resync followed by replay_complete did not clear stale state.
  • Actual daemon stop/restart: the epoch changed; the old epoch/watermark produced resync and the state remained stale until a fresh snapshot is supplied.
  • Ring-size 2 eviction: resync plus replay_complete kept state stale.

All three controlled scripts exited 0; model requests stayed on a loopback fixture provider. Test daemon/provider/browser processes were cleaned up.

Chromium functional fixture

1440×1000, real trajectory components with eight synthetic history pages. After navigating to the older four-page window, filtering qwen, selecting request #7 and opening its inspector, live delivery, reconnect, and a new generation retained the same historical window, filter, selection, scrollTop=518, and eight page calls. The PR body contains screenshots from before/after reconnect in this same implementation; they are not a main-versus-branch visual comparison and omit the full App theme.

Automated validation

Build, bundle, full-workspace typecheck, changed-file ESLint/Prettier and 1,970 relevant tests passed: Web Shell 821; bridge 999; SDK 93; CLI redaction/Standalone 43; replay routes 5; App/artifact trajectory 9. Bridge tests simulate published-but-unpersisted lifecycle frames and verify the bounded supplement at the same watermark. Provider React tests cover replay, reconnect, ring recovery, heartbeat auth failure and same-session cross-workspace replacement.

Limits

No real filesystem-delay injection, full App-to-daemon browser recovery, or new native concurrent subagent/PostToolUse/permission E2E was performed. Hosted CI is separate from these local results. Existing tool timings cannot be associated with executions without a stable execution ID, so those executions remain a separate bounded collection. No deployment or production validation is claimed.

@qwen-code-review-bot

qwen-code-review-bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Collaborator

🩺 serve daemon A/B

Built the PR base vs this PR head 456d098, drove a fixed endpoint set against each, and diffed the JSON responses. Only fields that changed are shown.

health-deep-with-session

field PR base (before) this PR (after)
activeWorkStaleMs 5 4

— Qwen Code · serve A/B

@qqqys
qqqys marked this pull request as ready for review October 12, 2026 07:34
@qwen-code-review-bot

qwen-code-review-bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Collaborator

🖼️ web-shell visual preview

Rendered against a mock daemon (no real backend): the PR base vs this PR head 456d098. Only screenshots that changed are shown (flows below, if any, are head-only) — refreshes on every push.

Screenshots · before / after

trajectory-clock-dark before/after

trajectory-clock-light before/after

trajectory-dark before/after

trajectory-light before/after

trajectory-range-dark before/after

trajectory-range-light before/after

trajectory-zoom-dark before/after

trajectory-zoom-light before/after

Full-resolution recordings (.webm) are attached to the workflow run.

— Qwen Code · web-shell visuals

@qwen-code-review-bot

qwen-code-review-bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Collaborator

✅ Qwen Triage finished — view run. See the stage comments in this thread for the result.

✅ Qwen Triage 已完成 —— 查看运行。结果见本线程中的各阶段评论。

@qqqys

qqqys commented Oct 12, 2026

Copy link
Copy Markdown
Collaborator Author

PR6C 独立验收:暂不通过

验收提交:c39ad80cecbb5db8192023c7000d8efe89002718,发布前确认 head 未变。

[P2] 缺口恢复会卸载轨迹面板,丢失正在浏览的历史窗口

Provider 遇到 ring eviction / epoch reset 后重新加载会话,常规路径会设置 loadingTranscript=true。App 的 loadingTranscript 分支 随即清空 tabs,卸载 TrajectoryPanel;恢复时即使复用同一个 loader,组件内部历史窗口状态也已经丢失。

独立 App 组件测试已复现:

  1. 打开 trajectory,加载 pages 0–3。
  2. 点击 Earlier segment,加载 pages 4–7,确认显示 Historical window。
  3. 保持 session、client、scope 不变,模拟恢复过程的 loadingTranscript: true → false。
  4. 实际分页调用从 [0,1,2,3,4,5,6,7] 变成 [0,1,2,3,4,5,6,7,0,1,2,3],Historical window 消失,保留旧窗口的断言失败。

这是完整 App 组件树配合 mock connection 的复现;Provider 设置该 flag 的路径另经源码核对。现有直接驱动 store 的浏览器 fixture 始终保持面板挂载,因此没有覆盖此路径。清空 tabs 的逻辑原已存在,但 PR6C 承诺的“缺口恢复保留历史位置”尚未在 App 集成层完成。

请在同一会话恢复时保留面板实例,或显式保存并恢复窗口及交互状态,同时保持跨 session/workspace 隔离;补充 App 层恢复回归,覆盖旧页、筛选、选择和视口,而不只测试 store 状态切换。

CI 门禁

Ubuntu Test 失败:build-artifact.test.ts:418 的 transcript entry 体积断言测得 1,328,613,要求小于 1,325,000。本轮未重建 base,尚未判定该失败是否完全由本 PR 引入,请定位后处理。

已通过与证据边界

  • 独立运行 835 项 Web Shell trajectory、相关组件及 Provider 测试通过;Web Shell typecheck 和 diff check 通过。上述新增 App 复现单独失败,未计入通过数。
  • 真实本地 daemon + loopback 受控 provider + SDK/源码 store 的快照后补发、短断线、epoch mismatch、实际 daemon 重启检测和 ring eviction 检查通过;缺口后的 replay_complete 没有错误解除 stale。
  • 核对 24 个源码文件及 2 个构建产物 hash 与验证清单一致;本轮复用现有构建,未独立全仓重建。
  • 未完成完整 App 到真实 daemon 的浏览器恢复、真实磁盘延迟注入及 native 并发子代理/PostToolUse E2E。

另有非阻塞测试建议:为生命周期 supplement 增加 turn_complete 后的覆盖。替身测试可复现既有 compaction 合并连续 request 元数据,但真实 backward transcript 读取会先 flush recorder,尚未证明构成生产环境新增缺陷,因此不将其列为第二个阻塞项。

@qwen-code-review-bot

Copy link
Copy Markdown
Collaborator

Thanks for the PR — this is a carefully built piece of work and the description is unusually honest about its own limits.

Template looks good ✓

Problem: Real, but it is an architectural gap rather than an observed user-facing bug. A cursor-paged transcript load and a bus-watermark subscription genuinely can disagree, and a replayed started genuinely cannot prove liveness — the SDK's own reduceExecutionLifecycle docblock says exactly that ("a replayed start does not prove a live request"). This is PR6C behind the already-merged #13836, so the recording half exists and this bridges it to the trajectory UI. Worth naming plainly: the consumer of the continuity contract (live bars, automatic following) is explicitly deferred to follow-ups, so part of what lands here has no reader yet — more on that below.

Direction: Aligned. The web-shell trajectory surface is actively developed, #13836 landed the native tool-execution lifecycle recording, and surfacing that recorded evidence in the inspector is the obvious next step. The wire change is additive and optional (lifecycleReplay / lifecycleReplayIncomplete), so old clients are unaffected, and no new route or second subscription is introduced. That said, it does extend the restored-session payload, which is a public SDK contract — the Stage 0 escalation below is what puts that in front of a maintainer.

Size: This spans four packages (acp-bridge, cli, sdk-typescript, web-shell), which makes it a core-infrastructure change under the gate's definition. Production logic 746 lines, tests 1,043 lines, generated/schema 0. Being feat-typed it is not size-blocked, but 746 ≥ 500 means it needs maintainer awareness rather than an automatic approval. The test-to-production ratio (~1.4:1) is genuinely good.

Approach: The shape matches what I would have designed independently — a bounded in-memory supplement emitted at the page's own watermark, carried as an optional additive field, folded client-side with terminal-wins semantics, owner/epoch-scoped, and gap-sticky until a fresh snapshot. Reuse is good: it drives the SDK's existing reduceExecutionLifecycle / reduceToolLifecycle rather than writing parallel reducers, and threads the existing skill/workflow redaction paths instead of inventing new ones. Two scope questions I'd want answered before merge:

  • Of the six fields on TrajectoryLifecycleProjection, production reads exactly one (byRowKey). byExecution, outsideWindow, status, incomplete and truncated have no consumer outside their own tests, and outsideWindow costs a filter-and-map over the merged set on every projection. Is that scaffolding for the follow-up PRs, or can it land with the code that reads it?
  • The whole tool lifecycle half is reduced, capped at 256 and merged per render, but only request rows ever join to a lifecycle entry — so nothing tool-related reaches the UI in this PR. That is a fair amount of machinery for zero visible effect today.

Neither is a blocker on its own; together they are the "would cutting this make the PR worse?" question.

Risk: No elevated risk signals — none of the changed paths match the revert-correlated set. The real risk sits in Stage 2: a required check is red on this head.

Moving on to code review. 🔍

中文说明

感谢贡献——这个 PR 做得很细致,描述对自身局限也相当坦诚。

模板完整 ✓

问题: 真实存在,但属于架构性缺口,而非已观测到的用户可见 bug。游标分页加载与总线水位订阅确实可能不一致,回放出的 started 也确实无法证明仍在运行——SDK 里 reduceExecutionLifecycle 的注释本身就写着"回放出的 start 不能证明请求仍在运行"。本 PR 是已合并 #13836 之后的 PR6C,记录能力已经存在,这里是把它接到轨迹 UI。需要直说的一点:接续契约的消费方(实时条带、自动跟随)明确留到后续 PR,所以本次落地的部分内容目前没有读者,详见下文。

方向: 对齐。web-shell 轨迹界面正在积极开发,#13836 已落地原生工具执行生命周期记录,把这些已记录的证据展示到检查器是自然的下一步。协议改动是可选新增字段(lifecycleReplay / lifecycleReplayIncomplete),旧客户端不受影响,也没有新增路由或第二个订阅。但它确实扩展了 restored-session 载荷,属于 SDK 公开契约——下面的 Stage 0 升级正是为此交由维护者判断。

规模: 跨四个包(acp-bridge、cli、sdk-typescript、web-shell),按门禁定义属于核心基础设施改动。生产逻辑 746 行,测试 1,043 行,生成/schema 0 行。因为是 feat 类型,不因规模被阻断,但 746 ≥ 500 意味着需要维护者知悉,不能自动批准。测试与生产代码比例约 1.4:1,相当好。

方案: 整体结构与我独立设想的方案一致——在页面自身水位上补发有界内存数据,作为可选新增字段承载,客户端以"终态优先"折叠,按 owner/epoch 限定作用域,出现缺口后保持粘性直到重新取快照。复用做得好:调用 SDK 已有的 reduceExecutionLifecycle / reduceToolLifecycle,没有另写一套;也沿用了既有的 skill/workflow 脱敏路径。合并前想请回答两个范围问题:

  • TrajectoryLifecycleProjection 的六个字段中,生产代码只读取了一个(byRowKey)。byExecution、outsideWindow、status、incomplete、truncated 除自身测试外没有消费方,而 outsideWindow 每次投影都要对合并集做一次 filter+map。这些是为后续 PR 预留的脚手架,还是可以等到有读者时再一起落地?
  • 工具生命周期这一半被完整 reduce、按 256 上限收敛、每轮渲染合并,但只有 request 行会关联生命周期条目——也就是说本 PR 中工具相关数据完全没有进入 UI。为当前零可见效果引入这套机制,成本偏高。

两者单独都不构成阻断,合起来就是"砍掉这部分会不会让 PR 变差"的问题。

风险: 无升级风险信号——改动路径均未命中与回滚相关的高风险集合。真正的风险在 Stage 2:当前 head 上有一个必需检查是红的。

进入代码审查 🔍

— Qwen Code · qwen3.8-max-2026-09-02

Reviewed at c39ad80cecbb5db8192023c7000d8efe89002718 · re-run with @qwen-code /triage

@qwen-code-review-bot

qwen-code-review-bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Collaborator

Code review

I read the diff against an independent proposal written first from the title and the "Why it's needed" section. The shape matched what I would have built — bounded supplement at the page's own watermark, optional additive wire field, terminal-wins fold, owner/epoch scoping, gap-sticky until a fresh snapshot — so this is a review of execution, not of direction.

🔴 Blocker: a required check is red on this head, and the diff is a cause

Test (ubuntu-latest, Node 22.x) fails deterministically (same assertion on all three retries):

FAIL  build-artifact.test.ts > build artifact — transcript entry (#11031)
      > keeps the transcript entry a fraction of the interactive entry
AssertionError: expected 1328613 to be less than 1325000
 ❯ build-artifact.test.ts:418:23
    418|     expect(js.length).toBeLessThan(1_325_000);

This is the transcript-entry size ceiling, not a flaky timing assertion. That test's own docblock states the daemon hook runtime is not absent from the transcript entry — MessageList renders components that call the strict daemon hooks, "so the provider guards ship". This PR adds a static import { createTrajectoryLiveStore } and TrajectoryLiveContext to DaemonSessionProvider.tsx, which pulls the new trajectory-live subsystem (plus the SDK lifecycle reducers it imports) into an entry that never renders the trajectory panel.

The docblock records main at 1,321,586 and this branch at 1,324,022 — about 978 bytes of margin, now overshot by 3,613. Some of that drift is main growing in parallel, which the docblock also documents as normal. But the PR cannot merge with a red required check either way, and I would not fix it by raising the ceiling: the docblock says to "re-measure and lower it if the entry gets leaner", i.e. the number is meant to bound real growth. The durable fix is to keep the store out of the transcript entry's static graph — lazy-import it, or hoist TrajectoryLiveContext.Provider above DaemonSessionProvider so the provider module does not statically depend on it.

Verified correct — the load-bearing contracts

These are the places where a silent mismatch would have made the feature a no-op while every test still passed, so I checked each against the SDK rather than trusting the names:

  • Key format matches exactly. Both trajectory-live-store.ts and project-trajectory-lifecycle.ts build JSON.stringify([sessionId, subagentId ?? null, executionId]), identical to reduceExecutionLifecycle's internal key. Had these diverged, the historical/live merge would never have hit.
  • The row join works. DaemonExecutionLifecycle.kind is 'request' and DaemonToolLifecycle.kind is 'tool', so the merged map cannot collide, and the row side only joins row.kind === 'request' — consistent with the inspector, which renders the new field inside its own row.kind === 'request' branch.
  • Terminal-wins is real, not asserted. The SDK keeps prior.event whenever prior.event.phase === 'ended', so a replayed start genuinely cannot overwrite a terminal, and a replayed start yields 'unknown' rather than 'running'. The PR's central claim holds.
  • The context is actually reachable. WorkspaceSessionProvider renders <DaemonSessionProvider> with <App> inside it, and the new provider wraps the provider's children — so ArtifactPanel → TrajectoryPanel → useTrajectoryWindow → useTrajectoryLiveSnapshot receives the real store, not the module-level empty fallback. This was my main worry going in and it is fine.
  • No dead parameter. Both createTrajectoryPageLoader call sites pass the new scope, and matches requires scope !== undefined, so the live merge is genuinely enabled in the App.
  • No missing i18n key. trajectory.inspector.details already exists in both locales on main ('Recorded details' / '记录详情').
  • Redaction is threaded, not bypassed. redactSdkSurfaceReplay delegates to the two helpers this PR updated, so all five response sites inherit lifecycleReplay redaction.
  • Stale is recoverable. The resync path nulls session/sessionRef and reloads, producing a new session object — so begin's candidate === owner early-return does not strand the store permanently. Degradation is explicit rather than silent.
  • The bridge cap keeps the most recent 1024 frames (splice(0, len - 1024)), which is the right end to keep.

Non-blocking

  • Unread surface. Of six fields on TrajectoryLifecycleProjection, production reads only byRowKey. byExecution has no reader at all; outsideWindow, status, incomplete and truncated are read only by their own tests, and outsideWindow costs a filter-and-map over the merged set on every projection. Relatedly, the tool-lifecycle half is reduced, capped and merged each render but never reaches the UI, since only request rows join. If this is scaffolding for the follow-up PRs, landing it with its first reader would keep this diff honest about what it does.
  • A convention divergence worth a thought. Every other session-scoped hook in DaemonSessionProvider.tsx throws outside its provider ("useDaemonConnection must be used within DaemonSessionProvider", and six more). useTrajectoryLiveSnapshot instead falls back to a shared module-level emptyStore, so a future mis-nesting degrades silently to status: 'unavailable' rather than failing loudly. Correct today; quieter than its neighbours.
  • Hardcoded cap. projectHistoricalLifecycle compares state.entries.size === 256 against the SDK's internal default (options.maxEntries ?? 256, clamped by Math.min(256, …)), which is not exported. Right today, silently wrong if the SDK cap moves. The eviction test pins the behaviour, which mitigates it.
  • Projection cost. Per event in the window, _meta is parsed up to three times — once in the eviction probe, then again inside each reducer — over up to ~3000 records on every page change, alongside the existing buildTrajectory replay; pages.flat() is also computed twice. Fine at these sizes, but it sits on the exact path the TRAJECTORY_MAX_PAGES docblock is careful about.
  • Small duplication. The stream cleanup now has two consecutive identical if (ownsCurrentSession || ownsEmptyState) blocks; the new one could fold into the existing one.
sequenceDiagram
    participant P1 as Bridge session entry
    participant P2 as SDK session client
    participant P3 as Session provider
    participant P4 as Trajectory live store
    participant P5 as Lifecycle projection
    participant P6 as Trajectory inspector
    P1->>P2: restored session, paged replay
    P1->>P2: lifecycle supplement at same watermark
    P2->>P3: replay snapshot with lifecycle frames
    P3->>P4: begin with owner, sessionId, scope, epoch
    P3->>P4: ingest each subscription event
    P4->>P4: fold, terminal wins over replayed start
    P4->>P5: live snapshot
    P5->>P5: join request rows by execution id
    P5->>P6: lifecycle for the selected row
Loading
Files changed (24)
File What changed
packages/acp-bridge/src/bridgeTypes.ts Two optional fields on the restored-session type
packages/acp-bridge/src/session-control-plane.ts Builds the metadata-only lifecycle supplement from the ring snapshot, capped at 1024
packages/acp-bridge/src/bridge.test.ts Covers the published-but-unpersisted window and the cap
packages/cli/src/serve/skill-details-redaction.ts Extends skill redaction to the new array
packages/cli/src/serve/workflow-session-gate.ts Extends workflow redaction to the new array
packages/cli/src/serve/routes/standalone-sessions.test.ts Asserts redaction reaches the new field
packages/cli/src/serve/server.test.ts Same for the ordinary restore route
packages/sdk-typescript/src/daemon/DaemonSessionClient.ts Carries the fields into the replay snapshot on both client paths
packages/sdk-typescript/src/daemon/types.ts Mirrors the two optional fields on the SDK type
packages/sdk-typescript/test/unit/DaemonSessionClient.test.ts Pins the pass-through
packages/web-shell/client/App.tsx Passes session scope to both loader call sites
packages/web-shell/client/components/artifacts/TrajectoryInspector.tsx One new summary row for a request's recorded lifecycle
packages/web-shell/client/components/artifacts/TrajectoryPanel.tsx Looks up the selected row's lifecycle and passes it down
packages/web-shell/client/daemon/session/DaemonSessionProvider.tsx Owns the store, seeds it from replay, ingests live events, invalidates on close/error/auth, adds the context provider
packages/web-shell/client/daemon/session/DaemonSessionProvider.test.tsx Replay seeding, short disconnect, workspace switch, ring eviction
packages/web-shell/client/trajectory/project-trajectory-lifecycle.ts New: folds historical pages and live snapshot, joins to rows by execution id
packages/web-shell/client/trajectory/project-trajectory-lifecycle.test.ts Terminal-wins, scope rejection, malformed metadata, eviction
packages/web-shell/client/trajectory/trajectory-live-context.tsx New: context plus a useSyncExternalStore hook
packages/web-shell/client/trajectory/trajectory-live-store.ts New: owner/epoch-scoped live lifecycle store with gap stickiness
packages/web-shell/client/trajectory/trajectory-live-store.test.ts Watermark dedupe, epoch reset, sticky gap, listener release
packages/web-shell/client/trajectory/transcriptPageLoader.ts Cache key gains scope; loader identity exposed via WeakMap
packages/web-shell/client/trajectory/transcriptPageLoader.test.ts Scope isolation and unscoped-loader identity
packages/web-shell/client/trajectory/useTrajectoryWindow.ts Exposes the lifecycle projection; guards pages against a superseded loader
packages/web-shell/client/trajectory/useTrajectoryWindow.test.tsx Window stability across live events and recovery

Test evidence

This is an unattended CI run, so per the gate's rules I did not build or execute any PR-derived code. Everything below is the PR's own CI, read through the API for the reviewed commit c39ad80cecbb5db8192023c7000d8efe89002718.

The suite is overwhelmingly green — 11,298 of 11,299 tests pass — and the single failure is the bundle ceiling analysed above. It is not pre-existing infra noise: it is a deterministic size assertion on a bundle this diff grows, and it failed identically on all three retries. Test (macos-latest) and Test (windows-latest) were skipped, so ubuntu is the only unit signal on this head.

Final CI results for c39ad80 (auto-updated by the triage finalize job after CI completed):

Check Conclusion
Test (ubuntu-latest, Node 22.x) ❌ failure
Capture web-shell visuals (ubuntu-latest, Node 22.x) ✅ success
Classify PR ✅ success
Desktop Shell (ubuntu-22.04) ✅ success
Desktop Shell (windows-2022) ✅ success
Flyway migration version uniqueness ✅ success
Hosted process fault gates / MySQL 8.4 / Java 21 ✅ success
Integration Tests (no-AK, No Sandbox) ✅ success
Lint & Static (ubuntu-latest, Node 22.x) ✅ success
Live Host (macos-latest) ✅ success
macos-latest / Java 21 ✅ success
OpenTUI no-flicker gate ✅ success
Real daemon E2E / Java 11 ✅ success
Runtime Broker and Managed Agent MariaDB / Java 21 ✅ success
Serve A/B (ubuntu-latest, Node 22.x) ✅ success
TUI parity snapshots (ink vs opentui) ✅ success
ubuntu-latest / Java 11 ✅ success
ubuntu-latest / Java 17 ✅ success
ubuntu-latest / Java 21 ✅ success
web-shell E2E Smoke (ubuntu-latest, Node 22.x) ✅ success
windows-latest / Java 21 ✅ success

One row per check name (latest run); skipped checks omitted; failures sort first. / 每个检查名一行(取最新一次运行),省略 skipped,失败项排在最前。

Three checks were still in flight at review time; I did not poll or guess their outcome. The Qwen Triage Finalize job updates the table above once CI settles.

The Serve A/B job found no response-shape regression (its only diff was activeWorkStaleMs 6 → 5, a timing artifact), which is good corroboration that the additive wire field did not disturb existing endpoints. The web-shell visuals job rendered one changed screenshot, but it runs against a mock daemon with no real backend, so it cannot speak to the live-lifecycle claim.

Not verified: the author's local results — 1,970 targeted tests, the Chromium fixture, and the real-daemon replay/eviction/epoch scripts — are the author's own claim on macOS, not independently re-run here, and I am not presenting them as evidence. The PR body itself scopes out "full App-to-daemon browser recovery", and the fixture omits the full App theme, so the App-level integration path is the gap.

Sandboxed verification would settle this: @qwen-code /verify — that the historical↔live join actually renders recorded lifecycle in the inspector against a real daemon through the real provider tree, and that terminal-wins and gap-stickiness hold end to end, is not observable from the diff. The unit tests pin the reducers well, but nothing exercises the App-to-daemon path, and a suite that passes with the join silently unmatched would look exactly like this one.

Real-scenario testing

N/A — unattended CI run. Per the gate's rules I never build or execute PR-derived code here; the live-behaviour signal is the sandboxed lane named above.

中文说明

代码审查

我先只根据标题和"为什么需要"独立写出方案,再对照 diff。整体结构与我独立设想的一致——在页面自身水位补发有界数据、可选新增协议字段、终态优先折叠、按 owner/epoch 限定、缺口保持粘性直到重新取快照——所以这是对实现质量的审查,而非对方向的审查。

🔴 阻断项:当前 head 上有一个必需检查是红的,且本 diff 是成因之一

Test (ubuntu-latest, Node 22.x) 确定性失败(三次重试断言完全相同):transcript 入口包体积超出上限,expected 1328613 to be less than 1325000(build-artifact.test.ts:418)。

该测试的注释明确说明 transcript 入口包含 daemon hook 运行时,因为 MessageList 渲染的组件会调用严格 daemon hooks,"所以 provider guards 会被打进包"。本 PR 在 DaemonSessionProvider.tsx 中静态引入了 createTrajectoryLiveStore 和 TrajectoryLiveContext,于是把新的 trajectory-live 子系统(及其引入的 SDK 生命周期 reducer)拉进了一个从不渲染轨迹面板的入口。

注释记录 main 为 1,321,586、本分支为 1,324,022,余量约 978 字节,现已超出 3,613 字节。其中一部分是 main 并行增长(注释也认为这属正常)。但无论如何,必需检查为红就不能合并;而且我不建议靠调高上限来解决——注释写的是"若入口变瘦应重新测量并调低",说明这个数字是用来约束真实增长的。更持久的修法是让 store 不进入 transcript 入口的静态依赖图:改为懒加载,或把 TrajectoryLiveContext.Provider 提到 DaemonSessionProvider 之外,使 provider 模块不静态依赖它。

已验证正确的关键契约

以下都是"一旦不匹配就会让整个功能静默失效、但测试照样全绿"的位置,所以我逐条对照 SDK 核实,而不是看名字推断:

  • 键格式完全一致。 trajectory-live-store.ts 与 project-trajectory-lifecycle.ts 都构造 JSON.stringify([sessionId, subagentId ?? null, executionId]),与 reduceExecutionLifecycle 内部键相同。若两者有偏差,历史与实时的合并将永远命中不了。
  • 行关联成立。 DaemonExecutionLifecycle.kind 为 'request'、DaemonToolLifecycle.kind 为 'tool',合并 map 不会冲突;行侧只关联 row.kind === 'request',与检查器中新增字段的渲染分支一致。
  • 终态优先是真的,不是声称的。 SDK 在 prior.event.phase === 'ended' 时始终保留 prior.event,所以回放的 start 确实无法覆盖终态;回放的 start 得到 'unknown' 而非 'running'。PR 的核心主张成立。
  • Context 确实可达。 WorkspaceSessionProvider 渲染 <DaemonSessionProvider> 且 <App> 在其内部,新 Provider 包裹 provider 的 children——因此 ArtifactPanel → TrajectoryPanel → useTrajectoryWindow → useTrajectoryLiveSnapshot 拿到的是真实 store,而不是模块级空回退。这是我最初最担心的一点,结论是没问题的。
  • 没有死参数。 两处 createTrajectoryPageLoader 调用都传了新的 scope,而 matches 要求 scope !== undefined,所以 App 中实时合并确实被启用。
  • 没有缺失 i18n key。 trajectory.inspector.details 在 main 的中英两份语言表中均已存在('Recorded details' / '记录详情')。
  • 脱敏是接通的,没有被绕过。 redactSdkSurfaceReplay 委托给本 PR 更新的两个 helper,因此五个响应出口都继承了 lifecycleReplay 脱敏。
  • stale 是可恢复的。 resync 路径会置空 session/sessionRef 并重新加载,产生新的 session 对象,所以 begin 的 candidate === owner 提前返回不会把 store 永久困住。降级是显式的,不是静默的。
  • bridge 的上限保留最近的 1024 帧(splice(0, len - 1024)),保留的是正确的一端。

非阻断项

  • 未被读取的接口面。 TrajectoryLifecycleProjection 六个字段中生产代码只读 byRowKey。byExecution 完全没有读者;outsideWindow、status、incomplete、truncated 只被自身测试读取,而 outsideWindow 每次投影都要对合并集做一次 filter+map。相关地,工具生命周期这一半每轮渲染都被 reduce、限流、合并,却从不进入 UI,因为只有 request 行会关联。如果这是为后续 PR 预留的脚手架,与第一个读者一起落地会让本 diff 更如实地反映它做了什么。
  • 一处约定差异值得考虑。 DaemonSessionProvider.tsx 中其他所有 session 级 hook 在 provider 之外使用时都会抛错("useDaemonConnection must be used within DaemonSessionProvider" 等共七处)。而 useTrajectoryLiveSnapshot 回退到共享的模块级 emptyStore,所以将来若嵌套错误,会静默降级为 status: 'unavailable' 而不是显式失败。今天是正确的,只是比它的邻居更安静。
  • 硬编码上限。 projectHistoricalLifecycle 用 state.entries.size === 256 对应 SDK 内部默认值(options.maxEntries ?? 256,并由 Math.min(256, …) 夹紧),而该常量未导出。今天正确,SDK 上限一旦变动就会静默失效。eviction 测试固定了行为,可部分缓解。
  • 投影开销。 窗口内每个事件的 _meta 最多被解析三次——eviction 探测一次,两个 reducer 内部各一次——在最多约 3000 条记录上、每次翻页都执行,且与既有 buildTrajectory 回放叠加;pages.flat() 也被计算了两次。在当前规模下没问题,但它正落在 TRAJECTORY_MAX_PAGES 注释所警惕的那条路径上。
  • 小的重复。 stream cleanup 中现在有两个连续且完全相同的 if (ownsCurrentSession || ownsEmptyState) 块,新增的那个可以并入已有的块。

(时序图见英文部分,此处不重复。)

测试证据

本次为无人值守 CI 运行,按门禁规则我没有构建或执行任何来自 PR 的代码。以下内容全部是通过 API 读取的、针对被审 commit c39ad80cecbb5db8192023c7000d8efe89002718 的 PR 自身 CI 结果。

测试套件绝大多数是绿的——11,299 项中 11,298 项通过——唯一失败就是上文分析的包体积上限。它不是既有的基础设施噪声:这是一个确定性体积断言,针对的正是本 diff 会撑大的产物,且三次重试失败完全一致。Test (macos-latest) 与 Test (windows-latest) 被跳过,所以 ubuntu 是本 head 上唯一的单测信号。

审查时有三项检查仍在运行;我没有轮询,也没有猜测其结果。CI 稳定后由 Qwen Triage Finalize 任务就地更新上方表格。

Serve A/B 未发现响应结构回归(唯一差异是 activeWorkStaleMs 6 → 5,属计时抖动),这佐证了新增的可选协议字段没有干扰既有接口。web-shell visuals 渲染出一张变化的截图,但它运行在没有真实后端的 mock daemon 上,因此无法说明实时生命周期这一主张。

未验证: 作者的本地结果——1,970 项定向测试、Chromium fixture、真实 daemon 的回放/淘汰/epoch 脚本——是作者在 macOS 上的自述,此处未独立重跑,我也不将其作为证据呈现。PR 正文自身也把"完整 App 到 daemon 的浏览器恢复"列为范围外,且 fixture 没有完整 App 主题,所以 App 级集成路径就是缺口所在。

沙箱验证可以解决这个问题:@qwen-code /verify——历史与实时的关联是否真的能在真实 daemon、真实 provider 树下把已记录生命周期渲染进检查器,以及终态优先与缺口粘性是否端到端成立,这些从 diff 看不出来。单测把 reducer 固定得不错,但没有任何测试走 App 到 daemon 的路径;一个"关联静默失配"也照样全绿的套件,看起来就和现在这个一模一样。

真实场景测试

N/A——无人值守 CI 运行。按门禁规则此处绝不构建或执行 PR 代码;实时行为信号来自上文点名的沙箱通道。

— Qwen Code · qwen3.8-max-2026-09-02

Reviewed at c39ad80cecbb5db8192023c7000d8efe89002718 · re-run with @qwen-code /triage

@qwen-code-review-bot

Copy link
Copy Markdown
Collaborator

Confidence: 2/5 — the engineering is genuinely good and every load-bearing contract I checked holds, but a required check is red on this head and the diff is a cause, so it cannot merge as-is.

Going back to the proposal I wrote before opening the diff: this PR matches it closely, and in a few places exceeds it. Reusing the SDK's existing lifecycle reducers instead of writing parallel ones was the right call, and threading the existing skill/workflow redaction paths rather than adding a new sanitiser is exactly how that should be done. The failure modes it defends against — epoch reset, ring eviction, watermark reuse, owner switch, a replay-complete marker arriving after a gap — are the ones I would have enumerated, and the test names show they are pinned individually rather than asserted in passing. keeps a gap sticky even after replay_complete and reconnect and invalidates changed epochs before comparing reused IDs are the kind of tests that catch real regressions later.

I spent most of my effort trying to break the join, because that is where this design can fail silently: if the client's key format drifted one field from the SDK's, or event.kind were 'execution' rather than 'request', every test would still pass and the feature would simply never match a row. It does not drift. Nor is the context unreachable — App renders inside DaemonSessionProvider, so the panel gets the real store rather than the module-level empty fallback. Those were my two worst-case scenarios and both are clean.

What stops me is the bundle ceiling. It is not a flake and it is not pre-existing noise: a deterministic size assertion on an artifact this diff grows, failing identically three times. The interesting part is why it grew — the transcript entry now statically pulls in the trajectory-live subsystem, which it never renders. That is the guard doing its job, catching an architectural leak rather than a rounding error, and raising the ceiling would discard the signal. It also happens to be the finding I would most want a maintainer to see, since the fix (lazy-import, or hoist the provider) is a small change with a real design implication.

My honest reservation beyond the blocker is the one from Stage 1, and the red check sharpens it rather than resolving it: five of six projection fields have no production reader, and the entire tool-lifecycle half is computed and merged every render without ever reaching the UI. The PR is upfront that live bars and following are follow-ups, so this is plumbing landed ahead of its consumer. That is a defensible way to sequence a six-part series — but it means the diff is larger than what this PR actually delivers, and the bundle ceiling is a concrete symptom of that: code with no reader in this entry is still being paid for in this entry.

Six months from now I would thank the author for the reducer reuse, the explicit staleness, and the tests; I would ask why the transcript entry ships trajectory-live code.

Two process notes for whoever picks this up. First, this spans four packages, which makes it core infrastructure under the gate's definition, and at 746 production lines it crosses the threshold where a feat needs maintainer awareness rather than an automatic approval — so even with the bundle fixed and the suite green, this should not merge on a bot approval alone. Second, the App-to-daemon path is the one thing nobody has exercised: the author scoped it out, the visual preview job runs against a mock daemon, and the unit tests stop at the reducers. @qwen-code /verify would settle it, and I would want that before merge rather than after.

Requesting changes on the strength of the red required check — that is a concrete, fixable blocker, not a judgement call about direction. @qqqys, the rest of this is close; the bundle fix and a decision on the unread surface are what stand between it and a merge.

中文说明

Confidence: 2/5 — 工程质量确实不错,我核查的每一个关键契约都成立,但当前 head 上有一个必需检查是红的,且本 diff 是成因之一,因此按现状不能合并。

回到我在打开 diff 之前写下的方案:本 PR 与之高度一致,某些地方还更好。复用 SDK 已有的生命周期 reducer 而不是另写一套,是正确选择;沿用既有的 skill/workflow 脱敏路径而不是新增一个脱敏器,也正是应该的做法。它所防御的失败模式——epoch 重置、ring 淘汰、水位复用、owner 切换、缺口之后才到达的 replay-complete 标记——就是我会列举的那些,而且从测试名称可以看出这些是被逐条固定的,不是顺带断言的。keeps a gap sticky even after replay_complete and reconnect 和 invalidates changed epochs before comparing reused IDs 属于那种日后真能挡住回归的测试。

我花了最多精力试图打破"关联"这一环,因为这是该设计唯一可能静默失效的地方:如果客户端的键格式与 SDK 差一个字段,或者 event.kind 是 'execution' 而非 'request',所有测试仍会全绿,而功能永远匹配不到任何一行。事实是没有偏差。Context 也没有不可达的问题——App 渲染在 DaemonSessionProvider 内部,所以面板拿到的是真实 store,而不是模块级空回退。这两个最坏情形都是干净的。

拦住我的是包体积上限。它不是抖动,也不是既有噪声:这是一个确定性的体积断言,针对的正是本 diff 会撑大的产物,且三次失败完全一致。更值得注意的是它为什么变大——transcript 入口现在静态引入了 trajectory-live 子系统,而它从不渲染这个子系统。这正是该守卫在发挥作用:它抓到的是架构上的泄漏,而不是四舍五入的误差;调高上限会把这个信号丢掉。这也恰好是我最希望维护者看到的一条,因为修法(懒加载,或把 Provider 上提)改动很小,却有实质的设计含义。

除阻断项之外,我真实的保留意见就是 Stage 1 提到的那条,而这次的红灯让它更尖锐,并没有化解它:六个投影字段中有五个没有生产读者,整个工具生命周期这一半每轮渲染都被计算和合并,却从不进入 UI。PR 坦率地说明实时条带与跟随属于后续工作,所以这是先于消费方落地的管道代码。对一个六部曲系列来说,这样的排期是可以辩护的——但它意味着 diff 比本 PR 实际交付的东西更大,而包体积上限正是这一点的具象症状:在这个入口里没有读者的代码,仍然要由这个入口付出体积代价。

六个月后回看,我会感谢作者在 reducer 复用、显式 staleness 和测试上的用心;但我会问,为什么 transcript 入口要打包 trajectory-live 代码。

给接手的人两条流程提示。第一,本 PR 跨四个包,按门禁定义属于核心基础设施,746 行生产代码也已越过 feat 需要维护者知悉、而非自动批准的阈值——所以即使修好包体积、测试全绿,也不应仅凭机器人批准合并。第二,App 到 daemon 这条路径是唯一无人验证过的:作者将其列为范围外,可视化预览任务跑在 mock daemon 上,单测止步于 reducer。@qwen-code /verify 可以解决这一点,我希望它在合并之前跑,而不是之后。

基于必需检查为红这一条请求修改——这是一个具体、可修的阻断项,不是对方向的判断。@qqqys,其余部分已经很接近了;需要做的就是修包体积,并对未被读取的接口面做一个决定。

— Qwen Code · qwen3.8-max-2026-09-02

Reviewed at c39ad80cecbb5db8192023c7000d8efe89002718 · re-run with @qwen-code /triage

@qwen-code-review-bot qwen-code-review-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs a fix before this can merge — see my notes above. 🙏

Blocker: Test (ubuntu-latest, Node 22.x) is red on this head, deterministically (same assertion across all three retries):

build-artifact.test.ts > keeps the transcript entry a fraction of the interactive entry
AssertionError: expected 1328613 to be less than 1325000

The transcript entry ships DaemonSessionProvider, and this PR adds a static import of the trajectory-live store to that module — so the new subsystem is now bundled into an entry that never renders the trajectory panel. I'd fix the leak rather than raise the ceiling: lazy-import the store, or hoist TrajectoryLiveContext.Provider above DaemonSessionProvider so the provider module doesn't statically depend on it. That test's docblock explicitly asks for the ceiling to be re-measured downward when the entry gets leaner, so the number is meant to bound real growth.

Everything else I checked holds up well — the client/SDK key formats match exactly, event.kind is 'request' on both sides of the join, terminal-wins is genuinely enforced by the SDK reducer, the context is reachable from the panel, and both loader call sites pass the new scope. The reducer reuse and redaction threading are the right calls.

One thing to decide while you're in there: five of the six fields on TrajectoryLifecycleProjection have no production reader, and the tool-lifecycle half is computed and merged every render without reaching the UI. Fine if it's scaffolding for the follow-ups — just worth a deliberate choice rather than an accident.

Also flagging for maintainer awareness: this spans four packages (core infrastructure under the gate's definition) at 746 production lines, so it needs a human sign-off rather than a bot approval even once the suite is green. And nobody has yet exercised the App-to-daemon path — @qwen-code /verify would settle it.

中文说明

合并前需要先修一处——详见上面的审查意见。🙏

阻断项: 当前 head 上 Test (ubuntu-latest, Node 22.x) 为红,且是确定性的(三次重试断言完全相同):

build-artifact.test.ts > keeps the transcript entry a fraction of the interactive entry
AssertionError: expected 1328613 to be less than 1325000

transcript 入口会打包 DaemonSessionProvider,而本 PR 在该模块中静态引入了 trajectory-live store——于是这个从不渲染轨迹面板的入口,现在把新子系统一起打包了进去。建议修掉泄漏本身,而不是调高上限:改为懒加载 store,或把 TrajectoryLiveContext.Provider 提到 DaemonSessionProvider 之外,使 provider 模块不静态依赖它。该测试的注释明确要求在入口变瘦时把上限重新测量下调,说明这个数字是用来约束真实增长的。

其余我核查的部分都站得住——客户端与 SDK 的键格式完全一致,关联两侧的 event.kind 都是 'request',终态优先确实由 SDK reducer 强制保证,面板可以取到 context,两处 loader 调用都传了新的 scope。复用 reducer、沿用脱敏路径都是正确的选择。

顺手想请决定一件事:TrajectoryLifecycleProjection 六个字段中有五个没有生产读者,工具生命周期这一半每轮渲染都被计算和合并却进不了 UI。如果是为后续 PR 预留的脚手架那没问题——只是希望这是一个有意识的选择,而不是无意留下的。

另外提请维护者知悉:本 PR 跨四个包(按门禁定义属于核心基础设施),生产代码 746 行,因此即使测试全绿也需要人工签核,而非机器人批准。另外 App 到 daemon 这条路径尚无人验证——@qwen-code /verify 可以解决。

— Qwen Code · qwen3.8-max-2026-09-02

@qqqys

qqqys commented Oct 12, 2026

Copy link
Copy Markdown
Collaborator Author

[P2] 生命周期补充读取有损压缩结果,可能漏掉已发布但未落盘的请求

核实提交:a57b5089839d97510160e9252a82ee7ecdb92de1(发布前确认 head 未变化)。

session-control-plane.ts:8016–8024 使用 snapshotReplay().compactedTurns 构建 lifecycleReplay,但已完成 turn 的聊天压缩不是无损的生命周期存储。实际请求生命周期由 createTranscriptExecutionLifecycleUpdate 生成空文本 agent_message_chunk,没有 qwenDiscreteMessage;相邻消息会经 mergeTextSlot 合并,mergeTranscriptUpdateMeta 浅覆盖同名 executionLifecycle。

在该 head 直接运行 TurnBoundaryCompactionEngine 的受控脚本,发送同一 turn 两个 execution 各自的 started/ended,再发送 turn_complete,结果为:

before terminal [
  'attempt-1:started', 'attempt-1:ended',
  'attempt-2:started', 'attempt-2:ended'
]
after terminal [ 'attempt-2:ended' ]
degraded undefined

因此,当这个已完成 turn 的持久化仍落后时,分页结果没有第一个 execution,内存 supplement 也已经丢掉它;返回的 lastEventId 又越过这些事件,后续订阅无法补回。同时这里不会因该合并设置 lifecycleReplayIncomplete。这会破坏本 PR 要保证的“已发布但尚未落盘的生命周期仍可恢复”契约。

建议让补充来源保留每个 execution 的生命周期(例如避免生命周期帧进入有损文本合并),并补充 turn 完成后、持久化尚未完成 的回归。当前新增 bridge 测试只发送生命周期帧,没有触发 turn_complete,因此未覆盖该路径。

验证边界:这是 exact-head 压缩器脚本复现,加上 supplement 消费路径的源码核实,不是真实文件系统延迟 E2E。另独立运行了 trajectory、DaemonSessionProvider 与 App 相关测试,22 个文件 / 1,980 项通过;此前同会话恢复丢失历史窗口、筛选、选择及滚动位置的回归已通过,不再重复报告旧问题。

@qqqys

qqqys commented Oct 12, 2026

Copy link
Copy Markdown
Collaborator Author

已修复本条 P2,并补充了 turn 完成后的回归。提交:642acc33b58392c407a22b79a77760315a3fd1bf。

对应验收意见:#13952 (comment)

根因确实是请求生命周期帧进入了文本合并:同一 turn 中两个 execution 的 started/ended 在压缩后只剩最后一条元数据。现在请求生命周期帧独立保留,沿用现有 replay 字节预算和淘汰机制;生命周期 supplement 的 1,024 条上限与截断标记保持不变。

验证:

  • 修复前,实际 bridge 的 sendPrompt → turn_complete → compaction → loadSession 回归失败:持久化分页返回空时,supplement 仅剩第二个请求的 ended,且未标记不完整。
  • 修复后,同一场景保留两个请求的全部四个 started/ended 标记,watermark 一致,supplement 不包含聊天正文。
  • 额外通过真实生命周期帧构造器覆盖主请求和带 parentToolCallId 的请求在 turn 完成后的保留。
  • 完整 bridge 测试 1,000 项,以及压缩器、事件总线、生命周期测试 206 项通过;全仓 build、bundle、typecheck,改动文件 ESLint/Prettier 和 diff check 通过。

验证边界:这是确定性的 bridge/压缩器回归,模拟持久化尚未完成;未做真实文件系统延迟注入,也不代表完整浏览器到 daemon E2E。新提交的远端 CI 和复审仍需单独完成。

@qwen-code-review-bot qwen-code-review-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Partially reviewed — gaps disclosed. Suggestions are inline.

2 Suggestion-level finding(s) this review confirmed are already reported on this PR and are not repeated:

  • project-trajectory-lifecycle.ts:135-142 byExecution/outsideWindow have no production reader — already reported (review 5487929747 and triage comment 6120101450)
  • session-control-plane.ts:8064 lifecycleReplayIncomplete terminates in a field no production code reads — already reported (review 5487929747)

Not explored to full depth (tool budget reached): "agent reverse-audit (round 1)": whether a transcript page fetched for session X can carry executionLifecycle frames stamped with sessionId !== X — settling it needs the resume/fork path in…; "agent reverse-audit (round 1)": the third createTrajectoryPageLoader call site ( App.tsx:6604 ) was not read, so I did not confirm whether any production loader passes scope === undefined ;…; "agent reverse-audit (round 3)": whether expect(blocks).toEqual([]) in the two new bridge tests is vacuous — I confirmed the provider has no lifecycle-frame filter ( grep toolLifecycle|execut…; chunk 6: did not read the daemon's getSessionTranscriptPage route implementation to settle whether a history_truncated marker can appear in trajectory pages (bearing…; "agent reverse-audit (round 4)": whether the row side's executionId ( timing.executionId ← uiEvent['execution_id'] , acp-bridge/src/transcript-replay.ts:953-956 ) and the frame side's exe…, and 8 more.

Not reviewed: reverse audit — did not converge within the reverse-audit round cap of 5.

中文说明

仅完成部分审查,审查缺口已披露。 建议见行内评论。

本轮确认的 2 条建议级发现已在 PR 上报告过,不再重复发布(列表见上方英文部分)。

未探索到全部深度(达到工具调用预算):"agent reverse-audit (round 1)":whether a transcript page fetched for session X can carry executionLifecycle frames stamped with sessionId !== X — settling it needs the resume/fork path in…;"agent reverse-audit (round 1)":the third createTrajectoryPageLoader call site ( App.tsx:6604 ) was not read, so I did not confirm whether any production loader passes scope === undefined ;…;"agent reverse-audit (round 3)":whether expect(blocks).toEqual([]) in the two new bridge tests is vacuous — I confirmed the provider has no lifecycle-frame filter ( grep toolLifecycle|execut…;chunk 6:did not read the daemon's getSessionTranscriptPage route implementation to settle whether a history_truncated marker can appear in trajectory pages (bearing…;"agent reverse-audit (round 4)":whether the row side's executionId ( timing.executionId ← uiEvent['execution_id'] , acp-bridge/src/transcript-replay.ts:953-956 ) and the frame side's exe…,另有 8 条。

未审查:反向审计——在 5 轮的反审轮数上限内未收敛。

— qwen3.8-max via Qwen Code /review (v0.25.1)

compactedReplay = [...page.events, turnErrorEvent];
}
}
const lifecycleSnapshot = entry.events.snapshotReplay();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Suggestion] R1-2: The paged-restore branch builds its lifecycle supplement from an unconditional full snapshotReplay(), which costs twice over. First, it re-sends frames the persisted page already carries: the page is projected with includeTiming: true (history-replay-page.ts:486-487) and transcript-replay.ts:1709-1711 re-emits executionLifecycle/toolLifecycle frames from persisted telemetry records, so the same recent lifecycle frames ride in both arrays — up to 1024 duplicated events. That contradicts the field's own doc (bridgeTypes.ts:783, "Bounded in-memory lifecycle supplement for a persisted replay page") and the new test's name ("supplements a persisted page with %i unpersisted lifecycle frames"). The overlap is expected rather than incidental, because this branch is entered only when !entry.promptActive with unchanged epoch and watermark — i.e. the turn completed and persisted. Both reducers no-op on identical duplicates, so nothing renders wrong today; the cost is payload and serialization on the session-reopen path the surrounding code optimizes for. Second, latency: snapshot() is not memoized — it goes through flattenReplaySegments() (compactionEngine.ts:989-993, a slice().flatMap() over every retained event) and then liveJournalSnapshot('full') (:376-390, which rebuilds each merged text segment) — so every paged loadSession pays a full window flatten plus a full-journal rebuild to keep only the few frames whose _meta carries a lifecycle record. The branch two lines above deliberately uses the cheaper accessor, whose own docblock reads "Cheaper than snapshot(): no replay-window flatten." The call also drops the liveReplayMode parameter in scope at :7937 (used at :7948 and :8086), so a client that asked for summary still pays a full journal rebuild.

Witness:

witness: not run — no mutation or bench was applied. `review scratch-tree` returned
`available: false` (repo-local includeIf.gitdir points at a missing credentials file), so no
isolated tree existed to instrument; the mechanism is established by reading snapshot()'s call
chain and by the two texts that both say "unpersisted" (the field doc and the test name).

Suggested fix: add a bounded, lifecycle-only accessor on the event bus that walks the raw segments without flattening and yields only frames whose _meta carries executionLifecycle/toolLifecycle, honouring liveReplayMode; then filter the result against the record ids the persisted page already carried before assigning lifecycleReplay.

One premise the fix must not violate: a cheaper accessor must still read the full journal, not the summary one. isSummaryReplayEvent returns false for any session_update whose _meta.parentToolCallId is a non-empty string differing from its own toolCallId (replay-summary.ts:32-38), and EventBus.publish applies that projection before the ring and engine see the event when eventDetailMode === 'summary' (eventBus.ts:594-598). A subagent request-lifecycle frame carries exactly that parentToolCallId — the compaction test this PR adds parameterizes it (it.each([undefined, 'parent-tool'])) — so a summary-mode accessor would silently drop subagent lifecycle frames.

Acceptance criterion: extend the existing bridge.test.ts case that feeds both a persisted page and an in-memory window so it asserts refreshed.lifecycleReplay contains only frames absent from refreshed.compactedReplay/liveJournal; removing the dedup filter must turn it red.

中文说明

分页恢复分支用一次无条件的完整 snapshotReplay() 来构造 lifecycle 补充数据,这带来两重开销。第一,它会重复发送持久化页已经携带的帧:分页数据是以 includeTiming: true 投影出来的(history-replay-page.ts:486-487),而 transcript-replay.ts:1709-1711 会从持久化的 telemetry 记录中重新发出 executionLifecycle/toolLifecycle 帧,因此同一批近期 lifecycle 帧会同时出现在两个数组里——最多 1024 个重复事件。这与字段自身的文档相矛盾(bridgeTypes.ts:783:"Bounded in-memory lifecycle supplement for a persisted replay page"),也与新增测试的名称相矛盾("supplements a persisted page with %i unpersisted lifecycle frames")。这种重叠是必然而非偶然,因为只有在 !entry.promptActive 且 epoch 与水位线都未变化时才会进入该分支——也就是回合已完成并已持久化。两个 reducer 对完全相同的重复帧都是空操作,所以目前不会渲染出错;代价体现在会话重新打开这条路径上的负载与序列化开销,而周围代码恰恰是为这条路径做优化的。第二,延迟:snapshot() 没有做记忆化——它会经过 flattenReplaySegments()(compactionEngine.ts:989-993,对所有保留事件做 slice().flatMap()),再经过 liveJournalSnapshot('full')(:376-390,会重建每一个合并后的文本段)——因此每次分页 loadSession 都要付出一次完整的窗口展开加一次 full journal 重建,只为留下少数几个 _meta 中带 lifecycle 记录的帧。而就在上面两行的分支刻意使用了更廉价的访问器,其文档注释写着 "Cheaper than snapshot(): no replay-window flatten."。此处调用还丢弃了作用域内的 liveReplayMode 参数(:7937 定义,:7948 与 :8086 使用),所以请求 summary 的客户端仍会付出一次 full journal 重建。

证据:

witness: not run — 未做变更或基准测试。`review scratch-tree` 返回 `available: false`
(仓库本地 includeIf.gitdir 指向一个缺失的凭据文件),因此没有可用于插桩的隔离代码树;
该机制是通过阅读 snapshot() 的调用链,以及字段文档与测试名称这两处都写明 "unpersisted"
的文本确立的。

建议修复:在 event bus 上增加一个有界的、只取 lifecycle 的访问器,它直接遍历原始分段而不做展开,只产出 _meta 中携带 executionLifecycle/toolLifecycle 的帧,并遵守 liveReplayMode;然后在赋值给 lifecycleReplay 之前,用持久化页已携带的 record id 过滤结果。

修复必须遵守的前提:更廉价的访问器仍必须读取 full journal,而不是 summary journal。isSummaryReplayEvent 对任何 _meta.parentToolCallId 为非空字符串且与自身 toolCallId 不同的 session_update 都返回 false(replay-summary.ts:32-38),并且当 eventDetailMode === 'summary' 时,EventBus.publish 会在 ring 与 engine 看到事件之前就应用该投影(eventBus.ts:594-598)。子代理的 request-lifecycle 帧恰好携带这样的 parentToolCallId——本 PR 新增的 compaction 测试就对其做了参数化(it.each([undefined, 'parent-tool']))——因此 summary 模式的访问器会静默丢弃子代理的 lifecycle 帧。

验收标准:扩展 bridge.test.ts 中那个同时提供持久化页与内存窗口的既有用例,断言 refreshed.lifecycleReplay 只包含 refreshed.compactedReplay/liveJournal 中不存在的帧;去掉去重过滤后该断言必须变红。

— qwen3.8-max via Qwen Code /review (v0.25.1)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed as a bounded performance improvement; deferred to PR7. This round keeps the existing full replay snapshot because subagent lifecycle records can live in that journal, and introducing a separate event-bus accessor would expand the repair. Page/supplement overlap is now documented and covered by idempotent request/tool replay tests. Follow-up: measure maximum-window refresh allocation and add a lifecycle-specific extraction path with subagent and truncation coverage. Leaving this thread open.

subagentId?: string;
executionId: string;
}) =>
JSON.stringify([item.sessionId, item.subagentId ?? null, item.executionId]);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Suggestion] R1-4: The store-level running → unknown downgrade is one-way: an execution the client actually observed live is downgraded by a transient stream_closed, and then cannot be re-promoted even after the store itself reports 'live' again — because the forced-'replay' source override here blocks the reducer's live arm. unknownRunning (:57-80) rewrites stored entries and nothing restores them. After reconnect() plus replay_complete puts the snapshot back at 'live', re-delivering the same live 'started' frame still yields 'unknown', because applyLifecycleUnchecked forces source: 'replay' for any key already in entries, and both reducers grant 'running' only for prior?.status === 'running' || options.source === 'live' — the prior is now 'unknown', so neither disjunct holds. The sibling projection computes the same downgrade reversibly at read time (project-trajectory-lifecycle.ts derives it from live.status and never mutates the store), so the same stored 'running' entry projects 'unknown' at 'stale' and 'running' at 'live'. To be fair to the diff's intent: the reducer's contract is "a replayed start does not prove a live request" (execution-lifecycle.ts:129) and trajectory-live-store.test.ts pins the reconnect-window downgrade deliberately, so that part is a design decision and not a defect. But that doctrine answers a start never seen live; nothing argues the third state this gate also covers — discarding a liveness fact the client observed live and then refusing to re-accept it once the store reports 'live'. Two scoping notes: the wrong window runs from the drop until the execution ends (the 'ended' frame still resolves the terminal, so it is not permanent), and the observable surface is narrow — the entry reaches only TrajectoryInspector.tsx:107 as a JSON.stringify dump, so the cost is "status": "unknown" instead of "status": "running" in the request inspector's Summary tab, with no row badge, filter or tone keying off it.

Witness (probe against the real createTrajectoryLiveStore and the real projectTrajectoryLifecycle):

{"observedLive":["running"],
 "afterInvalidate":["unknown"],     <- invalidate(owner,'stream_closed')
 "afterReconnect":["unknown"],      <- reconnect(owner)
 "backToLiveStatus":"live",         <- replay_complete restored 'live'
 "afterRedelivery":["unknown"],     <- the SAME live 'started' frame re-delivered
 "projectedNotLive":["unknown"], "projectedLive":["running"]}  <- projection IS reversible

Suggested fix: distinguish "entry is terminal" from "entry was downgraded to unknown" so a genuinely live re-delivery can re-promote — in applyLifecycleUnchecked, pass source: 'live' when the incoming source is live and the existing entry's status is 'unknown' (rather than forcing 'replay' for every known key), or record a downgradedFrom marker in unknownRunning and let a later live frame clear it.

One premise the fix must not violate: the forced-'replay' override is not simply deletable, because without it a duplicate live 'started' frame would clobber a terminal 'success' back to 'running' via the reducer's source === 'live' disjunct. trajectory-live-store.test.ts pins both directions — 'keeps replay %s starts unknown and only new live starts running' and 'preserves %s terminal evidence across duplicates and reconnect' (asserting ['success','unknown'] immediately after reconnect()) — so a fix must keep terminals terminal. The re-promotion variant is untested.

Acceptance criterion: a new case in trajectory-live-store.test.ts that seeds a live 'running' entry, calls invalidate(owner,'stream_closed'), reconnect(owner), ingests replay_complete, then re-delivers the same live 'started' frame and asserts the entry is 'running' again; removing the re-promotion must turn it red.

中文说明

store 层的 running → unknown 降级是单向的:客户端确实实时观察到的执行会被一次瞬时的 stream_closed 降级,之后即使 store 自身已重新报告 'live',也无法被重新提升——因为此处强制的 'replay' source 覆盖挡住了 reducer 的 live 分支。unknownRunning(:57-80)会改写已存储的条目,而没有任何逻辑会把它恢复。在 reconnect() 加 replay_complete 把 snapshot 重新置为 'live' 之后,重新投递同一个实时 'started' 帧仍然得到 'unknown',因为 applyLifecycleUnchecked 对任何已存在于 entries 的 key 都强制 source: 'replay',而两个 reducer 都只在 prior?.status === 'running' || options.source === 'live' 时才授予 'running'——此时 prior 已是 'unknown',两个析取项都不成立。同一 PR 中的投影层则以可逆方式在读取时计算同样的降级(project-trajectory-lifecycle.ts 从 live.status 推导,从不修改 store),因此同一个存储为 'running' 的条目在 'stale' 时投影为 'unknown',在 'live' 时投影为 'running'。为本 PR 的意图说句公道话:reducer 的契约是 "a replayed start does not prove a live request"(execution-lifecycle.ts:129),而 trajectory-live-store.test.ts 也刻意固定了重连窗口内的降级行为,所以那部分是设计决定而非缺陷。但该原则针对的是从未实时见过的 start;这个判断同时覆盖的第三种状态却没有任何理由支持——即丢弃客户端已实时观察到的存活事实,并在 store 报告 'live' 之后拒绝重新接受它。两点范围说明:错误窗口从降级持续到该执行结束('ended' 帧仍会解析出终态,因此不是永久的);可观察面很窄——该条目只以 JSON.stringify 转储的形式到达 TrajectoryInspector.tsx:107,所以代价是请求检查器 Summary 页里显示 "status": "unknown" 而非 "status": "running",没有任何行标记、筛选器或色调依赖它。

证据(针对真实的 createTrajectoryLiveStore 与真实的 projectTrajectoryLifecycle 探针运行):

{"observedLive":["running"],
 "afterInvalidate":["unknown"],     <- invalidate(owner,'stream_closed')
 "afterReconnect":["unknown"],      <- reconnect(owner)
 "backToLiveStatus":"live",         <- replay_complete 恢复了 'live'
 "afterRedelivery":["unknown"],     <- 重新投递同一个实时 'started' 帧
 "projectedNotLive":["unknown"], "projectedLive":["running"]}  <- 投影层是可逆的

建议修复:区分"条目已终态"与"条目被降级为 unknown",使真正的实时重投递能够重新提升——在 applyLifecycleUnchecked 中,当传入 source 为 live 且已有条目状态为 'unknown' 时传 source: 'live'(而不是对所有已知 key 一律强制 'replay');或者在 unknownRunning 中记录一个 downgradedFrom 标记,让后续的 live 帧清除它。

修复必须遵守的前提:强制 'replay' 的覆盖不能简单删除,否则一个重复的 live 'started' 帧会通过 reducer 的 source === 'live' 析取项把终态 'success' 覆盖回 'running'。trajectory-live-store.test.ts 同时固定了两个方向——'keeps replay %s starts unknown and only new live starts running' 与 'preserves %s terminal evidence across duplicates and reconnect'(断言 reconnect() 之后立即为 ['success','unknown'])——因此修复必须保持终态仍为终态。该重新提升变体尚未经测试验证。

验收标准:在 trajectory-live-store.test.ts 中新增用例——先种入一个 live 的 'running' 条目,调用 invalidate(owner,'stream_closed')、reconnect(owner),摄入 replay_complete,再重新投递同一个实时 'started' 帧,断言该条目重新变为 'running';去掉重新提升逻辑后该断言必须变红。

— qwen3.8-max via Qwen Code /review (v0.25.1)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keeping the conservative behavior. replay_complete establishes replay delivery completion, not current execution liveness; a repeated started record does not prove that work survived a disconnect. Added request/tool regressions showing unknown survives a duplicate start and terminal evidence settles it. Promoting old starts would recreate false running state. Leaving this semantic disagreement open for reviewer/maintainer confirmation.

Comment thread packages/web-shell/client/App.tsx Resolved
Comment thread packages/acp-bridge/src/bridgeTypes.ts Resolved
});
await flushPromises();
});
expect(snapshot?.status).not.toBe('live');

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Suggestion] R1-12: Mutation and coverage instrumentation over the unmodified tree found twelve sites where the production logic this PR adds can be deleted, or a clause simplified, and the entire suite stays green — including the test at this anchor, whose name claims to pin the retention behaviour this PR was written to fix. Every site below was established by mutating an isolated copy of the PR commit and running the affected suites, with a control mutation proving the harness does detect changes nearby, so these are holes in specific tests rather than a weak suite. The sharpest three: (a) this test — the only one pinning trajectory retention across a same-id workspace switch — asserts status not.toBe('live') and !tools.entries.some(running), and both hold on an empty store (clear() publishes emptySnapshot() whose status is 'unavailable' and whose tools.entries is empty), so replacing the teardown invalidate at DaemonSessionProvider.tsx:4588 with clear() leaves the full web-shell suite byte-identical to baseline while every same-session workspace switch blanks the panel for the whole load window; (b) trajectory-live-store.test.ts:120 — the only epoch-less case never passes an epoch to ingest, so neither leg that makes an epoch-less seed recoverable is witnessed, and removing snapshot.epoch !== undefined && at trajectory-live-store.ts:189 leaves 11305 tests green while converting the cursor-less-attach path reported separately on this review into a permanently frozen store; (c) session-control-plane.ts:8036 — the toolLifecycle half of the new supplement has zero producer coverage (its spread's true arm executed 0 times against 1030 for the executionLifecycle arm), mirrored on the consumer side where the provider fixture emits toolLifecycle exclusively (EXEC=0 TOOL=12 against a control arm's EXEC=276 TOOL=268), so the two halves are never exercised together on any path — and the request half is the user-visible one, since byRowKey can only ever hold execution entries.

Witness (all arms ran in isolated /tmp copies of commit 642acc33b5; the shared review worktree was never edited):

(a) m-fb1a  invalidate(:4588) -> clear()   web-shell 25 failed | 11280 passed = byte-identical to baseline
    m-fb1b  line deleted                    provider file 1 passed
    m-fb1ctl (:4784 reason flattened)       provider file FAILS both heartbeat auth tests   <- control
(b) MUT1 remove `snapshot.epoch !== undefined &&` (:189)  426 files / 11305 tests / EXIT=0
    MUT2 `(epoch ?? snapshot.epoch)` -> `snapshot.epoch`  11305 passed / EXIT=0
    CTL  remove `epoch !== snapshot.epoch` (:190)         2 failed | 17 passed (19)   <- control
    CTL  remove `epoch !== undefined &&` (:188)           15 failed | 4 passed (19)   <- control
(c) v8 coverage, acp-bridge 56 files / 2651 tests: L8050 `? { toolLifecycle: ... }` count=0;
    branch 8049:54-8050:64 true arm =[0]; control L8047 `? { executionLifecycle: ... }` count=1030
(f) MUTANT delete skill-details-redaction.ts:82-88  4 files / 1415 tests passed
    CONTROL delete workflow-session-gate.ts:77-83   3 tests FAIL (2 standalone + 1 load-response)
(g) m-fb3 delete scope arg at App.tsx:5952          App.test.tsx 2 files passed, suite harness-only
    m-fb3ctl identical deletion at App.tsx:6903     FAILS 'isolates trajectory recovery...': expected 8, got 12
(h) v8 coverage App.test.tsx (1144 tests): :6600 count=18, :6601 count=8, :6602 count=8, :6603 count=5
    -> the 8->8 step across `trajectoryAvailable` proves it short-circuited zero times
(i) instrumented invalidate: provider OVERRIDE=131 BLOCKED=316; all 131 overrides transient->transient,
    permanent `next` reasons: zero. m-fb5 guard simplified -> harness-only; m-fb5ctl deleted -> FAILS
(e) v8 br#1953 L8027 counts=[1], loop L8026 count=1182; m-fb2 both lines deleted -> 2651/2651 green
(j) m-fb4 drop `|| event.type === 'stream_error'` -> 19/19 passed; m-fb4ctl drop `session_died` -> FAILS
(k) MUTANT drop `candidate !== owner ||` from reconnect -> 19/19 and 822/822 passed;
    CONTROLS drop the same guard from ingest -> 2 failed, from invalidate -> 1 failed
(l) grep sweep: `lifecycle` in components/artifacts/*.test.tsx -> 0 matches; no test renders
    TrajectoryPanel or TrajectoryInspector under a populated TrajectoryLiveContext

Suggested fix — pin each site with the test its own control mutation proves the harness can see:

  • DaemonSessionProvider.test.tsx:826 (this anchor) — assert the retained shape instead of a negative: expect(snapshot).toMatchObject({ status: 'stale' }) plus the seeded entry surviving as 'unknown'. The App-level test does not cover this site: App.test.tsx:1123 mocks DaemonSessionProvider with a stub that just renders children, so the real store never runs there.
  • trajectory-live-store.test.ts:120 — add a case that ingests with an epoch argument and asserts adoption ({status:'catching-up', epoch:'b'}) then promotion to 'live'.
  • session-control-plane.ts:8036 — add a producer case feeding a toolLifecycle frame and assert it reaches lifecycleReplay.
  • DaemonSessionProvider.test.tsx:607 — parameterize the fixture over kind: 'tool' | 'request' and assert snapshot.requests.entries alongside snapshot.tools.entries, including one duplicated execution frame spanning the persisted page and the supplement.
  • session-control-plane.ts:8026 — one expect(refreshed.lifecycleReplayIncomplete).toBe(true) in bridge.test.ts:8181, the test that already executes that line (it currently asserts only compactedReplay).
  • skill-details-redaction.ts:82 — add a lifecycleReplay case to the existing describe('omitSkillDetailsFromReplayArrays'); the fixtures are already there.
  • App.tsx:5947 — add a retention pass after the button click in the 'opens one trajectory tab from the panel and reuses it' case.
  • App.tsx:6600 — add a case that withdraws the trajectory panel item and then enters a transient state.
  • trajectory-live-store.test.ts:108 — add invalidate('stream_closed') then invalidate('auth_failure') then reconnect then replay_complete, asserting the permanent reason survives.
  • trajectory-live-store.test.ts:88 — drive a real stream_error event through ingest, mirroring the session_closed/session_died case at :135.
  • trajectory-live-store.ts:175 — add a foreign-owner reconnect case asserting snapshot identity, seeded with a live or transient-stale snapshot.
  • TrajectoryPanel.tsx:1662 — render the panel under a populated TrajectoryLiveContext and assert the inspector's 'Recorded details' value; the label is not a unique selector (TrajectoryInspector.tsx:165 renders the same label for tool blocks), and a fixture needs executionId plus a loader built through createTrajectoryPageLoader or byRowKey is always empty and the test passes for the wrong reason.

One premise the fixes must respect, quoted from the tests that already exist: trajectory-live-store.test.ts:251-269 pins {status:'stale', reason:'epoch_reset', epoch:'b', lastEventId: undefined} for a defined-to-different-defined epoch change, so an epoch-less recovery case must not weaken that latch; skill-details-redaction.test.ts:155-161 pins expect(omitSkillDetailsFromReplayArrays(session)).toBe(session) and server.test.ts:17643-17649 pins immutable reshaping, so a redaction test must not invite an always-rebuild or mutating fix; and App.test.tsx:11588 resets mockConnection.sessionContext = undefined in beforeEach, where sessionContextKey(undefined) returns 'legacy' (session-context.ts:122-127) — a button-site retention test does not need a workspace context (the mutated site keys [sessionId, null] against retention's [sessionId, 'legacy'], already a mismatch) but it does need a retention pass after the click.

Acceptance criterion: each named control mutation is the criterion for its own site — the control already reddens, so the new test must reddish for the mutant that currently survives. For this anchor that is m-fb1a; for trajectory-live-store.test.ts:120 it is MUT1 and MUT2; for session-control-plane.ts:8036 it is the toolLifecycle disjunct and the spread at :8049.

中文说明

在未修改的代码树上做变更测试与覆盖率插桩,发现了十二处:删除本 PR 新增的生产逻辑、或简化其中某个子句之后,整个测试套件仍然全绿——其中包括本锚点处的这个测试,而它的名字声称固定了本 PR 为修复而写的保留行为。下面每一处都是通过在 PR 提交的隔离副本中做变更后运行相关套件确立的,并且都配有一个对照变更来证明测试框架确实能检测到附近的改动,因此这些是具体测试中的漏洞,而不是套件本身太弱。最关键的三处:(a) 本测试——唯一固定"同 id 工作区切换时轨迹保留"的测试——断言 status not.toBe('live') 与 !tools.entries.some(running),而这两条在空 store 上都成立(clear() 发布的 emptySnapshot() 其 status 为 'unavailable',tools.entries 为空),因此把 DaemonSessionProvider.tsx:4588 处拆卸时的 invalidate 换成 clear(),整个 web-shell 套件的失败集合与基线逐字节相同,而实际上每次同会话工作区切换都会在整个加载窗口内让面板空白;(b) trajectory-live-store.test.ts:120——唯一的无 epoch 用例从不向 ingest 传 epoch 参数,因此让无 epoch 种子可恢复的两条逻辑腿都没有被见证,而去掉 trajectory-live-store.ts:189 的 snapshot.epoch !== undefined && 之后 11305 个测试仍全绿,同时把本次评审另行报告的"无游标 attach"路径变成一个永久冻结的 store;(c) session-control-plane.ts:8036——新补充数据的 toolLifecycle 那一半在生产端覆盖率为零(其展开表达式的真分支执行 0 次,而 executionLifecycle 分支为 1030 次),消费端也对称地如此:provider 的测试夹具只发 toolLifecycle(EXEC=0 TOOL=12,而对照臂为 EXEC=276 TOOL=268),所以两半在任何路径上都从未被同时验证——而 request 那一半才是用户可见的一半,因为 byRowKey 只可能持有 execution 条目。

证据(所有分支都在提交 642acc33b5 的隔离 /tmp 副本中运行;共享的评审工作树从未被修改):

(a) m-fb1a  invalidate(:4588) -> clear()   web-shell 25 failed | 11280 passed = 与基线逐字节相同
    m-fb1b  整行删除                        provider 文件 1 passed
    m-fb1ctl(:4784 原因被压平)            provider 文件 两个心跳鉴权测试均 FAIL   <- 对照
(b) MUT1 去掉 `snapshot.epoch !== undefined &&`(:189)  426 files / 11305 tests / EXIT=0
    MUT2 `(epoch ?? snapshot.epoch)` -> `snapshot.epoch`  11305 passed / EXIT=0
    CTL  去掉 `epoch !== snapshot.epoch`(:190)          2 failed | 17 passed (19)   <- 对照
    CTL  去掉 `epoch !== undefined &&`(:188)            15 failed | 4 passed (19)   <- 对照
(c) v8 覆盖率,acp-bridge 56 files / 2651 tests:L8050 `? { toolLifecycle: ... }` count=0;
    分支 8049:54-8050:64 真分支 =[0];对照 L8047 `? { executionLifecycle: ... }` count=1030
(f) 变更:删除 skill-details-redaction.ts:82-88   4 files / 1415 tests passed
    对照:删除 workflow-session-gate.ts:77-83    3 个测试 FAIL(2 个 standalone + 1 个 load-response)
(g) m-fb3 删除 App.tsx:5952 的 scope 参数        App.test.tsx 2 files passed,全套件仅剩环境问题
    m-fb3ctl 在 App.tsx:6903 做完全相同的删除    FAILS 'isolates trajectory recovery...':期望 8 次,实际 12 次
(h) v8 覆盖率 App.test.tsx(1144 tests)::6600 count=18、:6601 count=8、:6602 count=8、:6603 count=5
    -> `trajectoryAvailable` 处 8->8 的台阶证明它一次都没有发生短路
(i) 对 invalidate 插桩:provider OVERRIDE=131 BLOCKED=316;131 次覆盖全部是 transient->transient,
    永久原因作为 `next` 出现:0 次。m-fb5 简化守卫 -> 仅剩环境问题;m-fb5ctl 删除守卫 -> FAILS
(e) v8 br#1953 L8027 counts=[1],循环 L8026 count=1182;m-fb2 删除两行 -> 2651/2651 全绿
(j) m-fb4 去掉 `|| event.type === 'stream_error'` -> 19/19 passed;m-fb4ctl 改去 `session_died` -> FAILS
(k) 变更:从 reconnect 去掉 `candidate !== owner ||` -> 19/19 与 822/822 passed;
    对照:从 ingest 去掉同一守卫 -> 2 failed;从 invalidate 去掉 -> 1 failed
(l) grep 扫描:components/artifacts/*.test.tsx 中 `lifecycle` -> 0 匹配;没有任何测试在已填充的
    TrajectoryLiveContext 下渲染 TrajectoryPanel 或 TrajectoryInspector

建议修复——为每一处补上其对照变更已证明框架能看见的那个测试:

  • DaemonSessionProvider.test.tsx:826(本锚点)——断言保留后的形态而不是一个否定式:expect(snapshot).toMatchObject({ status: 'stale' }),加上种入的条目以 'unknown' 存活。App 层测试并不覆盖此处:App.test.tsx:1123 把 DaemonSessionProvider mock 成一个只渲染 children 的桩,因此真实 store 在那里从不运行。
  • trajectory-live-store.test.ts:120——新增一个带 epoch 参数摄入的用例,断言先被采纳({status:'catching-up', epoch:'b'})随后提升为 'live'。
  • session-control-plane.ts:8036——新增一个生产端用例,喂入一个 toolLifecycle 帧并断言它进入了 lifecycleReplay。
  • DaemonSessionProvider.test.tsx:607——把夹具按 kind: 'tool' | 'request' 参数化,并在断言 snapshot.tools.entries 的同时断言 snapshot.requests.entries,其中包含一个横跨持久化页与补充数据的重复 execution 帧。
  • session-control-plane.ts:8026——在 bridge.test.ts:8181(即已经执行到该行的那个测试,目前只断言 compactedReplay)中加一句 expect(refreshed.lifecycleReplayIncomplete).toBe(true)。
  • skill-details-redaction.ts:82——在现有的 describe('omitSkillDetailsFromReplayArrays') 中增加一个 lifecycleReplay 用例;夹具已经具备。
  • App.tsx:5947——在 'opens one trajectory tab from the panel and reuses it' 用例中,于点击按钮之后补一次保留流程。
  • App.tsx:6600——新增一个先撤下 trajectory 面板项、再进入瞬时状态的用例。
  • trajectory-live-store.test.ts:108——新增 invalidate('stream_closed')、再 invalidate('auth_failure')、再 reconnect、再 replay_complete,断言永久原因得以保留。
  • trajectory-live-store.test.ts:88——让一个真实的 stream_error 事件经过 ingest,与 :135 处的 session_closed/session_died 用例对称。
  • trajectory-live-store.ts:175——新增一个外来 owner 调用 reconnect 的用例,断言 snapshot 引用不变,且需以live 或瞬时 stale 的 snapshot 作为起点。
  • TrajectoryPanel.tsx:1662——在已填充的 TrajectoryLiveContext 下渲染面板,并断言检查器 'Recorded details' 的取值;该标签不是唯一选择器(TrajectoryInspector.tsx:165 对 tool 块渲染同一标签),且夹具需要带 executionId 并通过 createTrajectoryPageLoader 构造 loader,否则 byRowKey 恒为空、测试会因错误的原因通过。

修复需要遵守的前提,均引自现有测试:trajectory-live-store.test.ts:251-269 固定了"已定义 epoch 变为另一个不同的已定义 epoch"时得到 {status:'stale', reason:'epoch_reset', epoch:'b', lastEventId: undefined},因此无 epoch 恢复用例不得削弱该闩锁;skill-details-redaction.test.ts:155-161 固定了 expect(omitSkillDetailsFromReplayArrays(session)).toBe(session),server.test.ts:17643-17649 固定了不可变重塑,因此脱敏测试不得诱导出"总是重建"或"修改入参"的修法;App.test.tsx:11588 在 beforeEach 中把 mockConnection.sessionContext = undefined 重置,而 sessionContextKey(undefined) 返回 'legacy'(session-context.ts:122-127)——按钮站点的保留测试不需要工作区 context(被变更的站点以 [sessionId, null] 为键,而保留逻辑以 [sessionId, 'legacy'] 为键,本就不匹配),但确实需要在点击之后走一次保留流程。

验收标准:每一处点名的对照变更就是该站点自身的标准——对照已经会变红,因此新增测试必须让当前能存活的那个变更体变红。就本锚点而言是 m-fb1a;就 trajectory-live-store.test.ts:120 而言是 MUT1 与 MUT2;就 session-control-plane.ts:8036 而言是 toolLifecycle 析取项与 :8049 处的展开。

— qwen3.8-max via Qwen Code /review (v0.25.1)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the requested targeted assertions in 9f388aeb43: retained unknown entry during workspace recovery; epoch adoption; tool supplement producer; request/tool Provider consumers plus page/supplement duplicates; incomplete marker; immutable supplement redaction; button-opened tab retention and host opt-out; transient-to-permanent invalidation; stream_error ingestion; foreign reconnect; and actual request lifecycle values in Recorded details. The affected suites pass. Several behavior regressions were checked fail-before, but the entire mutation matrix in this comment was not rerun, so I am leaving this thread open rather than claiming full mutation acceptance.

@qqqys

qqqys commented Oct 13, 2026 •

Copy link
Copy Markdown
Collaborator Author

Addressed the review at 642acc33b5 in 9f388aeb43.

  • Fixed R1-1, R1-3, R1-5–R1-11: token-frame notifications, cursorless live transition, owner-state leakage, lifecycle/history-gap notices, restored tab order, API documentation, truncation scan and duplicate cleanup invalidation.
  • R1-2: bounded snapshot scanning/dedup optimization deferred to PR7; kept open with the follow-up scope.
  • R1-4: retained conservative unknown after disconnect until terminal evidence. Replay completion and duplicate starts are not proof of current liveness; kept open for semantic confirmation.
  • R1-12: added the requested targeted assertions across producer, Provider, store, redaction and UI. Kept open because the full reviewer mutation matrix has not been rerun.

Validation on this revision: repository build, bundle and typecheck passed; Web Shell 2,105 tests, bridge 1,001 tests and CLI/documentation contracts 23 tests passed; ESLint, Prettier and diff checks passed. The transcript bundle budget passed unchanged. Several regressions were verified failing before the corresponding fix. This is deterministic local verification, not a new real daemon/browser E2E run. Hosted CI for this pushed revision is reported separately.

Update: hosted Lint & Static on 9f388aeb43 failed at the lint-gate freshness check because main introduced CI commit aceb7f122329; it did not reach source lint. Merged main 8bd33e222f without conflicts, producing 456d09840b. On the merged revision, build, bundle, repository typecheck, all PR-file lint/format checks, 2,113 Web Shell tests (including the unchanged transcript budget), and 23 CLI/documentation contract tests pass. Independent merge review confirmed the trajectory changes were retained. The 1,001 bridge tests passed before this merge; the merge does not change that package. New hosted CI is pending.

@yiliang114 yiliang114 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving at 456d0984.

Note on the red light: the only CHANGES_REQUESTED on this PR (review 5487929747) is pinned to c39ad80c. Its blocker — the transcript-entry bundle budget — is resolved at the current head: Test (ubuntu-latest, Node 22.x) and Lint & Static are both green on 456d0984. The delta 9f388aeb…456d0984 is a merge of main only, so the R1 fix round is what is being approved.

What I verified at this head:

  • The R1 fixes claimed in 9f388aeb are present: text frames advance the cursor without publishing, cursorless promotion waits for an epoch, the owner guard rejects foreign begin/reconnect/invalidate, and the keep-session cleanup invalidates exactly once.
  • Supplement confinement: the bridge re-wraps only _meta.executionLifecycle / _meta.toolLifecycle into lifecycleReplay, and both redaction paths (skill details, workflow gate) now thread the new array.
  • Join safety: a lifecycle frame stamped with another sessionId (e.g. from a forked transcript) can never join a row — the projection keys on the loader's sessionId + scope, so cross-stamped frames fail closed.
  • The terminal-wins, transient-vs-permanent invalidation, and epoch/ring-eviction semantics match what the new store and provider tests pin down.

Already on the record and non-blocking: R1-2 (bounded snapshot scan) is deferred to PR7, and the unread projection fields (byExecution, outsideWindow) are declared scaffolding for the live-bars follow-up. I left one new P3 inline about the gap notice also firing on the plain artifactsLoading path.

CI: everything required is green at 456d0984; web-shell E2E Smoke, Hosted process fault gates, and Capture web-shell visuals were still running when I submitted this — pending checks, not a finding.

setArtifactPanelOpen(shouldOpen);
setArtifactPanelTabs([]);
setActiveArtifactPanelTabId(null);
retainCurrentTrajectory();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P3 · non-blocking] retainCurrentTrajectory() also runs on the plain artifactsLoading branch, so an artifact-list reload with no transcript gap still bumps historyGapRevision and shows “History may have changed while disconnected” until a manual refresh. Might be worth bumping the revision only in the loadingTranscript / status !== 'connected' branches, or keying the notice off an actual stream-gap signal from the live store.

@qwen-code-dev-bot qwen-code-dev-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved at head 456d098, after completing a full read of the production surface.

This supersedes my earlier pass on this PR, which declined to sign on capacity grounds after reading only the two redaction sites. That was an honest boundary at the time and it is no longer the state of my knowledge: I have now read every production hunk in this diff, all eighteen files, plus the new live-store module in full and the provider store call sites and teardown in context. What follows is what I verified, and the coverage statement at the end says what I still did not do.

Gate 1. Head SHA fixed as above and every conclusion targets that SHA only.

Gate 2. Thirteen review threads, nine resolved and four open, and I read all four open ones in full rather than counting them. None is a Critical and each carries a disposition from its own author.

Two are the round-2 Suggestions the author deliberately left open. The paged-restore supplement is built from an unconditional full snapshot, which costs duplicate frames and a flatten on the reopen path; the author confirmed it as a bounded performance improvement, deferred it to the follow-up, documented the overlap and added idempotent replay tests. The store-level running-to-unknown downgrade is one-way; the author kept the conservative behaviour on the stated ground that a replay-complete signal establishes delivery and not current liveness, added regressions showing an unknown entry survives a duplicate start and that terminal evidence settles it, and left the semantic disagreement open for a maintainer. The maintainer who approved this head did not answer that thread explicitly, so I record it as implicitly ratified rather than settled, and I do not adopt it as a blocker: the wrong window is bounded by the ended frame, the observable surface is a single inspector field, and the projection layer computes the same downgrade reversibly, so the two layers disagree in a direction that is conservative rather than lossy.

The third is the mutation-coverage report, which found twelve sites where added production logic could be deleted or simplified with the whole suite still green, each established against an isolated copy with a control mutation proving the harness detects nearby changes. The author added eleven targeted assertions in response, covering the retained unknown entry across workspace recovery, epoch adoption, the tool supplement producer, the request and tool provider consumers with page and supplement duplicates, the incomplete marker, immutable supplement redaction, button-opened tab retention with host opt-out, transient-to-permanent invalidation, stream-error ingestion, foreign reconnect, and real request lifecycle values in the recorded details. The author states plainly that several were checked fail-before but the full mutation matrix was not re-run, and left the thread open rather than claiming acceptance. That is the right way to leave it, and it is a verification-completeness gap rather than a known defect.

The fourth is a P3 marked non-blocking by its own author, who approved one second later: the retention helper also runs on the plain artifacts-loading branch, so an artifact-list reload with no transcript gap still bumps the gap revision and shows the disconnected notice until a manual refresh. Real, small, and correctly labelled.

There is no Critical anywhere in this record and no necessary Suggestion outstanding.

Gate 3. Twenty-three substantive groups at this head, all settled green, nothing pending, cancelled or failing, read over full pagination. Skipped lanes are counted as settled, which is how I read this repository throughout, and I disclose that this is a judgement. The round-2 review noted that the CLI integration lane, where the renderer matrix lives, was skipped and that its author did not run it locally; the real-renderer verification anchored to this head by another reviewer covers that dimension, and I did not execute it myself.

Gate 4. No new Critical. I read the whole production surface and checked the mechanisms that would silently defeat this change if they were wrong.

The loader identity comparison is sound, and this was the first thing I tried to break. The retention helper filters open tabs by comparing a stored loader against a freshly constructed one with the strict equality operator, which would be permanently false and make the whole helper dead code if the factory returned a new closure per call. It does not: the factory is memoized through a WeakMap from client to a map keyed by the session id and scope serialized together, and returns the existing loader for that key. So the comparison is a real identity check. The same change is what makes it safe, because the cache key previously carried only the session id; adding the scope means one session under two workspace scopes yields two distinct loaders, so retention cannot carry a trajectory across a scope change. A second WeakMap records the session and scope each loader was built with, which is how the windowing hook later obtains an identity to match against the live store.

Cross-loader staleness is closed at the render boundary rather than only in an effect. The hook now tracks which loader its loaded pages belong to and returns an empty window state whenever that owner differs from the current loader, so there is no frame in which the previous session or scope can render its pages, its cursors, its navigation flags or its error state. Every returned field reads from that gated state rather than from the raw one, and I checked each of the fourteen rather than assuming the rename was applied uniformly.

Live data cannot bleed into the wrong panel. The projection only merges the live snapshot when the loader identity has a defined scope and both the session id and the scope match the store, and when they do not match it reports the status as unavailable and forces the incomplete flag true. Forcing incomplete rather than defaulting it false is the right direction: an unattributable live view is declared partial instead of being presented as whole.

Terminal evidence wins at two layers, not one. The projection skips a live entry when the historical entry for the same key has already ended, which is independent of the reducer contract that a replayed start does not prove a live request. Entry keys include the kind, the session, the subagent and the execution id, so a request and a tool entry for one execution cannot collide, and the historical projection uses the same composite key the store uses for its eviction accounting.

The accounting flags reach the user rather than dying in a data structure. Both new banner strings are rendered in the two places the panel shows status text, in both languages, and they are driven by the incomplete and truncated flags the projection returns. The store-side incomplete flag is itself a six-way disjunction that includes the case where a history page size was configured but the server sent no lifecycle supplement at all, so a missing supplement is reported as incomplete rather than silently treated as complete.

The supplement cannot carry content it should not. The control plane builds each supplement event from scratch, copying only the execution and tool lifecycle metadata out of the source frame, so transcript text and command or skill metadata are not present to leak. Both existing redactors were nevertheless widened to cover the new array, in the type bound, the early-return guard and the conditional spread, and the redaction test pins that the output is redacted, that the source event still carries the removed field, and that the array element is the same reference rather than a copy.

The external store contract is respected. The context module keeps a module-level empty snapshot and a stable subscribe fallback, which is what the store hook requires to avoid a new object per call, and it passes the same getter for both the client and server snapshot arguments. The provider store is created once through a memo with an empty dependency list and added to the two dependency arrays that use it, so its stable identity cannot cause those effects to re-run.

One thing I checked because it looked like a defect and is not. The retention helper evaluates the session-identity condition inside the filter callback rather than once outside it, which reads as though it were per-tab when it is constant for the call. It is harmless, since a false constant simply yields an empty retention set, which is the intended result when the session changed.

Non-blocking observations, recorded rather than requested.

Three of the six fields on the lifecycle projection have no reader in this diff. The row-key map and the two accounting flags are consumed; the by-execution map, the outside-window list and the status field are not, and the tool-lifecycle half of the merge is computed on every render without reaching the interface. The round-1 review asked for a deliberate choice here and I have not seen one recorded. If this is scaffolding for the follow-up, saying so in the design document would settle it; if it is not, the merge cost is being paid for nothing.

The gap notice is acknowledged only when a refresh produces a different trajectory reference. A successful refresh that returns the same reference leaves the disconnected notice standing. That is the conservative direction and I would not change it on my say-so, but it is worth knowing.

The compaction change routes an agent message chunk carrying execution lifecycle metadata into the discrete slot, and does not test for tool lifecycle metadata in the same place. If a tool lifecycle frame can ride that update type it would be merged into a text segment instead of staying discrete. I could not establish whether that combination occurs, so this is a question for the author and not a finding.

The cursor-less reconnect passes live-only mode when the session has no last event id, so the first ingested event is applied as a live source. The forced replay override for keys the store already holds covers the common case, and the projection additionally downgrades a running entry to unknown whenever the live status is not live. The residual case would be a key outside the replay window re-delivered on a cursor-less connection, and I could not establish from the client side whether the daemon replays history in that situation.

Coverage statement. I read all eighteen production hunks in this diff, the new live-store module in its entirety, the new projection and context modules in their entirety, the loader identity and memoization change, the provider store call sites including the epoch-reset reload path and the teardown cleanup, both collector and redaction sites, and the two new banner strings in both languages. I did not read the roughly nineteen hundred added test lines beyond the specific assertions quoted in the review record, so I can confirm that the production code is correct but I cannot confirm from my own reading that every new assertion bites. I executed nothing, ran no mutation testing, and rendered no component. My confidence about real renderer behaviour rests on the green lanes and on the verification others anchored to this head, not on my own execution.

Gate 5. Head SHA, PR state, checks over full pagination and unresolved thread count were re-read atomically immediately before submitting this review.

@qwen-code-review-bot

Copy link
Copy Markdown
Collaborator

Released in v0.25.2.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants