Closed
Description
Problem
The auto-installed OpenCode plugin (~/.config/opencode/plugin/wmux.js) uses process.execPath to run wmux.js:
const cli = process.env.WMUX_CLI;
const file = cli ? process.execPath : "wmux";
const argv = cli ? [cli, ...args] : args;
execFile(file, argv, { windowsHide: true }, () => {});This assumes process.execPath is a Node or Bun binary that can execute JS files. In Claude Code that's true (process.execPath = node.exe), but in OpenCode it's the compiled binary:
C:\Users\stefan\.opencode\bin\opencode.exe
So every call becomes:
opencode.exe wmux.js agent-activity --surface ... --active
OpenCode doesn't recognize wmux.js as a subcommand and prints its help page. The () => {} callback swallows the error, so the failure is completely silent.
Result: The sidebar stays stuck on "Running" and never transitions to "Done", "Needs you", or any other state.
Fix
Replace process.execPath with an actual Node binary when it doesn't point to a JS runtime. For example:
function findNode() {
const p = process.execPath;
if (/\b(node|bun)(\.exe)?$/i.test(p)) return p;
const fs = require("node:fs");
const candidates = [
process.env.LOCALAPPDATA + "\\Programs\\nodejs\\node.exe",
"C:\\Program Files\\nodejs\\node.exe",
];
for (const c of candidates) {
try { if (fs.existsSync(c)) return c; } catch {}
}
return "node";
}
const NODE = findNode();Then use NODE instead of process.execPath:
const file = cli ? NODE : "wmux";Environment
- wmux: latest (plugin version 2)
- OpenCode: latest (
opencode.execompiled binary) - OS: Windows 11
- Node: installed at
%LOCALAPPDATA%\Programs\nodejs\node.exebut not on PATH inside OpenCode's process
Metadata
Metadata
Assignees
Labels
No labels
Activity
zutur commentedon Aug 22, 2026
One thought — looking at this more closely, the plugin could potentially avoid the node dependency entirely by talking to the named pipe directly from within the plugin process. OpenCode's runtime supports
node:net, so something like:This is essentially what
wmux-hook.jsdoes under the hood. It would sidestep theprocess.execPathissue altogether and also be a bit faster since it avoids spawning a child process for every event.Just an idea — the
findNode()fix works fine as a pragmatic solution too.fix(opencode): run the CLI through a real JS runtime, map ask/reply e…
amirlehmam commentedon Aug 22, 2026
Thanks @zutur — this is an excellent report, and the diagnosis was exactly right. Fixed in v1.9.0 (393ed65).
You found a hosting assumption, not just a bad line.
process.execPathwas a JS runtime by accident of the host: under Claude Code it happens to benode.exe, so the code shipped and looked fine. Under OpenCode it is the compiled binary and the whole bridge silently disappears — and the() => {}callback is why it stayed invisible for an entire release line, which is arguably the worse half of the bug.I took your fix and pushed the resolution one step upstream. wmux spawns the pane, so it is the process best placed to answer "what can run a
.jsfile on this machine", and it now does that once at launch and declares the answer to everything downstream:The plugin's chain is now:
$WMUX_NODE— wmux already looked, and it could look in places a plugin cannot.process.execPath, but only when its basename really isnode/bun— your check, kept for a plugin installed by an older wmux.PATHentry, then the default install dirs (%ProgramFiles%\nodejs,%LOCALAPPDATA%\Programs\nodejs,~/.bun/bin, …) — which is the case you hit: node installed, just not on the PATH that process inherited.node.The last resort on the wmux side is wmux's own binary, which is plain Node when spawned with
ELECTRON_RUN_AS_NODE=1. So the chain can't dead-end even on a machine with no Node at all. That flag is also the difference between "a JS runtime" and "a second wmux window opens", which is why it travels as its own variable rather than being inferred from the path.Two things came out of chasing it:
wmux/wmux.cmdshims had the same latent bug. They ran barenode, i.e. the same assumption one layer down. They now prefer$WMUX_NODEand fall back to the old behaviour when it is absent.wmux.cmdwas one commit away from being LF-only, whichcmd.exe"handles" by resuming mid-token —setlocalruns astlocal,REMasM— while still reaching the last line. It half-works, so the only symptoms are stderr noise and asetlocalthat never took..gitattributesnow pinseol=crlfinstead of relying oncore.autocrlf.Covered by tests that load the shipped
resources/opencode-plugin/wmux.jsitself rather than a paraphrase of it — a one-token bug deserves a test that would actually have caught the one token — plus tests that run the real.cmdthroughcmd.exeand assert on argument quoting and CRLF.The plugin carries a version marker, so wmux replaces the v2 copy in
~/.config/opencode/plugin/wmux.json first launch. Nothing to do but update. And if it ever misbehaves again,WMUX_PLUGIN_DEBUG=1now makes the plugin log failed CLI calls instead of swallowing them.Answering #188 separately.