Repository navigation
Description
Summary
worktrunk ships agent plugins that invoke the CLI by the bare name wt. On Windows
wt is already taken by the Windows Terminal app-execution alias
(%LOCALAPPDATA%\Microsoft\WindowsApps\wt.exe), which is on PATH ahead of any
worktrunk install directory. So wt config state marker set 🤖 does not reach
worktrunk at all — it launches Windows Terminal, which tries to start a program named
config and pops an error window on the user's desktop.
The repo already solves this correctly for the shell hooks: plugins/worktrunk/hooks/wt.sh
honours WORKTRUNK_BIN, prefers git-wt.exe on MSYS/Cygwin, and explicitly rejects a
wt that resolves into *WindowsApps*. The three bundled TypeScript entry points don't
use that resolver — they hardcode "wt". This is a follow-up to #133 (closed by #134,
which added the worktrunk/git-wt shim): the shim exists, but the plugins don't use it.
Observed symptom
A Windows Terminal window appears spontaneously, titled config, containing:
[出现错误 2147942402 (0x80070002) (启动"config state marker set 🤖"时)] 系统找不到指定的文件。
(0x80070002 = ERROR_FILE_NOT_FOUND.) The window stays open, so every agent
start/end/clear event stacks up more of them.
Affected call sites
Verified unchanged on main today (blob SHAs 3430ac2 for dev/pi-extension.ts,
e25d45e for dev/opencode-plugin.ts); line numbers below are from commit 786978fd
(v0.81.0), reading the installed copies:
| file | line | call |
|---|---|---|
dev/pi-extension.ts |
22 | await pi.exec("wt", ["config", "state", "marker", ...args], { cwd }) |
dev/omp-hook.ts |
21 | await pi.exec("wt", ["config", "state", "marker", ...args], { … }) |
dev/opencode-plugin.ts |
43 | await execute("wt", ["config", "state", "marker", ...args], { cwd: directory }) |
dev/opencode-plugin.ts |
89 | const { stdout } = await execute("wt", args, …) — inside the generic wt() wrapper |
That last one is the larger problem: wt() at :89 backs the switch and remove
calls at :125 and :131, so on Windows those are aimed at Windows Terminal as well —
worktree switch/remove through the OpenCode plugin cannot reach worktrunk. (Stated from
the code path; the marker calls are the ones I reproduced.)
Why nobody sees an error
execFile returns exit code 0 for these calls (Windows Terminal accepts the
invocation and reports the failure only in a GUI window), and each of the three call
sites wraps it in try { … } catch {}. So nothing is written to any log — no agent log,
no worktrunk log, no Windows Terminal log. The user just gets mystery popups. Reproduced:
node -e 'require("child_process").execFile("wt", ["config","state","marker","set","x"], (e,o,s) => console.log(e ? e.code : 0, JSON.stringify(o), JSON.stringify(s)))'
// → 0 "" "" (and a Windows Terminal error window appears)(Get-Command wt -All).Source → C:\Users\<user>\AppData\Local\Microsoft\WindowsApps\wt.exe.
Suggested fix
Port the existing hooks/wt.sh policy into a small shared TS helper used by all three
entry points, e.g.
function resolveWorktrunkBin(): string {
if (process.env.WORKTRUNK_BIN) return process.env.WORKTRUNK_BIN;
if (process.platform === "win32") return "git-wt.exe"; // unambiguous, shipped since #134
return "wt";
}Two notes on making it durable rather than a one-off:
git-wt.exeis only guaranteed to be onPATHfor some installs. If the helper can
be given the absolute path of the binary that installed the plugin (the installer
knows it), that is strictly better than a name lookup.- Because these failures are silent, it would be worth having the plugins detect the
collision once and surface it (e.g. ifwt --versionoutput doesn't mention
worktrunk, warn instead of swallowing) — otherwise the next Windows name collision
will be just as invisible.
Happy to open a PR for the helper + the four call sites if you'd like it in that shape.
Environment
- worktrunk v0.81.0, Windows 11, Git for Windows (MSYS bash) + PowerShell + Windows Terminal 1.24
- Agents affected on this machine: pi (
D:\pi\bin\pi.exe, extension installed bywt config plugins pi install) and OpenCode (plugin installed bywt config plugins opencode install). The Claude Code and Codex plugins are not affected because they route throughhooks/wt.sh.
Activity
worktrunk-bot commentedon Nov 4, 2026
I opened #4698 with a fix, and its CI is green. A maintainer will decide whether to merge it.
The pi, oh-my-pi, and OpenCode plugins now choose the binary the way
hooks/wt.shdoes. They useWORKTRUNK_BINif it's set. On Windows they otherwise look forgit-wt.exefirst, and accept awt.exeonly when the first one onPATHisn't underWindowsApps. If no usable binary turns up, marker updates are skipped quietly. OpenCode's worktree switch/remove fails with an error that namesgit-wt.exeandWORKTRUNK_BIN, rather than handing the command to Windows Terminal.I checked this with a simulated Windows
PATH, not on a real Windows host. Once it lands, it would help to confirm on your machine that the popups stop. Runwt config plugins pi installandwt config plugins opencode installagain to replace the installed copies.PR #4698 doesn't include your second suggestion: warning when the
wtonPATHturns out not to be worktrunk.fix(plugins): skip Windows Terminal's wt in the pi, omp, and OpenCode…