opencode
opencode copied to clipboard
fix(tui): restore attach session lookup behavior
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 401b498c7) 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