omarchy icon indicating copy to clipboard operation
omarchy copied to clipboard

omarchy default agent fails for 8 of 13 agents: empty agent_package makes mise use -g "" always fail

Open NickGV opened this issue 2 months ago • 3 comments

Summary

omarchy default agent <name> fails for 8 of the 13 selectable agents. The command exits 1, prints a confusing mise error, and — importantly — never writes the default agent file, so the selection is silently not applied.

Affected: pi, opencode, claude, codex, gemini, copilot, crush, cursor-agent

Working: omp, grok, muse (via agent_package), openclaw, hermes (via agent_installer)

Steps to reproduce

Pick any agent from the affected list that is not already installed as a non-mise binary in ~/.local/bin:

omarchy default agent gemini

Actual behavior

A floating terminal opens, mise fails, and the command exits 1:

mise ERROR  not found in mise tool registry
Could not install Gemini with mise

~/.config/omarchy/defaults/agent is left unchanged. The same failure occurs through the menu, since the menu action is literally omarchy-default-agent <name>.

Expected behavior

Selecting an agent should set it as the default, and either install it or tell the user how to install it. Re-selecting an agent that is already the default should not fail.

Root cause

omarchy-default-agent resolves an install through exactly two mechanisms: agent_installer (a dedicated script) and agent_package (a mise spec). Eight branches set neither, so both variables are empty:

# /usr/share/omarchy/bin/omarchy-default-agent
grok)   agent="grok";   name="Grok";   agent_package="npm:@xai-official/grok" ;;
gemini | gemini-cli) agent="gemini"; name="Gemini" ;;      # <-- no agent_package
claude | claude-code) agent="claude"; name="Claude Code" ;; # <-- no agent_package

The presence check and the install both then run mise with an empty spec:

agent_present() { user_install || mise where "$agent_package" &>/dev/null; }   # mise where ""
agent_install() { user_install || mise use -g "$agent_package"; }              # mise use -g ""

mise where "" and mise use -g "" always fail (not found in mise tool registry), and because the install check runs before the file write, the command exits without persisting anything:

if ! agent_install; then
  ...
  exit 1
fi

printf '%s\n' "$agent" >"$agent_file"   # never reached

Why user_install() does not cover this

user_install() deliberately rejects mise shims:

# A mise copy would only shadow it, since the mise shims precede ~/.local/bin on PATH.
user_install() {
  [[ -x $HOME/.local/bin/$agent ]] &&
    { [[ -L $HOME/.local/bin/$agent ]] || ! grep -q '^mise use -g' "$HOME/.local/bin/$agent"; }
}

So for these 8 agents, mise is not a supported install path, and a non-mise install is required. That leaves two dead ends:

  1. Agent installed via mise — user_install() returns false, agent_package is empty, both mechanisms fail. The default can never be set.
  2. Agent not installed at all — same failure, and the error blames mise for an agent that was never meant to go through mise.

The result is that the "lazy-installed on first use" behaviour described for the default agent cannot work for these 8.

Suggested fix

Either give each branch a agent_package (mise short names resolve fine — mise search gemini returns a valid entry), or fail early with an actionable message when neither mechanism is available:

if [[ -z "${agent_package:-}" && -z "${agent_installer:-}" ]] && ! user_install; then
  echo "$name is not installed. Install it yourself, then re-run this command." >&2
  exit 1
fi

A defensive guard in agent_install() against an empty agent_package would also prevent the confusing mise error regardless of which branch is hit.

System details

  • Omarchy 4.0.4-1
  • mise 2026.9.12
  • Reproduced on both a fresh selection and re-selecting an agent that is already the default

NickGV avatar Sep 26 '26 12:09 NickGV

I couldn't reproduce this on 4.0.4-1 or current quattro. The quoted root cause (mise use -g "") doesn't match the script: right after the case, both versions have

agent_package=${agent_package:-$agent}

so agents without an explicit agent_package fall back to their own name, never an empty string. All of those names resolve in mise's registry (mise 2026.9.9):

pi → aqua:earendil-works/pi          claude  → aqua:anthropics/claude-code
opencode → aqua:anomalyco/opencode   codex   → aqua:openai/codex
crush → aqua:charmbracelet/crush     copilot → aqua:github/copilot-cli
cursor-agent → http:cursor-agent     gemini  → npm:@google/gemini-cli

On quattro, gemini now maps to agy / antigravity-cli, which also resolves. The not found in mise tool registry error is probably an outdated mise registry on the reporting machine (mise self-update / a newer mise) rather than an Omarchy bug. Could the reporter share mise --version and omarchy version?

staruxian avatar Sep 28 '26 07:09 staruxian

I can't reproduce this on current quattro either. Right after the case, bin/omarchy-default-agent has agent_package=${agent_package:-$agent}, so no agent ends up running mise use -g "". Could you share omarchy version and the output of grep -n 'agent_package=' /usr/share/omarchy/bin/omarchy-default-agent? If your copy has that line, I think this can be closed. If mise use -g fails with "Permission denied", it's probably #13329 (root-owned mise installs after a sudo omarchy update).

jandrusk avatar Oct 08 '26 13:10 jandrusk

I could not reproduce this, and the root cause described here is not in the script. Right after the case, bin/omarchy-default-agent sets agent_package=${agent_package:-$agent} (line 51 on quattro, line 50 in v4.0.4, and present since the script was added), so an agent without an explicit package falls back to its own name, and mise where "" / mise use -g "" is never run.

On a worker built from the Omarchy ISO with mise 2026.9.11, I ran the script with --install for all eight agents. I used the quattro copy for all eight, and the v4.0.4 copy for gemini and pi. Each call ran mise use -g <name> (antigravity-cli for gemini on quattro), installed the tool, exited 0 and wrote ~/.config/omarchy/defaults/agent. Choosing an agent that was already the default also exited 0 and kept the file. For comparison, mise's own output for an empty spec on that version is @latest … failed: not found in mise tool registry, which is not what the issue quotes.

One thing that does explain the symptom: every selection, including choosing the current default again, runs mise use -g <package> before writing the file, so any failure in mise itself on your machine (an old registry, or root-owned mise files as in #13329) stops the default from being saved.

To narrow it down, please post the output of these:

  • omarchy version and mise --version
  • grep -n 'agent_package=' /usr/share/omarchy/bin/omarchy-default-agent
  • mise use -g gemini run directly in a terminal (or mise use -g pi), with the full output

Codex at medium effort reviewed the script independently and also found that agent_package cannot be empty when the install runs, though its independence is not guaranteed. This now waits on that output.

omarchybot avatar Oct 13 '26 02:10 omarchybot