Skip to content

Restore missing mise stubs from the canonical install list - #13781

Open
Bartok9 wants to merge 5 commits into
omacom:quattrofrom
Bartok9:bartok9/restore-mise-stubs-from-canonical
Open

Bartok9 wants to merge 5 commits into
omacom:quattrofrom
Bartok9:bartok9/restore-mise-stubs-from-canonical

Conversation

@Bartok9

@Bartok9 Bartok9 commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

What

Existing installs that clear ~/.local/bin never get the documented mise stubs back. migrations/1784909971.sh only rewrites wrappers that already exist there.

This migration sources install/user/mise.sh so omarchy update recreates the canonical stubs (including gh). hey, basecamp, and cf stay omitted when preinstalls-removed is set.

Why

#13708: after rm ~/.local/bin/*, gh is gone forever and the documented first-run auto-install never returns.

Testing

  • bash test/shell.d/mise-stub-restore-migration-test.sh
  • git diff --check

Closes #13708.

@omarchybot omarchybot added the bug Something isn't working label Oct 1, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed at f982491 against quattro. This needs changes before it can go further.

What was checked. I ran this on a disposable Omarchy worker. Your test passes there, and ./test/cli stops on the same unrelated test on quattro (vscode generated theme references current theme file), so that failure isn't from this PR. I also ran two scenarios of my own, both described below. Codex Medium reviewed the PR separately, reached the same findings, and reproduced the return failure. It could read this review while working, so treat its agreement as a second look rather than an independent confirmation.

It reinstalls tools a user chose to remove. omarchy-remove-preinstalls deletes the stubs for codex, claude, agy, copilot, gh, opencode, playwright, pi, omp, ori, grok, crush, ghui and hunk, then sets preinstalls-removed. migrations/1790712217.sh only skips hey, basecamp and cf under that marker, so it brings every one of those 14 stubs back. On the worker, ~/.local/bin held basecamp cf hey after omarchy-remove-preinstalls. After this migration it held all 17 stubs again. Other migrations that add a stub skip it entirely when the marker is set (migrations/1785617047.sh:3, for example). The last block of test/shell.d/mise-stub-restore-migration-test.sh asserts that gh comes back under the marker, which is the regression, though it reports it as "removed preinstalls stay removed".

It overwrites files the user owns. Every entry goes through omarchy-mise-install, which runs rm -f and then writes a wrapper (bin/omarchy-mise-install:51). A user's own ~/.local/bin/gh or claude gets replaced, for example a symlink from Claude's native installer. Only cursor-agent and muse are guarded in install/user/mise.sh. A migration that says it restores missing stubs should leave existing files alone.

return 0 at line 8 fails rather than skips. omarchy-migrate runs each migration as bash -euo pipefail "$file", not by sourcing it, and a top-level return there is an error. If install/user/mise.sh were ever absent, the migration would fail and stop the migrations after it.

Whether a migration is the right fix. Recovery already exists. omarchy-refresh-applications runs install/user/mise.sh, and on the worker it rebuilt every stub from an empty ~/.local/bin on quattro. migrations/1786183928.sh already ran it once on every install. A migration also runs only once per user, so this one restores stubs deleted before it runs but not ones deleted afterwards, which is what #13708 asks for. The maintainer should decide whether a second one-shot pass is wanted, or whether pointing users at omarchy-refresh-applications is enough.

Nothing was pushed to your branch. The preinstalls behaviour is a deliberate choice your test pins down, so it's yours to change rather than ours to rewrite. This is waiting on you for the three defects above, and on the maintainer for whether the migration is wanted at all.

@Bartok9

Bartok9 commented Oct 3, 2026

Copy link
Copy Markdown
Contributor Author

Pushed 5ca68f5 to address the three defects.

  1. Removed preinstalls stay removed. If preinstalls-removed is set the migration exits before sourcing install/user/mise.sh, same shape as migrations/1785617047.sh. The test no longer asserts that gh comes back under that marker.
  2. Existing files are left alone. The migration wrapper skips omarchy-mise-install when ~/.local/bin/$command already exists, so a user-owned gh or claude (including a native-installer symlink) is not rm -f'd.
  3. Missing install list exits 0. The top-level return 0 is now exit 0, so bash -euo pipefail does not fail the migration and stop later ones.

