fix(web): persist session id in URL so reload restores instead of resets#17
Merged
That1Drifter merged 1 commit intomasterfrom Apr 10, 2026
Merged
fix(web): persist session id in URL so reload restores instead of resets#17That1Drifter merged 1 commit intomasterfrom
That1Drifter merged 1 commit intomasterfrom
Conversation
PlayClient called startSession() unconditionally on mount with no URL/cookie restore, so any F5 mid-scenario silently destroyed 30+ minutes of work. The session-store already rehydrates from data/sessions.json on disk, so the fix is purely client-side: read ?session=<id> from the URL on mount, fetch the existing session, fall back to a fresh start only if missing or expired. Adds GET /api/session/[id] returning the same shape as /api/session/start so the client can use one apply handler for both paths. Adds a small effect to keep the URL in sync with the active sessionId via history.replaceState — applies on first start, on reset, and on restore. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
That1Drifter
added a commit
that referenced
this pull request
Apr 10, 2026
Re-ran the fresh-eyes Sonnet playthrough on the patched build via Playwright (against a local dev server, since the staging basic-auth header trick blocks fetch in headless browsers). Both critical bugs from the original report are fixed: - 0 contract errors out of 10 turns (down from ~50% in the original). One turn showed the silent retry, otherwise clean. - Mid-scenario reload preserved session: turn counter, cost, trust scores, objective state, and inbox all restored exactly. Same ?session=<id> URL. The agent completed 10 turns (vs 3 in the original where contract errors blocked progress at turn 4), saw both surprises fire, and the debrief rendered cleanly. Two new findings worth fixing: - Last-turn work area narrative is empty after reload because lastEffects lives in component state, not the session store. Visible in frame-06-turn3-post-reload.png. Small follow-on to the session URL persistence work in #17. - The `retried` badge added by the contract guard fix (#16) shows up in the turn metadata line with no explanation, which is mildly confusing for users since the retry is meant to be silent. Either drop it from the UI or add a tooltip. Updates the demo GIF entry to point at the v2 frames captured by the playthrough, which include both surprises firing and the reload restore in action. Also updates scripts/stitch-demo-gif.py with auto-discovery: if the hardcoded curated frame list matches fewer than 5 frames in the target dir, fall back to globbing all frame-*.png files in lexical order with uniform timing. Makes the script work with any new playthrough run without requiring a code edit. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Merged
5 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.
Summary
`PlayClient.tsx` called `startSession()` unconditionally on mount with no URL/cookie restore, so any F5 mid-scenario silently destroyed 30+ minutes of work. The session-store already rehydrates from `data/sessions.json` on disk, so the fix is purely client-side.
The third critical bug from the fresh-eyes Sonnet playthrough.
What changed
Test plan
This is the third of three critical bugs from the playthrough TODO Now section. Contract guard fix shipped in #16, this is bug #3, only the demo GIF remains.