Skip to content

fix(cli): resume sessions from stored directory#28582

Open
ualtinok wants to merge 4 commits into
anomalyco:devfrom
ualtinok:fix/resume-session-directory
Open

fix(cli): resume sessions from stored directory#28582
ualtinok wants to merge 4 commits into
anomalyco:devfrom
ualtinok:fix/resume-session-directory

Conversation

@ualtinok
Copy link
Copy Markdown
Contributor

@ualtinok ualtinok commented May 21, 2026

Issue for this PR

Closes #28581

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Resuming a local session now uses the session's stored directory when the user did not provide an explicit directory override.

This updates both local opencode run -s/-c and root TUI opencode -s paths so they bind the local client/worker to the resolved session directory. Explicit --dir or project arguments keep their existing precedence. If a stored local session directory no longer exists, direct -s fails clearly and local project-wide -c skips stale root sessions before selecting one.

How did you verify your code works?

A new opencode built with this PR merged ran in home dir with a session id of a project where dir is different than home. Successfully observed cwd correctly set to the right (project's) directory.

also:

  • bun test test/cli/run/directory.test.ts test/cli/tui/thread.test.ts --timeout 30000
  • bun typecheck
  • git diff --check upstream/dev...HEAD

Screenshots / recordings

Not applicable; CLI behavior change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

opencode -s resumes sessions from the launch directory instead of the stored session directory

1 participant