Skip to content

Remember selected sessions and add rename#55

Open
cualvarez wants to merge 1 commit into
saffron-health:mainfrom
cualvarez:codex/session-restore-and-rename
Open

Remember selected sessions and add rename#55
cualvarez wants to merge 1 commit into
saffron-health:mainfrom
cualvarez:codex/session-restore-and-rename

Conversation

@cualvarez

Copy link
Copy Markdown

Summary

  • Remember the last selected OpenCode session across webview reloads and VS Code window switches.
  • Fix session switching in the live webview by preventing the initial session payload from re-applying over user-selected sessions.
  • Add an inline session rename control in the top bar using the existing session.update API.

Why

The webview could fall back to, or remain visually stuck on, the initial "New Session" after switching sessions. The selected session was persisted and became visible after the webview remounted, but the live UI could be reset by the SDK init effect because it indirectly tracked currentSessionId through setCurrentSessionId().

This PR makes session selection durable and keeps the live webview aligned with the user's selected session.

Changes

  • Persist the active session in VS Code webview state and extension host global state, scoped by workspace.
  • Apply the initial session only once with untrack() so user-driven session changes are not overwritten.
  • Force session-content remounts when the active session changes.
  • Render generated default session titles with date/time context so multiple untitled sessions can be distinguished.
  • Add an inline rename flow with save/cancel controls.
  • Extend the webview message schema with session-changed and test coverage.

Validation

  • corepack pnpm run build:webview
  • corepack pnpm run build:extension
  • corepack pnpm exec vitest run
  • git diff --check

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.

1 participant