Skip to content

fix(shell): skip Windows Terminal's wt in the PowerShell integration - #4786

Merged
max-sixty merged 1 commit into
mainfrom
agent-a49d13c0925412fbe
Nov 14, 2026
Merged

max-sixty merged 1 commit into
mainfrom
agent-a49d13c0925412fbe

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

The PowerShell wrapper, and the completion step that runs while the integration loads, both took the first wt application on PATH. Windows Terminal's wt.exe alias lives in WindowsApps, often ahead of worktrunk, so a profile that loaded the integration from a worktrunk further down PATH got a wrapper that opened Windows Terminal on every call, and no completer. Both sites now skip a wt under WindowsApps, the rule plugins/worktrunk/hooks/wt.sh and the pi, omp and OpenCode plugins already apply; with no other wt on PATH the wrapper fails with exit 127 instead of running Windows Terminal.

Worth weighing: the binary is still looked up by name on each call, as in the other shells, rather than baked in from current_exe(), which would go stale in open shells after an upgrade moves the binary. The profile line wt config shell install writes still runs the first wt on PATH, so a standard install with Windows Terminal first never loads the integration; this fixes an init loaded from worktrunk itself, as in the report.

kurone-kito reported this in dotfiles#716. Requested by max-sixty. A new test puts a logging fake wt in a WindowsApps directory ahead of a fake worktrunk and fails on the old template; it passes locally under pwsh on macOS, and its Windows half runs in CI. Loading the real init in pwsh with the fake first on PATH, wt --version and tab completion reach worktrunk.

This was written by Claude Code on behalf of max-sixty

The PowerShell wrapper, and the completion step that runs while the
integration loads, both took the first `wt` application on PATH. Windows
Terminal installs its own `wt.exe` app-execution alias in
`%LOCALAPPDATA%\Microsoft\WindowsApps`, which is on PATH and often ahead
of worktrunk. A profile that loads the integration from a worktrunk
further down PATH still got a wrapper that ran Windows Terminal: every
call opened Terminal instead of reaching worktrunk, and the completion
step launched it at startup and registered no completer.

Both sites now skip a `wt` under a `WindowsApps` directory, the rule that
`plugins/worktrunk/hooks/wt.sh` and the pi, omp and OpenCode plugins
(#4698) already apply. When no other `wt` is on PATH, the wrapper reports
that worktrunk wasn't found and sets `$LASTEXITCODE` to 127, rather than
running Windows Terminal or failing on an empty call.

The binary is still looked up by name on each call, as in the other
shells, rather than baked in from `current_exe()` when the init is
generated. A baked path goes stale in every open shell after an upgrade
that moves the binary (on Linux, `current_exe()` resolves Homebrew and
Nix symlinks to versioned paths) and in any profile that caches the init
output.

The profile line that `wt config shell install` writes still runs the
first `wt` on PATH, so with Windows Terminal first it never reaches
worktrunk's init; this change covers an init loaded from worktrunk itself.

The new test puts a logging fake `wt` in a `WindowsApps` directory ahead
of a fake worktrunk, and checks that the completion step and the wrapper
reach worktrunk, and that with only the fake Terminal on PATH the wrapper
fails with exit 127.

Co-Authored-By: Claude <[email protected]>
@max-sixty
max-sixty merged commit 1df2aad into main Nov 14, 2026
37 checks passed
@max-sixty
max-sixty deleted the agent-a49d13c0925412fbe branch November 14, 2026 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants