fix(web): bind copied session selection to file identity - #584
Conversation
tt-a1i
left a comment
There was a problem hiding this comment.
The path-aware UI checks are a useful projection fix, but the mutation boundary still identifies a session only by its embedded ID. A copied JSONL can share that ID, so an in-flight request from the old file can still be admitted against the newly selected file. Please carry the canonical session path/file identity through the mutation protocol and enforce it in the host/runtime, with a regression covering a request that races a switch between copied sessions.
tt-a1i
left a comment
There was a problem hiding this comment.
审查提交:8bc6375ae65948ae0476c9ffb0675812137887d2。
需要修改后再合并。
具体问题
P1 · web/ui/src/store/web-store.ts:1275
Copied-session file identity is checked only in local projection. Prompt/model/thinking requests still carry only embedded sessionId, and server admission checks only that ID. Original and copied JSONL share it, so an already-in-flight original request arriving after selection of the copy is admitted against the wrong file. Carry canonical file identity or runtime generation through mutations and revalidate at admission.
验证范围
Reviewed complete production/test diff and current client/runtime request checks; 64 adapter/runtime tests passed, including copied-file projection and rename isolation. Existing exact-head finding remains applicable.
限制与后续
Did not independently run a delayed network race or browser E2E. Tests cover UI suppression after mismatch, not stale request admission.
已核对的 CI 失败
Run 35427046809:Web E2E 四项失败:暗色预期得到 light、运行状态按钮禁用、归档历史元素缺失、轨迹按钮等待超时;不能归为已确认基础设施故障。
8bc6375 to
0c035fd
Compare
tt-a1i
left a comment
There was a problem hiding this comment.
Re-reviewed 0c035fd. The copied-session mutation finding is addressed: prompt/model/thinking requests carry the file identity, Host validates it, and queued runtime mutations revalidate before execution. Local verification passed 96 Node tests and 128 UI/protocol tests. Current CI, including Web E2E and Windows, is green. This supersedes my previous request for changes. I did not independently rerun browser E2E locally.
Problem
A copied Pi JSONL session retains its embedded Session ID. Using that ID alone can read, rename, or mutate the wrong file. A UI-only selection guard is insufficient: a prompt/model/thinking request can arrive or execute after another tab activates a same-ID copy.
Fixes #583.
Value
Confirmed selection and subsequent mutations stay bound to the actual Session file. Stale requests fail closed instead of writing to a copy, and an uncertain command receipt cannot be rebound across files.
Approach
current:<id>identity for in-memory sessions.sessionPathon prompt, model, and thinking HTTP mutations. The host validates it, and runtime admission/serialized execution validates again after queue waits.Validation
0c035fd6287d12dcffc256ca7ad313b4aef58a30. Web unit/spec tests: 19 files / 279 passed with one worker;bun run checkpasses. A parallel attempt had one unchanged provider-settings timeout; no timeout/assertion was altered.Limitations: full local
bun run testhit its predeclared 240-second bound after reporting setup integration and reused-PID lock failures, so it did not produce a complete aggregate. A native Windows full-browser run also exposedSignals not supported on windowsin the unchanged interactive-terminal disposal path before prompt admission. Those independent surfaces are not changed here. No paid/live model request or user's installed Pi configuration was used.Impact
sessionPath; refresh stale browser assets after upgrading. Internal runtime callers may still omit the optional expected identity.f991f9eas one linear topic commit; the already-merged workbench changes are not part of this PR's diff. Tests and generated UI assets are included with the same identity invariant.