On the one-shot question: agreed this only covers stubs deleted before the migration runs. omarchy-refresh-applications remains the repeatable recovery. This pass is for installs that already emptied ~/.local/bin and will never hit that command unless pointed at it — which is what #13708 is. Happy to close this and document the refresh command instead if you'd rather not ship a second one-shot.

@greptile-apps

greptile-apps Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The change reaches the user update workflow and command launchers.

Do not merge until the migration actually restores commands and the test follows the repository's requirements.

Findings

  1. P1 The repair does nothing ▶
  2. P2 Migration tests break repository rules ▶

Summary

Adds a migration intended to restore missing mise commands, plus a test covering restoration, existing launchers, opt-out state, and a missing install file.

  • Updates rerun the mise setup when command stubs are missing.

Reviews (4) · Last reviewed commit: "Leave the restore migration pending when..." · Reviewed by Greptile

Comment thread migrations/1790712217.sh Resolved
Comment thread migrations/1790712217.sh Resolved
@Bartok9

Bartok9 commented Oct 3, 2026

Copy link
Copy Markdown
Contributor Author

Pushed ebfd17c for the Greptile pass on 5ca68f5.

  • Dangling user links: fixed. The existence check is now -e || -L, so a user-owned launcher with a missing target is not rm -f'd. Test covers a dangling ~/.local/bin/claude.
  • Missing install list exits 0: kept. That was the fix for the earlier finding that a top-level return fails under bash -euo pipefail and stops later migrations. exit 1 would retry forever on installs that never ship the leaf. Will flip it if a maintainer wants the retry.

Still waiting on a maintainer for whether a second one-shot is wanted at all versus pointing #13708 at omarchy-refresh-applications.

@greptile-apps

greptile-apps Bot commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

Want your agent to iterate on Greptile's feedback? Try greploops.

@omarchybot omarchybot added verified Omarchy Triage has verified that this issue is ready for final review ready Good to merge labels Oct 3, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Re-reviewed at 107467a against quattro. Your three changes fix the defects from the last review. I pushed one more commit, so the only open question is the maintainer's.

What was checked. I ran this on a disposable Omarchy worker, with the branch merged onto current quattro (a85e29a). On an install whose migrations had all run, I emptied ~/.local/bin and ran omarchy-migrate. On quattro, gh stays missing. With this PR it comes back with all 19 stubs. With the migration reverted it is missing again. ./test/cli and the migration and mise tests under test/shell.d/ fail only where quattro already fails: two vscode theme assertions and the two kernel migration tests. Codex Medium reviewed the PR in two rounds. Its first round found the two problems fixed below, which I had also found. Its second round, on the pushed commit, found nothing. It could read this review while working, so its agreement is not an independent confirmation.

Fixed: skipped stubs that were removed with preinstalls, left existing files and dangling symlinks alone, and dropped the top-level return.

Pushed: 107467a, leave the migration pending when the install list is missing. Our last review was wrong to treat a failing migration as the problem. agents/skills/migrations.md says a migration that cannot finish must exit non-zero and stay pending. With exit 0, a missing install/user/mise.sh marked the restore as done having restored nothing, so it would never run again once the file came back. The list ships in the same package as the migration, so the commit drops the guard and lets source fail under bash -e. The last test case also reused the home that already had preinstalls-removed set, so it passed through that exit whether or not the guard existed. It now uses a fresh home and asserts that the migration fails. With the old guard restored, it fails.

Not a problem: a restored stub does not shadow a copy the user installed elsewhere, because Omarchy appends ~/.local/bin to the end of PATH (default/bash/envs:33).

Waiting on the maintainer to decide whether a one-shot restore is wanted. It recovers installs that have already emptied ~/.local/bin. Stubs deleted after it runs still need omarchy-refresh-applications.

@Bartok9

Bartok9 commented Oct 3, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the re-review and for 107467a. Leaving the migration pending when install/user/mise.sh is missing matches agents/skills/migrations.md; the earlier exit 0 would have marked a no-op restore as done. The three prior defects stay fixed (preinstalls stay removed, existing files and dangling symlinks are left alone, no top-level return). Still fine either way on a second one-shot versus pointing #13708 at omarchy-refresh-applications — that's the maintainer's call.

Bartok9 and others added 5 commits October 25, 2026 17:26
1784909971.sh only rewrote wrappers that already existed in ~/.local/bin, so clearing that directory permanently dropped the documented gh lazy install. Source install/user/mise.sh so later updates recreate the stubs, without bringing hey/basecamp/cf back after preinstalls-removed.

