Repository navigation
Description
Description
When the working directory is a symlink to another path, opencode spawns two state instances. Subsequent prompts appear to not be processed in the TUI (no message API calls logged), but are likely being handled by the shadow instance invisibly.
When i move to the folder directly without the symlink. And do the same: run opencode ., /session and select the session i was working on and try "test" prompt => works fine.
Ai helped me with doing the analysis and the title so take the title and hypotheses with enough grain of salt.
Plugins
none that i know
OpenCode version
1.2.15
Steps to reproduce
Open opencode in a directory that is a symlink (e.g. ~/ssd → /media/.../ssd_storage), switch to an old session via /session, send a prompt — UI freezes.
$ ls -la ~/ssd
lrwxrwxrwx 1 myname myname 23 helmi 16 11:56 /home/myname/ssd -> /media/myname/ssd_storageScreenshot and/or share link
INFO 2026-02-28T18:33:12 +0ms service=server method=GET path=/path request
INFO 2026-02-28T18:33:12 +0ms service=server status=started method=GET path=/path request
INFO 2026-02-28T18:33:12 +0ms service=server status=completed duration=0 method=GET path=/path request
INFO 2026-02-28T18:33:12 +5ms service=server status=completed duration=9 method=GET path=/formatter request
INFO 2026-02-28T18:33:15 +3324ms service=server method=GET path=/session/ses_362512ee7ffeu3OQz9LYI4nxG5 request
INFO 2026-02-28T18:33:15 +0ms service=server status=started method=GET path=/session/ses_362512ee7ffeu3OQz9LYI4nxG5 request
INFO 2026-02-28T18:33:15 +1ms service=server url=http://opencode.internal/session/ses_362512ee7ffeu3OQz9LYI4nxG5 SEARCH
INFO 2026-02-28T18:33:15 +1ms service=server status=completed duration=2 method=GET path=/session/ses_362512ee7ffeu3OQz9LYI4nxG5 request
INFO 2026-02-28T18:33:15 +0ms service=server method=GET path=/session/ses_362512ee7ffeu3OQz9LYI4nxG5/message request
INFO 2026-02-28T18:33:15 +0ms service=server status=started method=GET path=/session/ses_362512ee7ffeu3OQz9LYI4nxG5/message request
INFO 2026-02-28T18:33:15 +37ms service=server status=completed duration=37 method=GET path=/session/ses_362512ee7ffeu3OQz9LYI4nxG5/message request
INFO 2026-02-28T18:33:15 +14ms service=server method=GET path=/session/ses_362512ee7ffeu3OQz9LYI4nxG5/todo request
INFO 2026-02-28T18:33:15 +0ms service=server status=started method=GET path=/session/ses_362512ee7ffeu3OQz9LYI4nxG5/todo request
INFO 2026-02-28T18:33:15 +1ms service=server status=completed duration=1 method=GET path=/session/ses_362512ee7ffeu3OQz9LYI4nxG5/todo request
INFO 2026-02-28T18:33:15 +0ms service=server method=GET path=/session/ses_362512ee7ffeu3OQz9LYI4nxG5/diff request
INFO 2026-02-28T18:33:15 +0ms service=server status=started method=GET path=/session/ses_362512ee7ffeu3OQz9LYI4nxG5/diff request
INFO 2026-02-28T18:33:15 +1ms service=server status=completed duration=1 method=GET path=/session/ses_362512ee7ffeu3OQz9LYI4nxG5/diff request
INFO 2026-02-28T18:39:26 +371112ms service=default worker shutting down
INFO 2026-02-28T18:39:26 +4ms service=default disposing all instances
INFO 2026-02-28T18:39:26 +1ms service=bus type=* unsubscribing
INFO 2026-02-28T18:39:26 +0ms service=server event disconnected
INFO 2026-02-28T18:39:26 +1ms service=default directory=/media/myname/ssd_storage/project_collection_foo/app_bar disposing instance
INFO 2026-02-28T18:39:26 +0ms service=state key=/media/myname/ssd_storage/project_collection_foo/app_bar waiting for state disposal to complete
INFO 2026-02-28T18:39:26 +2ms service=state key=/media/myname/ssd_storage/project_collection_foo/app_bar state disposal completed
INFO 2026-02-28T18:39:26 +0ms service=default directory=/home/myname/ssd/project_collection_foo/app_bar disposing instance
INFO 2026-02-28T18:39:26 +0ms service=state key=/home/myname/ssd/project_collection_foo/app_bar waiting for state disposal to complete
INFO 2026-02-28T18:39:26 +1ms service=state key=/home/myname/ssd/project_collection_foo/app_bar state disposal completed
Operating System
Ubuntu 22.04
Terminal
Gnome terminal
Activity
snowstorm0182 commentedon Feb 28, 2026
Note that to me it felt that there was some flakiness to error so that it did not reproduce always, but now it feels consistent. The workaround to not use symlinks is enough for me now that I know how this acts and i can totally live with this nano inconvenience.
Fix symlink path resolution causing duplicate instances (anomalyco#15482
snowstorm0182 commentedon Feb 28, 2026
My agent made this kind of fix and it seems to fix the issue for me atleast. im not sure about is there any value to to such verbose markdown files but i suppose i could remove them if the code looks like something that could be maintainable. I suppose anothe fix could be just to warn users in similar situation that i have but ... dunno. you tell me if this has any value in general.
https://github.com/anomalyco/opencode/pull/15483/changes
cristianmiranda commentedon Mar 7, 2026
Hey, I just created a PR which has a simpler solution. Let me know your thoughts!
#16529
jmylchreest commentedon Mar 8, 2026
This is addressed by #16650 — the root cause is that
Instance.provide()usespath.resolve()which doesn't resolve symlinks, creating duplicate Instance contexts. Addingfs.realpathSync()ensures the same physical directory always maps to a single Instance.jmylchreest commentedon Mar 8, 2026
Updated fix PR: #16651 (replaces #16650).
Hona commentedon Mar 8, 2026
if this has been around since 1.2.15 then why does #16647 and @brndnblck say this is new in 1.2.22?