Skip to content

fix: restore OpenCode sessions after browser refresh#380

Merged
danshapiro merged 11 commits into
mainfrom
opencode-browser-refresh-restore
Jun 1, 2026
Merged

fix: restore OpenCode sessions after browser refresh#380
danshapiro merged 11 commits into
mainfrom
opencode-browser-refresh-restore

Conversation

@danshapiro
Copy link
Copy Markdown
Owner

Summary

  • replay canonical terminal sessionRef on terminal.created and terminal.attach.ready
  • centralize client reconciliation of { terminalId, sessionRef } from inventory, create, attach-ready, and association messages
  • preserve OpenCode/Codex restore behavior by clearing stale legacy identity and stale Codex durability when provider identity changes
  • add regression coverage for OpenCode refresh recovery before stale terminal cleanup

Verification

  • npm run typecheck
  • npm run test:vitest -- test/unit/client/components/App.ws-bootstrap.test.tsx test/unit/client/components/TerminalView.resumeSession.test.tsx test/unit/client/components/TerminalView.lifecycle.test.tsx test/e2e/terminal-restart-recovery.test.tsx test/e2e/codex-refresh-rehydrate-flow.test.tsx --run -t "OpenCode sessionRef|terminal.session.associated|terminal.created live-only|terminal.created when the server replays it|persists canonical durable sessionRef|inventory recovers a missing sessionRef|registers regenerated restart request ids|restores the same Codex session after a refresh|sessionRef replayed by terminal.attach.ready|replays OpenCode sessionRef|buildTerminalSessionRef"
  • npm run test:vitest -- --config vitest.server.config.ts test/server/ws-protocol.test.ts test/unit/server/terminal-registry.test.ts --run -t "OpenCode sessionRef|buildTerminalSessionRef"

Known Verification Note

  • Coordinated npm test previously passed the client suite and then failed only on the pre-existing OpenCode real-provider DB-row timeout in test/integration/real/coding-cli-session-contract.test.ts; the user accepted that as a flake for this landing.
  • Final fresheyes review was waived by the user after the fresheyes process exceeded its expected polling window and was stopped per instruction.

@danshapiro danshapiro merged commit cee6f6d into main Jun 1, 2026
1 check passed
@danshapiro danshapiro deleted the opencode-browser-refresh-restore branch June 1, 2026 19:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants