fix(web): bind first prompt to created session - #490
Open
testikun wants to merge 2 commits into
Open
Conversation
4 tasks
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
Closes #466. A newly created Web Session returned a creation receipt, but the browser discarded its stable identity and later read the first prompt target from a refreshed snapshot. Another tab could activate a different Session between those steps, causing the original prompt or preselected model to be retargeted. The path-based confirmation added by #482 also could not represent a Pi Session before its first persisted file exists.
Value
The first prompt and its draft model stay bound to the Session the user created. Cross-tab activation now stops the send and preserves the Composer input instead of silently adopting another workspace or Session.
Approach
sessionIdfrom the Pi runtime and Host creation receipt/events; keepsessionPathoptional before first persistence.{ commandId, sessionId, optional sessionPath, workspacePath, epoch }while preserving the existingworkspaceDraftauthority from fix(web): bind workspace drafts to confirmed Pi sessions #482.SESSION_CONFLICTand prompt idempotency boundaries.docs/design/WEB_SESSION_CREATION_TARGET.md.Validation
bun run checkpassed: config contract, discipline ledger, Web build/typecheck, format, lint, and TypeScript typecheck.bun run testpassed: 1,465 Node tests passed, 1 platform-specific test skipped, 0 failed; Web suite 134/134.bun run test:web:e2epassed: 12/12. The new test starts the current checkout's standalone Host/Pi runtime, delays Session A's HTTP receipt, switches to Session B through an independent request while suppressing SSE, and verifies that no prompt is sent and A's input remains in the Composer.commandIdcorrelates events and the receiptsessionIdis the target authority. Removing receipt-boundsessionIdvalidation restores the reported retargeting failure.piexecutable, so installed-packagepi listprovenance was unavailable. Playwright invokedbin/openpi.jsdirectly from this checkout. No model call was made.Impact