Repository navigation
Description
Version checked: Hex 3.4.0 (v3.4.0, 8766d09, 2026-11-11), Windows 10 Pro 26H2.
labs.opencode_in_wsl = true, capture.enabled = true,
capture.routing.sendCaptures = true, capture.routing.autoSend = rules.
Configuration
- OpenCode Desktop 2.3.2 on Windows, with its local Windows service registered at
%USERPROFILE%\.local\state\opencode\service.json(http://127.0.0.1:28894, 0 sessions). - OpenCode 2.3.0 in WSL, with its CLI service registered at
~/.local/state/opencode/service.json(http://127.0.0.1:4097, 81 root sessions). labs.opencode_in_wsl = true.
What happens
In this configuration, every Annotate capture routes to the Windows service, not the WSL
service:
routing time: look local_ms=0 lookup_ms=15 page_ms=0 candidates=0
page_ms=0 and candidates=0, with no a capture's look couldn't read all of OpenCode's sessions warning: the read succeeded against a real service and returned no sessions. The
capsule's "Send to" list is empty ("No sessions match"), and the capture remains in the
clipboard. The WSL service's 81 sessions are never listed.
Both registrations confirmed at the time:
| File | Version | URL | Sessions |
|---|---|---|---|
%USERPROFILE%\.local\state\opencode\service.json |
2.3.2 | http://127.0.0.1:28894 |
0 |
WSL ~/.local/state/opencode/service.json |
2.3.0 | http://127.0.0.1:4097 |
81 |
GET /api/session?parentID=null&limit=5 with each registration's Basic password returns []
for 28894 and sessions for 4097.
Why the lab does not engage
src/desktop/opencode_service.rs::with_wsl only looks at WSL when the Windows lookup failed:
if crate::labs::opencode_in_wsl() {
if found.is_err() {
return prefer_wsl(found, wsl::discover(budget, cancelled));
}
}The desktop app's registration confirms, so found is Ok and the WSL fallback is never
reached. In src/capture_host/routing/opencode.rs, Wsl::request then returns None because
the discovered service is not WSL, so the lab's transport does not engage either.
This precedence is documented, not accidental: docs/opencode-compatibility.md says the WSL
registration is read "when no Windows registration answers". The report is about the dead end
that rule creates, not about the rule being unknown.
The mechanism above is verified from the source and the two registrations. The assumption is
the expected precedence: the lab is intended to select WSL even when a Windows registration
also confirms. If the fallback rule is intentional, the remaining bug is the empty-state
signal (expected #3): neither process.log nor the capsule says which service was read.
Why the Windows registration cannot be removed in-app
The desktop app starts its local Windows server on launch and re-ensures it. The Servers page
has no Stop or Remove action for the builtin "This computer" entry; hiding it does not stop
the process. opencode-cli.exe service stop is undone while the app runs. The Windows
registration is therefore present whenever the desktop app is running. Removing it requires
quitting or uninstalling the app.
That is the technical reason the lab's fallback rule produces a dead end in this
configuration: the fallback cannot be reached while the desktop app is installed and running.
Expected (any one would resolve it)
- When Labs › OpenCode in WSL is on and the WSL service answers, prefer it — even when a
Windows registration also confirms. The lab is the explicit opt-in to the WSL service. - Or let the user choose the OpenCode instance (Windows / WSL) and remember it.
- Or, at minimum, name the service that was read (
url,pid,version, session count) in
process.logand in the capsule's empty state, so "No sessions match" is not the only
signal.
Workaround
- In WSL:
opencode service start(writes~/.local/state/opencode/service.json, the file
Hex's WSL lookup reads). - Quit the Windows desktop app, then stop its bundled service if needed:
opencode-cli.exe service stop(from
%LOCALAPPDATA%\Programs\ai.opencode.desktop\resources). Uninstalling the desktop app also
removes the registration. hex capture route latest --explainshould now report the WSL session count.
The WSL CLI service remains at 127.0.0.1:4097 and serves the web UI at
http://localhost:4097/; that client is available after the Windows desktop app is stopped.
Validated on 2026-11-20 19:43 (-03): after closing the app and running service stop
(status → stopped), the Windows registration was gone and the next Annotate capture was
routed into the WSL session. The fallback works as soon as the Windows registration is absent;
the bug is that the registration cannot be removed while the desktop app runs.
Related
- Windows: connect to OpenCode running in WSL (rewrite, model picker, Annotate) #1564 — closed: the original Windows/WSL connection investigation.
- windows: use an opencode service running in wsl (labs) #1566 — merged: added the lab; WSL is read only when no Windows registration answers.
- annotate: use OpenCode in WSL when the lab is on #1586 — merged: routed Annotate's requests through the host transport, same fallback rule.
- Windows: Labs › OpenCode in WSL resolves the wrong home when the default user comes from /etc/wsl.conf #1946 — open: the other Windows/WSL discovery bug (registry
DefaultUid→/root).
PR windows: find the wsl default user from wsl.conf #1948 is still open. Fixing Windows: Labs › OpenCode in WSL resolves the wrong home when the default user comes from /etc/wsl.conf #1946 does not fix this one: here the WSL home is reachable
(the registry workaround is applied), and the desktop registration simply wins first. - Annotate cannot authenticate to OpenCode running in WSL and gives no setup guidance #1131, Windows: Annotate cannot reach running OpenCode when service advertises 0.0.0.0 (socket error 10049) #1210 / Fix #1210: Annotate capture routing to OpenCode #1211 — closed: earlier WSL/Annotate discovery and reachability bugs.
- Annotate: a configurable local destination (webhook) so captures can reach agents other than OpenCode #1401 — open, generic destinations; not this bug.
No existing issue describes two live registrations and the empty-list outcome.
Activity
thdxr commentedon Nov 21, 2026
with opencode in wsl on, hex only looked in wsl when no windows opencode answered. the desktop app always keeps its own empty one running, so wsl never got a chance and the send list came up empty.
now with the lab on, a wsl opencode that answers is used first, and the windows one is only the fallback. you can keep the desktop app open.
fixed in #2112, it'll be in the next dev build
— from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