Skip to content

Conversation

@rmk40
Copy link
Contributor

@rmk40 rmk40 commented Jan 7, 2026

Summary

Fixes regression where opencode attach --session fails with "Session not found" when run from a different directory than where the session was created.

The issue

PR #6715 (commit 401b498) introduced a regression by always sending process.cwd() as the directory context. Sessions are stored per-project, so when the client's cwd differs from the session's directory, lookup fails.

The fix

Only send the directory header when --dir is explicitly provided. Otherwise, let the server fall back to its own working directory (the pre-v1.1.1 behavior).

Fixes #7149

Only send directory header when --dir is explicitly provided.
Otherwise, let the server fall back to its own working directory.

Fixes anomalyco#7149
@github-actions
Copy link
Contributor

github-actions bot commented Jan 7, 2026

The following comment was made by an LLM, it may be inaccurate:

No duplicate PRs found

@rekram1-node rekram1-node merged commit dee0226 into anomalyco:dev Jan 7, 2026
3 checks passed
shuv1337 added a commit to Latitudes-Dev/shuvcode that referenced this pull request Jan 9, 2026
The attach command now always passes client's cwd to the server via
x-opencode-directory header. This was a fork-specific enhancement that
regressed during upstream merge (PR anomalyco#7150, commit dee0226).

Ensures file autocomplete, theme discovery, and exports use the client's
directory when attaching to a remote server, not the server's launch dir.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

opencode attach --session fails with 'Session not found' since v1.1.1

2 participants