Skip to content

fix: resolve TUI blank response when launched from symlinked directory#16529

Open
cristianmiranda wants to merge 1 commit intoanomalyco:devfrom
cristianmiranda:fix/tui-symlink-directory-mismatch
Open

fix: resolve TUI blank response when launched from symlinked directory#16529
cristianmiranda wants to merge 1 commit intoanomalyco:devfrom
cristianmiranda:fix/tui-symlink-directory-mismatch

Conversation

@cristianmiranda
Copy link
Copy Markdown

@cristianmiranda cristianmiranda commented Mar 7, 2026

Issue for this PR

Closes #16528

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

The TUI worker starts its SSE event stream using process.cwd() (worker.ts:98), which resolves symlinks to the physical path. The main thread uses process.env.PWD (thread.ts:114), which preserves the symlink path. Since Instance and Bus are keyed by directory string, this creates two separate scopes — events from one never reach the other, so the TUI renders blank.

The fix changes worker.ts:98 from process.cwd() to process.env.PWD ?? process.cwd(), matching the existing pattern in thread.ts. On Windows where PWD is unset, the fallback preserves current behavior.

How did you verify your code works?

  1. Created a symlink to a git repo: ln -s /real/path/dotfiles ~/dotfiles
  2. Launched opencode from ~/dotfiles — confirmed blank responses (before fix)
  3. Applied fix, launched again — responses render correctly
  4. Verified real path still works: cd /real/path/dotfiles && opencode — works
  5. Verified non-git symlinked dirs still work (no regression)
  6. All 1221 existing tests pass

Screenshots / recordings

Bug

opencode_bug.mp4

Fix

opencode_fix.mp4

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

The worker used process.cwd() to start the event stream, which resolves
symlinks to the physical path. The main thread uses process.env.PWD,
which preserves the symlink path. This mismatch created two separate
Instance/Bus scopes, so SSE events never reached the TUI store.

Use process.env.PWD in the worker to match the main thread behavior.

Fixes anomalyco#16528
@github-actions github-actions bot added the needs:compliance This means the issue will auto-close after 2 hours. label Mar 7, 2026
@github-actions github-actions bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Mar 7, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 7, 2026

Thanks for updating your PR! It now meets our contributing guidelines. 👍

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.

TUI renders blank responses when launched from a symlinked directory

1 participant