Repository navigation
Symlink mise tools so argv[0] survives exec -a - #8133
chessing234 wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Replaces mise shell wrappers with direct binary symlinks to preserve argv[0].
Tip
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.
Changes:
- Resolves installed binaries using
mise where. - Adds
argv[0], failure-path, and symlink tests. - Updates migration and agent tests for symlinks.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
bin/omarchy-mise-install |
Replaces wrappers with binary symlinks. |
test/shell.d/mise-install-test.sh |
Tests installation and argv[0] preservation. |
test/shell.d/mise-wrapper-quiet-migration-test.sh |
Verifies wrapper-to-symlink migration. |
test/shell.d/default-agent-test.sh |
Adapts agent fixtures to symlinks. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| if grep -q ' x ' "$mise_log"; then | ||
| fail "installer no longer re-execs through mise x" | ||
| fi |
There was a problem hiding this comment.
right, the stub logs $* so mise x would show up as a leading x, not a spaced one. the check is on the first field now.
|
@dhh @ryanrhughes ready for review |
Shell wrappers re-exec through mise x, so multi-call binaries lose the invocation name Claude Code relies on for ugrep. Link the real binary instead, keep command-name guards, and teach remove-preinstalls to drop Omarchy's absolute mise symlinks while leaving Cursor's relative ones.
2fda5f4 to
a817116
Compare
|
Reviewed at a817116 on a disposable Omarchy worker, with real mise (2026.9.11) in a throwaway The bug from #8120 is real, and this fixes it for It breaks most of the other tools it installs, and with them a fresh install.
It also changes more than #8120 asks for. These launchers are lazy: Related: #9596 replaces these wrappers with mise's native lazy shims, and #13090, #8692 and #9583 each rewrite the same wrapper line to fix the exec loop. None of them preserves What ran: |
|
| target=$(mise which --tool "$package" "$bin") || exit 1 | ||
| if [[ ! -x $target ]]; then | ||
| exit 1 | ||
| fi | ||
|
|
||
| rm -f "$HOME/.local/bin/$command" | ||
| ln -sf "$target" "$HOME/.local/bin/$command" |
There was a problem hiding this comment.
Existing wrappers remain broken Existing installations already have the previous
--quiet shell wrappers. This change creates symlinks only when the installer runs again; normal updates do not rerun user provisioning, and migration 1787573629.sh skips --quiet wrappers. Users who update therefore keep wrappers that lose the forged argv[0], so the Claude Code grep failure persists. These wrappers need a migration to symlinks.
| if [[ -L ~/.local/bin/cursor-agent ]]; then | ||
| cursor_target=$(readlink ~/.local/bin/cursor-agent) | ||
| if [[ $cursor_target == /* ]]; then | ||
| rm -f ~/.local/bin/cursor-agent |
There was a problem hiding this comment.
| for layout in bin/codex gh_2.101.0_linux_amd64/bin/gh hunkdiff-linux-x64/hunk; do | ||
| name=${layout##*/} | ||
| seed_tool "$name/v1" "$layout" | ||
| ln -s v1 "$installs/$name/latest" | ||
| MISE_TARGET="$installs/$name/latest/$layout" | ||
| run_install "$name" "$name" | ||
| [[ $(readlink "$home/.local/bin/$name") == "$MISE_TARGET" ]] || | ||
| fail "$name retains mise's complete executable path" | ||
| seed_tool "$name/v2" "$layout" | ||
| rm "$installs/$name/latest" | ||
| ln -s v2 "$installs/$name/latest" | ||
| rm "$installs/$name/v1/$layout" | ||
| [[ $(invoke_argv0 "$home/.local/bin/$name" ugrep) == "ugrep" ]] || | ||
| fail "$name follows mise's updated version alias" | ||
| done |
There was a problem hiding this comment.
Upgrade test assumes moving paths The mise stub returns a hand-built
latest symlink path, so this test passes without checking whether real mise which --tool returns a path that moves with upgrades. The installer stores that path unchanged, and mise up does not refresh launchers. A real-mise upgrade check would catch launchers that remain on an old version or dangle if that version is removed.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
|
Looked again at 19ca4ad by reading the new commit. Nothing ran on a worker this round. The path resolution is fixed. Two problems are still open, both found by reading this commit:
The classification is unsettled, so this item has no class label. I read it as a bug fix, because #8120 is behaviour that is wrong on This is waiting on the maintainer. Whether launchers should install eagerly, for every tool or only for the ones called under another name, decides both what this pull request is and whether it needs the migration above. |
withdrawing this direct-symlink approach: an isolated test with real mise 2026.9.18 kept running jq 1.7.1 after selecting 1.8.1, then left a dangling launcher after uninstalling 1.7.1. the nested-path fix is insufficient, the moving-alias test only modeled the desired behavior, and existing quiet wrappers still lack an upgrade migration; no claim that the upgrade path is fixed remains.