Description
Setup
- WSL2 (mirrored networking), opencode desktop 1.17.x on Windows
- WSL Ubuntu, same opencode version
Symptom
- Desktop auto-discovers/launches the WSL server, reading sessions works, but sending a message (even 2 chars) hangs ~60s and times out
- TUI in the same WSL is fine
- Workaround: manually run
opencode serve --port 4098 --hostname 0.0.0.0 (no --print-logs) and add it as a server in desktop. Works perfectly.
Diagnosis (inside WSL)
Desktop spawns a server on a random high port (e.g. 57054) with this cmdline:
/home//.opencode/bin/opencode --print-logs --log-level WARN serve --hostname 0.0.0.0 --port 57054
Compare stdio targets:
manual (works): /proc//fd/1 -> /dev/pts/N
desktop (hangs): /proc//fd/1 -> pipe:inode
The desktop-launched server's stdout/stderr are anonymous pipes. It also opens /dev/ptmx (fd 7) to capture child tool output and re-emit it to stdout. When LLM processing generates enough log/tool output, write(1) blocks on the full 64KB pipe. The server hangs inside write, HTTP response is never sent, desktop times out.
Manually launched server has no --print-logs, only writes to the log file, never blocks.
Suggested fix
When desktop spawns the WSL server, redirect stdout/stderr to the log file instead of inheriting a pipe:
wsl -e bash -lc 'exec opencode serve ... >>~/.local/share/opencode/log/desktop-wsl-server.log 2>&1'
Or simply don't pass --print-logs when spawning from desktop.
Plugins
No response
OpenCode version
1.17.4
Steps to reproduce
No response
Screenshot and/or share link
No response
Operating System
Windows 11
Terminal
No response
Description
Setup
Symptom
opencode serve --port 4098 --hostname 0.0.0.0(no--print-logs) and add it as a server in desktop. Works perfectly.Diagnosis (inside WSL)
Desktop spawns a server on a random high port (e.g. 57054) with this cmdline:
/home//.opencode/bin/opencode --print-logs --log-level WARN serve --hostname 0.0.0.0 --port 57054
Compare stdio targets:
manual (works): /proc//fd/1 -> /dev/pts/N
desktop (hangs): /proc//fd/1 -> pipe:inode
The desktop-launched server's stdout/stderr are anonymous pipes. It also opens
/dev/ptmx(fd 7) to capture child tool output and re-emit it to stdout. When LLM processing generates enough log/tool output,write(1)blocks on the full 64KB pipe. The server hangs insidewrite, HTTP response is never sent, desktop times out.Manually launched server has no
--print-logs, only writes to the log file, never blocks.Suggested fix
When desktop spawns the WSL server, redirect stdout/stderr to the log file instead of inheriting a pipe:
wsl -e bash -lc 'exec opencode serve ... >>~/.local/share/opencode/log/desktop-wsl-server.log 2>&1'Or simply don't pass --print-logs when spawning from desktop.
Plugins
No response
OpenCode version
1.17.4
Steps to reproduce
No response
Screenshot and/or share link
No response
Operating System
Windows 11
Terminal
No response