Skip to content

Symlinked project directories break after 8a95be4 (realpath resolution) #16647

@brndnblck

Description

@brndnblck

Description

Commit 8a95be4 introduced Filesystem.resolve() which calls realpathSync.native() to canonicalize the project directory. This dereferences symlinks. The resolve call was added to the server request middleware (server.ts), the instance cache (instance.ts), and the TUI entry point (thread.ts). The app frontend (directory-layout.tsx) was also updated to call /path, detect the resolved directory, and redirect the URL slug to match.

When OpenCode is launched from a directory that is (or is inside) a symlink, the client initially sends the symlink path but the server resolves it to the real target path. This creates a mismatch: the instance is keyed by the real path, but the frontend may still reference the symlink path in some flows. The result is that sessions are broken and AI output is not visible. Launching from the real (non-symlink) path works fine.

Plugins

None

OpenCode version

Unknown; regression introduced by 8a95be4

Steps to reproduce

  1. Create a symlink to a repo: ln -s /path/to/real/repo /path/to/link/repo
  2. cd /path/to/link/repo (confirm pwd shows the symlink path).
  3. Start OpenCode (TUI or app).
  4. Create/open a session and send a prompt.
  5. Observe: session UI appears broken and AI output is not visible.
  6. Repeat from the real path (cd /path/to/real/repo) and note it works normally.

Screenshot and/or share link

N/A

Operating System

macOS 26.3.1 (Build 25D2128)

Terminal

Ghostty 1.2.3 (stable)

Metadata

Metadata

Assignees

Labels

coreAnything pertaining to core functionality of the application (opencode server stuff)windows

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions