Skip to content

Stop mise wrappers from re-executing themselves (breaks Claude Code detection in T3 Code) - #9175

Open
lllangWV wants to merge 1 commit into
omacom:quattrofrom
lllangWV:fix-mise-wrapper-recursion
Open

lllangWV wants to merge 1 commit into
omacom:quattrofrom
lllangWV:fix-mise-wrapper-recursion

Conversation

@lllangWV

Copy link
Copy Markdown

Problem

The wrapper generated by bin/omarchy-mise-install runs:

exec mise x "$package" -- "$bin" "$@"

mise x resolves $bin via PATH. If ~/.local/bin appears before ~/.local/share/mise/installs/<tool>/latest, $bin resolves to the wrapper itself and it re-executes forever. mise only prepends the install dir when it is not already on PATH — if the dir is already present further down, it keeps its position, so ~/.local/bin/claude keeps winning.

Interactive shells never see this: mise activate puts the install dir first. Non-shell launchers (Electron apps, .desktop entries, systemd units) do.

Concrete case: T3 Code cannot detect Claude Code

T3 Code spawns claude --version (4 s timeout) to detect the Claude Agent CLI. Its server process derives PATH from a login shell, which on Omarchy comes out as:

~/.bun/bin:~/.local/bin:…:~/.local/share/mise/installs/claude/latest:…:~/.local/share/mise/shims:…

claude → ~/.local/bin/claude (the wrapper) → mise x claude -- claude → ~/.local/bin/claude → … The probe spins, printing mise ~/.config/mise/config.toml tools: [email protected] thousands of times, until T3 kills it. Its trace log shows:

"Claude Agent CLI version probe exited with a non-zero status." {"exitCode":1,"stdoutLength":8100,...}
runClaudeCommand … durationMs 4003 … "InterruptError: All fibers interrupted"

and the UI reports Claude as not installed. Same applies to codex and every other wrapper.

Reproduce

PATH=~/.local/bin:/usr/bin:~/.local/share/mise/installs/claude/latest timeout 5 claude --version
echo $?   # 124, CPU pegged, stdout full of repeated "mise … tools: claude@…" lines

Fix

Hand mise x the absolute path from mise which instead of a bare name, so no PATH lookup happens. mise x is kept so the tool environment it sets up (e.g. node for npm-backed packages) is unchanged.

exec mise x "$package" -- "\$(mise which "$bin")" "\$@"

Verified with the exact T3 Code PATH: old form loops until timeout (rc=124), new form answers in ~12 ms; T3 Code then detects Claude Code normally. mise which also resolves codex and gh (bin name ≠ package name) correctly.

https://claude.ai/code/session_01Er7PXFnS9TZEM4ahK184Dt

The wrapper ran `mise x <package> -- <bin>`, which resolves <bin> on PATH.
When ~/.local/bin comes before ~/.local/share/mise/installs/<tool>/latest
(mise only prepends the install dir if it is not already on PATH, so an
existing later entry keeps its position), <bin> resolves to the wrapper
itself and it forks forever.

Interactive shells never hit this because mise activation puts the install
dir first. Non-shell launchers do: T3 Code derives its server PATH from a
login shell with ~/.local/bin first, so its `claude --version` probe spun
until its 4s timeout and Claude Code showed as not installed.

Pass the absolute path from `mise which` to `mise x` instead, keeping
the tool environment mise x sets up.

Claude-Session: https://claude.ai/code/session_01Er7PXFnS9TZEM4ahK184Dt
@imadtg

imadtg commented Sep 1, 2026 •

Copy link
Copy Markdown

This is a less robust duplicate of #8692

It also lacks a migration and tests.

@kodjokeyi

Copy link
Copy Markdown

had same issue, fixed same way.

@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed by Claude Opus 5.5 by reading the change. The pull request wasn't run on a worker. The second opinion (Codex Medium) didn't run because today's review quota is spent, so only one reviewer looked at this.

The diagnosis is right. With ~/.local/bin ahead of the tool's install dir on PATH and no mise activate, mise x "$package" -- "$bin" resolves the bare name back to the wrapper, and the wrapper re-execs itself. Passing an absolute path breaks the loop.

Seven other open pull requests fix the same loop: #8692, #9583, #13090, #13470, #13614, #13677 and #13769. I recommend #8692 over this one, for three reasons:

  • It conflicts with quattro. Since this branch was cut, bin/omarchy-mise-install on quattro has started quoting $package and $bin through printf %q. The exec mise x line this diff edits no longer exists in that form.
  • Wrappers already on users' machines aren't fixed. There's no migration, so every claude, codex and other wrapper generated before this change keeps looping until it's regenerated by hand. Resolve mise wrapper binaries before execution #8692 adds a migration that regenerates only wrappers that exactly match the stock template.
  • The lookup isn't scoped to the package. Without --tool, mise which "$bin" searches every active tool, so a same-named binary from another tool can win. Resolve mise wrapper binaries before execution #8692 resolves through mise bin-paths "$package", which looks only at that package's install. It also reports a package that provides no such binary as an error.

This one also adds no test, and #8692 adds test/shell.d/mise-wrapper-resolution-test.sh. #8692 has been reproduced on a worker: it loops on quattro, works on its head, and loops again with the fix reverted.

I didn't verify this pull request on a worker, because the fix it would ready is #8692's. Choosing between the competing fixes is the maintainer's call, so this waits on them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants