Issue for this PR
Related: #56386, #64126 (closed as duplicate), #56389
The run/mini part of #56386 is already covered by #56389. This PR is for the full TUI path, which can hit the same symptom: if the initial file.list fails, the TUI falls back to api.location.get() with no directory, so it uses the server's active location instead of the client's actual cwd. With a stale shared service pointing at another directory, the session can open in the wrong place.
Type of change
- Bug fix
- New feature
- Refactor / code improvement
- Documentation
What does this PR do?
The TUI already starts from process.cwd(), but its fallback did not preserve that directory:
Effect.catch(() => Effect.tryPromise(() => api.location.get()))
This is a one-line change: pass { location: { directory: process.cwd() } } to the fallback. No public API changes.
How did you verify your code works?
bun run typecheck in packages/tui — no errors
- Pre-push hook ran the full typecheck task graph successfully.
- The reviewer independently verified with a proxy that made
/api/fs/list fail: the base opened in the server's directory, and this branch opens in the client cwd.
Screenshots / recordings
N/A — CLI behavior only.
Checklist
- I have tested my changes locally
- I have not included unrelated changes in this PR
AI assistance: AI-assisted, human-reviewed. Runtime: OpenCode v2.3.0. Model: DeepSeek V4.1 Flash via OpenCode GO (opencode-go/deepseek-v4.1-flash#max).
Verify locally: Verify issue #56386 in the full TUI locally and confirm the session opens in the actual cwd.
Added by the opencode bot (AI-generated).
Related: #56386