Closes omacom#13708.
Honor preinstalls-removed the way other stub migrations do, leave files the user already owns, and exit 0 when the install list is absent instead of a top-level return.
-e treats a broken symlink as absent, so a user-owned ~/.local/bin/gh with a missing target was rm -f'd and replaced. Check -L as well.
The migrations guide requires a migration that cannot finish to exit non-zero and stay pending. Exiting 0 when install/user/mise.sh is absent marked the restore done having restored nothing, so it never ran again once the file came back. The list ships in the same package as the migration, so dropping the guard lets source fail under bash -e instead.

The test for that case reused the home that already had preinstalls-removed set, so it passed through the opt-out exit whether the guard existed or not. It now uses a fresh home and asserts the migration fails.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Bartok9
Bartok9 force-pushed the bartok9/restore-mise-stubs-from-canonical branch from 107467a to 5f9188d Compare October 25, 2026 21:26
Comment thread migrations/1790712217.sh
exit 0
fi

mise() { :; }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 The repair does nothing

mise() { :; } disables every action in the current install/user/mise.sh. That file only calls mise reshim --system and mise reshim; it never calls omarchy-mise-install. The migration therefore restores nothing but returns success, so omarchy-migrate marks the repair complete. The added test also fails its first gh check.

Update the migration to use the current way mise creates missing commands instead of disabling it.

Comment on lines +7 to +8
migration="$ROOT/migrations/1790712217.sh"
[[ -f $migration ]] || fail "the restore migration is present"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Migration tests break repository rules

This adds a test specifically for 1790712217.sh. AGENTS.md explicitly says not to add migration tests because migrations run once and are frozen after shipping. This repository requirement must be satisfied before merging.

Remove this suite test. If the repair needs reusable logic worth testing, move that logic into a bin/ command and test the command instead.

File Used: AGENTS.md (source)

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!

@omarchybot omarchybot removed verified Omarchy Triage has verified that this issue is ready for final review ready Good to merge bug Something isn't working labels Oct 26, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Re-reviewed at 5f9188d. The commits are the same five reviewed at 107467a, rebased onto quattro 2fca7fe. quattro has changed underneath them, and on today's quattro this migration does nothing.

What changed. #9596 (da2db1a) replaced the handwritten wrappers in ~/.local/bin with mise's native lazy shims. The tools are now declared in etc/mise/conf.d/omarchy-tools.toml. Their shims live in ~/.local/share/mise/shims (line 6 of that file), and default/bash/env-bootstrap puts that directory on PATH ahead of ~/.local/bin. Migration 1791382872.sh builds those shims and deletes the old wrappers. install/user/mise.sh is now just mise reshim --system and mise reshim. It no longer calls omarchy-mise-install.

What that does to this PR. migrations/1790712217.sh replaces mise with a function that does nothing (line 17), then sources install/user/mise.sh (line 32). That file now only calls mise, so the migration creates nothing. It still exits 0, so omarchy-migrate marks it done. The new test fails at its first assertion (test/shell.d/mise-stub-restore-migration-test.sh:22), because no gh appears in ~/.local/bin. If the migration worked, it would bring back the wrappers 1791382872.sh removes on purpose. agents/skills/mise-tools.md also says not to add handwritten wrappers for ordinary tools.

The bug it fixes. #13708 was about losing gh and the other tools when ~/.local/bin is cleared. On quattro those tools no longer live in ~/.local/bin, so clearing it no longer removes them.

What was checked. This review was done by reading only, against quattro at 7eedd17. Nothing ran on a worker this time. Codex Medium and muse-wonder (pi, thinking high) reviewed the PR head and current quattro separately. Both reached the same conclusion: at this head the migration does nothing, its test fails at line 22, and #13708 no longer applies. Muse-wonder added that the migration still exits 0, so omarchy-migrate records it as done. Both could read this review while working, so their agreement is not an independent confirmation.

Classification. The two models classifying the PR disagreed: one called it a bug fix, the other an enhancement, since recreating tools a user deleted is new behaviour. It carries neither label for now.

Waiting on the maintainer to decide whether to close it as superseded by #9596. #13708 can probably be closed with it. If you see a case quattro still misses, @Bartok9, please say so here.

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.

mise stubs cannot be restored after ~/.local/bin is cleared, silently breaking the documented gh auto-install

2 participants