Summary
Changing an environment's endpoint now replaces its WebSocket transport while preserving its credential, session data, transcripts, and valid thread selection. The web client persists snapshots in separate IndexedDB databases keyed by environment ID and restores them after route verification, exposing cached data only after socket authentication succeeds.
Fresh transports refresh workspace membership and composer preferences and prevent disposed transports from updating the retained store. Storage failures fall back to memory; credentials and pending commands are excluded from persisted snapshots. The active session resumes after the first catalog page; older pages refresh in the background without opening inactive runtimes.
Verification
- Environment-client typecheck, lint, and 182 tests passed.
- Web typecheck, lint, 189 tests, and production build passed. Local web tests used NODE_OPTIONS=--no-experimental-webstorage for Node 26/jsdom compatibility; CI uses Node 22.
- Formatting and whitespace checks passed.
- Independent read-only review passed after lifecycle and catalog reconciliation fixes.
- Provider integration tests cover credential/store preservation and authentication when switching routes; fake IndexedDB tests cover reload, identity isolation, overlapping writes, and unavailable storage.
CI
Latest commit: c0a3753. 2867d30 drops cached sessions that the full catalog omits (Greptile P1: sessions deleted offline). c0a3753 repeats the head re-read until one pass fits in a single page (Greptile P1: a session moved during a multi-page re-read). All six CI jobs passed, and Greptile's latest review finds the PR safe to merge with no open threads.
Risk
Adds local snapshot persistence without an existing IndexedDB migration. Snapshot writes are serialized per environment to preserve freshness. Paginated catalogs are not snapshots: before removing a cached session missing from every page, the client re-reads the newest pages down to the walk's newest session. It repeats from each pass's own newest session until one pass is a single page, which the environment answers from one query. A session that a concurrent update moved ahead of a cursor is therefore found, not dropped. A one-page catalog needs no re-read, and if three passes never settle nothing is removed. Sessions touched by live events during the refresh, the active session, and ancestors of listed sessions are always kept. Inactive runtimes are never opened. The re-read relies on the server stamping updated_at with its own clock. A backwards server clock step during a refresh is the only known way to skip a moved session.
🤖 Generated with Claude Code
[Medium risk] Adds client-side caching of environment state across route changes.
The PR appears safe to merge based on the reviewed changes and resolved prior findings.
Summary
The PR retains environment state across WebSocket transport changes, persists identity-keyed browser snapshots, and refreshes session catalogs while recovering the active session. Since the previous review, reconciliation now repeats head re-reads until one pass fits in a single page, or declines to remove omitted sessions after three unsettled passes.
Diagram
Reviews (6) · Last reviewed commit: "fix(client): re-read the catalog head un..."