Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Fixes #583.
Copying a Pi JSONL Session preserves its ID. The Web adapter currently treats that ID alone as ownership of the live SessionManager: reading a copy can return the original transcript, renaming the copy can write the original, and selecting the copy can skip the runtime switch. An ID-only frontend lookup can also drift to a newer copy during refresh.
Value
Keep the displayed, selected and edited Session bound to its actual file. A copied history entry must not silently alias the active original. If switching succeeds but confirming the new snapshot fails, the stale page must not send Session-bound operations until confirmation succeeds.
Approach
controller: webplus path identity instead of deriving ownership from ID equality.selectedPathat prompt, model/thinking and command-discovery gates and in Composer. No new state machine or API fields. A successful refresh restores normal operation.The backend and these necessary UI consumers repair one file-identity invariant. Splitting them would leave the same copied-ID failure reachable. Stop/cancellation identity, general multi-client concurrency, archive policy and new Session schemas are outside this PR.
Validation
Baseline:
f6b49ae59605b1276b8267f2886d22c03f01533c; source checkout tests, Node 22.22.3 and Bun 1.3.14 on Windows. Fixtures contain synthetic data in isolated temporary directories, not user histories or provider calls.SessionManagercreates and persists a real JSONL, which is copied and independently modified. Three regressions fail before the fix: selected-file transcript, rename target, and authenticated loopback/api/sessions/selectruntime switching.node --experimental-strip-types --test tests/web/pi-adapter.test.ts tests/web/web-host.test.ts tests/web/artifact-host.test.ts— 62/62 pass.node node_modules/vitest/vitest.mjs run tests/web/web-store.spec.ts tests/web/app-render.spec.ts— 149/149 pass.bun run checkandgit diff --check— pass. Trackedweb/dist/app.jsregenerated by the normal build.autoreview --mode local --engine codex --model gpt-6-astra --thinking xhigh --no-web-search): final helper exit 0, no actionable findings. Two verified same-identity consumer gaps were fixed before this final review; no unrelated follow-ups folded in.Impact