Uh oh!
There was an error while loading. Please reload this page.
feat(opencode): add --resume session picker - #38878
Conversation
The following comment was made by an LLM, it may be inaccurate: Potential duplicate found:
No other duplicate PRs were found. PR #26432 and #36774 are related to session picker functionality but address different concerns (root sessions request and crash prevention respectively). |
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
Issue for this PR
Closes#36134
Refs #18569 — the picker covers the "find and resume an old session" friction there, but resuming by session name (what it literally asks for) is not part of this PR.
Type of change
What does this PR do?
Adds
opencode --resume(andopencode attach --resume): boots the TUI straight into the existing session picker for the current directory. This is option A from the linked issue.Today, resuming anything but the latest session means either
opencode session list+ copy-pasting an opaqueses_...id into-s, or booting the TUI and opening/sessionsby hand. Claude Code (claude --resumeopens its picker) and Codex (codex resumeopens a picker scoped to the cwd,--lastfor most recent) both ship this; not having it is recurring friction for people switching over (both linked issues).Implementation:
--resumeflag on the default command andattach; mutually exclusive with--continue/--session, rejected with--mini(no picker surface there). Headlessrunintentionally untouched, per the issue's scope.--resume(previously--continue-only), then opensDialogSessionList— the same dialog/sessionsuses, directory-scoped; no new UI.--forkstill requires--continue/--session; forking from the picker would need fork-on-select in the dialog and is deliberately out of scope.How did you verify your code works?
test/cli/tui/thread.test.ts), bootstrap blocking/fetch-once forresume(packages/tui/test/cli/cmd/tui/sync-resume.test.tsx), and app-lifecycle tests for picker-opens vs toast-when-empty (packages/tui/test/app-lifecycle.test.tsx). Regenerated theattach --helpsnapshot.bun testfrompackages/opencode(15 pass) andpackages/tui(28 pass);bun typecheckclean in both; repo-wide typecheck also ran green via the pre-commit hook.bun dev --resumein a directory with sessions -> picker opens (below), selecting one resumes it; in a directory with none -> toast.--resume --continue,--resume --mini,--resume --forkall exit 1 with clear errors.bun dev --resumein any directory with sessions.Screenshots / recordings
opencode --resumein a directory with existing sessions:Checklist