[PR #8969] fix(attach): allow remote --dir #12931

Closed
opened 2026-02-16 18:17:48 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/8969

State: closed
Merged: Yes


What does this PR do?

I spawn OpenCode directly on my dev servers in $HOME. I then try to attach to them from any of my machine, and because projects may be scattered and not at $HOME, I want to be able to use --dir parameter. In these examples docs is my hostname in Tailnet.

If I ran opencode attach docs:4096 --dir ./perry from my machine earlier, it would consider it a local path and try to push that in. Absolute paths would also be caught with issues like:

ENOENT: no such file or directory, chdir '/home/gricha/personal/opencode-gricha' -> '/home/workspace/perry'

I didn't want to break local-validation functionality you have, so I added gating for local vs. remote attach, and let remote pass through the dir to the upstream server.

How did you verify your code works?

opencode attach docs:4096 --dir ./perry
opencode attach docs:4096 --dir /home/workspace/perry
both work properly now - I also tested for whether they are able to load up skills/subagents from those directories after that change and it works fine.

Fixes #8981

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/8969 **State:** closed **Merged:** Yes --- ### What does this PR do? I spawn OpenCode directly on my dev servers in $HOME. I then try to attach to them from any of my machine, and because projects may be scattered and not at $HOME, I want to be able to use `--dir` parameter. In these examples `docs` is my hostname in Tailnet. If I ran `opencode attach docs:4096 --dir ./perry` from my machine earlier, it would consider it a local path and try to push that in. Absolute paths would also be caught with issues like: ENOENT: no such file or directory, chdir '/home/gricha/personal/opencode-gricha' -> '/home/workspace/perry' I didn't want to break local-validation functionality you have, so I added gating for local vs. remote attach, and let remote pass through the dir to the upstream server. ### How did you verify your code works? `opencode attach docs:4096 --dir ./perry` `opencode attach docs:4096 --dir /home/workspace/perry` both work properly now - I also tested for whether they are able to load up skills/subagents from those directories after that change and it works fine. Fixes #8981
yindo added the pull-request label 2026-02-16 18:17:49 -05:00
yindo closed this issue 2026-02-16 18:17:49 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#12931