Skip to content

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

@ualtinok

Description

@ualtinok

Description

Running opencode -s <session-id> should resume the session in that session's stored working directory. Today, local resume can keep using the directory where the command was launched instead.

That makes the resumed session look correct in history, but the active execution context can be wrong:

  • prompts report the launch directory rather than the session directory
  • relative file paths resolve from the launch directory
  • tools and shell commands run against the wrong project
  • TUI resume starts the worker with the launch/project directory even when the session was created elsewhere

This is easy to hit when resuming a known session from a different terminal directory, or when continuing sessions across worktrees/subdirectories.

Plugins

None required.

OpenCode version

Current dev.

Steps to reproduce

  1. Create a session in directory A.
  2. From directory B, run opencode -s <session-id-from-A>.
  3. Ask opencode for the current working directory or run a relative file/tool operation.

Expected: the resumed session uses directory A, the stored session.directory.

Actual: the resumed session can continue using directory B, the launch directory.

Screenshot and/or share link

No response

Operating System

macOS, but this is CLI/session directory handling and should not be OS-specific.

Terminal

Any terminal.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions