Skip to content

Studio Code: add recovery action to Session not found state - #4243

Merged
sejas merged 1 commit into
trunkfrom
stu-2067-studio-code-tab-shows-session-not-found-error
Jul 17, 2026
Merged

Studio Code: add recovery action to Session not found state#4243
sejas merged 1 commit into
trunkfrom
stu-2067-studio-code-tab-shows-session-not-found-error

Conversation

@sejas

@sejas sejas commented Jul 17, 2026

Copy link
Copy Markdown
Member

Related issues

The Studio Code tab remembers one session id per site. When that session can no longer be resolved on disk (deleted, emptied, or corrupted transcript file), the tab dead-ended on a bare "Session not found" screen with no way out — restarting Studio or signing out didn't help because the stale reference persists locally.

How AI was used in this PR

AI helped trace the root cause, write the regression test, and draft this PR. All changes were reviewed manually.

Proposed Changes

This PR turns that dead end into a recovery path: the state now explains that the conversation is no longer available and offers a Start a new conversation button, which creates a fresh session for the site and replaces the stale reference. The screen also adopts the same layout and typography as the other empty states in this tab.

Testing Instructions

  1. Open a site's Studio Code tab and confirm it loads normally.
  2. Simulate a lost session: in DevTools run localStorage.setItem('studio_code_session_ids', JSON.stringify({ '<siteId>': 'bogus' })) (or delete the session's .jsonl file from the sessions directory), then reopen the tab, or break all your sessions by running this script in your chrome DevTools:
const key = 'studio_code_session_ids';
const map = JSON.parse(localStorage.getItem(key) ?? '{}');

for (const k of Object.keys(map)) {
  map[k] = crypto.randomUUID(); // replacement value per entry
}

localStorage.setItem(key, JSON.stringify(map));
console.log(JSON.parse(localStorage.getItem(key)));
  1. Confirm the "Session not found" state appears with the explanation and the Start a new conversation button.
  2. Click the button: a fresh, working conversation should load, and it should survive app restarts.
  3. Check the state renders correctly in both light and dark mode.
Before After
5b4cccf84457a215129cefb10384eacf3aff70dcc1b565c1b4fbd29830c30336 Screenshot 2026-07-17 at 10 29 00

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?
@sejas sejas self-assigned this Jul 17, 2026
@wpmobilebot

Copy link
Copy Markdown
Collaborator

📊 Performance Test Results

Comparing dd36ba0 vs trunk

app-size

Metric trunk dd36ba0 Diff Change
App Size (Mac) 1353.02 MB 1353.02 MB +0.00 MB ⚪ 0.0%

site-editor

Metric trunk dd36ba0 Diff Change
load 1078 ms 1093 ms +15 ms ⚪ 0.0%

site-startup

Metric trunk dd36ba0 Diff Change
siteCreation 6993 ms 7017 ms +24 ms ⚪ 0.0%
siteStartup 2356 ms 2351 ms 5 ms ⚪ 0.0%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff)

@bcotrim bcotrim left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM 👍

Light Dark
Image Image
@sejas
sejas enabled auto-merge (squash) July 17, 2026 10:04
@sejas
sejas disabled auto-merge July 17, 2026 10:20
@sejas
sejas merged commit 48dfe84 into trunk Jul 17, 2026
14 checks passed
@sejas
sejas deleted the stu-2067-studio-code-tab-shows-session-not-found-error branch July 17, 2026 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants