attach remote opencode server with --dir is broken #8393

Open
opened 2026-02-16 18:09:51 -05:00 by yindo · 1 comment
Owner

Originally created by @LiloD on GitHub (Feb 3, 2026).

Originally assigned to: @thdxr on GitHub.

Description

Current tui attach handles --dir with following code

const directory = (() => {
  if (!args.dir) return undefined
  try {
    process.chdir(args.dir)
    return process.cwd()
  } catch {
    // If the directory doesn't exist locally (remote attach), pass it through.
    return args.dir
  }
})()

if process (local) happens to chdir successfully, it will use local process cwd(after chdir) and send wrong dir to server

Plugins

No response

OpenCode version

No response

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

Originally created by @LiloD on GitHub (Feb 3, 2026). Originally assigned to: @thdxr on GitHub. ### Description Current tui attach handles --dir with following code ```typescript const directory = (() => { if (!args.dir) return undefined try { process.chdir(args.dir) return process.cwd() } catch { // If the directory doesn't exist locally (remote attach), pass it through. return args.dir } })() ``` if process (local) happens to chdir successfully, it will use local process cwd(after chdir) and send wrong dir to server ### Plugins _No response_ ### OpenCode version _No response_ ### Steps to reproduce _No response_ ### Screenshot and/or share link _No response_ ### Operating System _No response_ ### Terminal _No response_
yindo added the bug label 2026-02-16 18:09:51 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Feb 3, 2026):

This issue might be a duplicate of existing issues. Please check:

  • #5380: TUI referencing local directory when using attach --dir to connect to a remote server
  • #11522: SSE events not emitted when using opencode attach --dir
  • #11046: opencode attach --dir does not use project commands

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Feb 3, 2026): This issue might be a duplicate of existing issues. Please check: - #5380: TUI referencing local directory when using attach --dir to connect to a remote server - #11522: SSE events not emitted when using `opencode attach --dir` - #11046: `opencode attach --dir` does not use project commands Feel free to ignore if none of these address your specific case.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#8393