Skip to content

Default OMARCHY_PATH and pass --yes to mise during unattended update - #14337

Open
Bartok9 wants to merge 2 commits into
omacom:quattrofrom
Bartok9:bartok9/update-pkexec-omarchy-path-mise-yes
Open

Bartok9 wants to merge 2 commits into
omacom:quattrofrom
Bartok9:bartok9/update-pkexec-omarchy-path-mise-yes

Conversation

@Bartok9

@Bartok9 Bartok9 commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Summary

pkexec omarchy-update -y currently dies immediately because omarchy-update-dev reads $OMARCHY_PATH under set -u after polkit strips the login environment. After that, -y still hangs on mise's config-trust prompt even though -y is documented as a promise not to ask.

Changes

  • omarchy-update-dev defaults OMARCHY_PATH to /usr/share/omarchy, matching omarchy-migrate. Packaged installs still skip the git pull.
  • omarchy-update-mise runs mise up --yes when OMARCHY_UPDATE_UNATTENDED=1.

Fixes #14325

Tests

  • test/shell.d/update-dev-test.sh
  • test/shell.d/update-mise-unattended-test.sh

@greptile-apps

greptile-apps Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The changes reach the Omarchy update workflow and the tools it updates.

The test changes must meet the repository’s explicit requirements before merging.

Findings

  1. P2 Test only checks source text ▶
  2. P2 Update tests are unnecessarily split ▶
  3. P2 Numeric comparison breaks required style ▶

Summary

The PR defaults OMARCHY_PATH for packaged updates and adds --yes to mise updates in unattended mode.

  • Packaged updates now get a default Omarchy path.
  • Unattended updates now answer mise's confirmation prompt.

Reviews (3) · Last reviewed commit: "Default OMARCHY_PATH in omarchy-update b..." · Reviewed by Greptile

Comment thread bin/omarchy-update-dev Resolved

@chessing234 chessing234 left a comment

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.

everything seems fine, ready to merge.

@Bartok9

Bartok9 commented Oct 6, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @chessing234 — glad the default OMARCHY_PATH placement and mise up --yes look good. Happy for a maintainer to merge when convenient; I don't have merge rights on quattro.

@georgeanderson

Copy link
Copy Markdown

Reproduced on a stock packaged install today (2026-10-10), Omarchy 4.0.4-1. The interactive shell already had OMARCHY_PATH=/usr/share/omarchy, and there is no /etc/omarchy.conf.

sudo omarchy update is the invocation requires-sudo=true points at. sudo's environment reset drops OMARCHY_PATH. The run confirmed, pruned nothing, created a snapshot, then aborted before pacman:

/usr/bin/omarchy-update-dev: line 7: OMARCHY_PATH: unbound variable

That is the #8239 crash. The helper default in this PR is the right fix for omarchy-update-dev on its own.

The new default in bin/omarchy-update, placed before omarchy_security_require_source_root, does more. On current quattro an unset OMARCHY_PATH stops at that check. Filling in /usr/share/omarchy lets sudo omarchy update pass the guard and keep running as root. #13329 is that outcome: sudo omarchy update -y finished, and omarchy-update-mise wrote root-owned files under the invoking user's home. mise up --yes when OMARCHY_UPDATE_UNATTENDED=1 makes that write non-interactive for the -y form of the same command.

Please treat the entry-point default as incomplete until a root-started update either drops back to the invoking user for the home-directory steps (mise, and migrations that write to $HOME), or refuses to continue and tells the caller to run omarchy update without sudo. As written, this turns the 4.0.4 crash into #13329.

@Bartok9

Bartok9 commented Oct 11, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @georgeanderson — the 4.0.4 reproduction matches the #8239 crash this PR started from, and the #13329 point is right.

The omarchy-update-dev default only fills an unset path and still exits 0 when that path is the packaged install, so it does not start a git pull as root. The entry-point default is a different change: it is placed before omarchy_security_require_source_root so an unset OMARCHY_PATH can get past that guard. On a stock install that is exactly what lets sudo omarchy update keep going as root, and mise up --yes under OMARCHY_UPDATE_UNATTENDED=1 then makes the home-directory write non-interactive. That is #13329, not a complete fix.

I don't have merge rights on quattro and I won't push a root-drop or a sudo-refusal onto this branch without a maintainer picking which of those two they want. Until then please treat the entry-point default as incomplete: the helper default is the #8239 fix; the entry-point default should not land on its own.

Happy to follow a maintainer's choice — drop back to the invoking user before mise/migrations that write $HOME, or refuse a root-started update and tell the caller to run omarchy update without sudo.

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

Copy link
Copy Markdown
Collaborator

Reviewed at 57621d6 against quattro, by Claude Opus 5.5 with a second opinion from Codex Medium. Ran on a disposable Omarchy worker: ./test/cli and both test/shell.d tests from this PR pass. It is not ready yet. There are two blocking problems, and one of them has to be decided by a maintainer.

The reported crash can't happen through omarchy update on quattro. When OMARCHY_PATH is unset, omarchy_security_require_source_root (bin/omarchy-update:19) refuses with "OMARCHY_PATH does not match this Omarchy command." before omarchy-update-dev ever runs. I checked this on the worker: with OMARCHY_PATH unset, the guard refuses /usr/bin/omarchy-update on base, and it passes once the default this PR adds at bin/omarchy-update:22 is applied. So the entry-point default doesn't fix a crash. What it does is let a root-started update (pkexec, or sudo with the environment reset, which on the worker gives HOME=/root) carry on through steps written to run as the desktop user: stay-awake keys off EUID, hooks and mise run in root's home (#13329 is the result when the user's home paths survive), and yay gets reached as root. @georgeanderson and @Bartok9 have already said above that this half shouldn't land as it is. Whether a root-started update should drop back to the invoking user or refuse is the maintainer's choice. Separately, quattro's AGENTS.md (Runtime Environment) says commands must not re-export or default OMARCHY_PATH themselves, and that covers both defaults here, including the one in bin/omarchy-update-dev:7.

mise up --yes trusts whatever directory the update was started from. omarchy-update keeps the caller's working directory through script and the update lock. I checked on the worker: in a directory whose untrusted mise.toml sets _.source = "./payload.sh", plain mise up refuses (or, under a pty the way omarchy-update runs it, waits at the trust prompt). mise up --yes silently trusts that directory, records it as trusted, and runs the payload. Because omarchy-update-mise runs before end_update_authorization, that code runs while the update's sudo keepalive is still refreshing, on the same terminal. So omarchy update -y started inside a cloned repository could hand the repository's code a live sudo timestamp. The -y hang is real, but it only happens when the update is started in a directory with an untrusted mise config. Running mise up from home, I saw no prompt. The fix needs to avoid trusting that directory, for example by skipping mise with a message when the update is unattended, or by running it from a neutral directory.

Nothing was pushed to this branch, because both fixes are design choices rather than contained defects. Codex reached the same two findings and the same reading of the source-root guard; its independence from this review is not guaranteed. It also pointed out the AGENTS.md rule, which I then checked against quattro. Next step: the maintainer decides how a root-started update should behave. After that, the mise change can be reworked to match.

@Bartok9

Bartok9 commented Oct 16, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @omarchybot — both findings match what we already flagged, and I agree this should not merge as written.

Entry-point default. The worker check is right: on quattro, an unset OMARCHY_PATH already stops at omarchy_security_require_source_root before omarchy-update-dev runs. The default at bin/omarchy-update does not fix a crash through omarchy update; it lets a root-started update (pkexec / sudo env reset) pass the guard and continue as root, which is #13329. The AGENTS.md rule against commands defaulting OMARCHY_PATH covers both defaults, including the helper one. I still won't pick drop-back-to-invoking-user vs refuse-and-tell-the-caller-to-run-without-sudo, and I won't push either onto this branch without a maintainer choosing.

mise up --yes. Agreed this is not a safe way to clear the -y hang. --yes trusts the caller's working directory, and omarchy-update keeps that cwd through script and the update lock, so an untrusted mise.toml can run while the sudo keepalive is still refreshing. The hang only shows up when the update starts in a directory with an untrusted mise config; from home there is no prompt. When this is reworked, mise should not trust that directory — skip with a message when unattended, or run from a neutral directory. I won't land mise up --yes as the fix.

Nothing further from me until a maintainer decides how a root-started update should behave. After that I can rework the mise change to match, without defaulting OMARCHY_PATH in the commands.

pkexec and other scrubbed environments leave OMARCHY_PATH unset, so
omarchy-update-dev aborts under set -u before any packages are touched.
Use the same packaged-install default as omarchy-migrate.

omarchy update -y still hung on mise's config-trust prompt. Honor
OMARCHY_UPDATE_UNATTENDED with mise up --yes so the promise not to ask
holds after pacman and migrations.

Fixes omacom#14325
pkexec strips the login environment, and omarchy_security_require_source_root
runs in omarchy-update before omarchy-update-dev. Defaulting the path only in
the helper left `pkexec omarchy-update -y` exiting with "OMARCHY_PATH does not
match this Omarchy command." Set the packaged default at the entry point; the
existing check still rejects any other value.
@Bartok9
Bartok9 force-pushed the bartok9/update-pkexec-omarchy-path-mise-yes branch from 57621d6 to 3e64f75 Compare October 25, 2026 21:26
Comment on lines +121 to +124
default_line=$(grep -n 'export OMARCHY_PATH="${OMARCHY_PATH:-/usr/share/omarchy}"' "$ROOT/bin/omarchy-update" | head -1 | cut -d: -f1)
check_line=$(grep -n 'omarchy_security_require_source_root' "$ROOT/bin/omarchy-update" | head -1 | cut -d: -f1)
[[ -n $default_line && -n $check_line && $default_line -lt $check_line ]] ||
fail "update entry point defaults OMARCHY_PATH before the source-root check"

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 Test only checks source text

The new assertion greps for the exact assignment instead of running omarchy-update with OMARCHY_PATH unset. It can pass even if the entry point still fails. AGENTS.md explicitly forbids tests that restate source edits. Before merging, replace this check with a test that exercises the entry point and checks its behavior.

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!


set -euo pipefail

source "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)/base-test.sh"

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 Update tests are unnecessarily split

This adds a separate test file even though update-sequence-test.sh already covers omarchy-update-mise. AGENTS.md requires extending the area's existing tests rather than adding another *-test.sh. Before merging, move these argument checks into the existing update tests.

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!

# has to be established here or the check exits before the helper runs.
default_line=$(grep -n 'export OMARCHY_PATH="${OMARCHY_PATH:-/usr/share/omarchy}"' "$ROOT/bin/omarchy-update" | head -1 | cut -d: -f1)
check_line=$(grep -n 'omarchy_security_require_source_root' "$ROOT/bin/omarchy-update" | head -1 | cut -d: -f1)
[[ -n $default_line && -n $check_line && $default_line -lt $check_line ]] ||

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 Numeric comparison breaks required style

The new condition uses -lt inside [[ ]]. AGENTS.md requires numeric comparisons to use (( )). If this assertion is retained, move the comparison of default_line and check_line into an arithmetic condition before merging.

Suggested change
[[ -n $default_line && -n $check_line && $default_line -lt $check_line ]] ||
[[ -n $default_line && -n $check_line ]] && (( default_line < check_line )) ||

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

Copy link
Copy Markdown
Collaborator

Looked at this again at 3e64f75 against quattro at 5fa15f2. The new head is a rebase of 57621d6 with the same content, but quattro has changed underneath it, and this pull request now conflicts in bin/omarchy-update and test/shell.d/update-dev-test.sh.

What changed on quattro. #17000 (56a910b) removed omarchy_security_require_source_root from bin/omarchy-update. That changes two things from my last comment:

  • With OMARCHY_PATH unset, omarchy update no longer stops at the guard. It now runs through the prune and the snapshot and then crashes in omarchy-update-dev with OMARCHY_PATH: unbound variable, so the crash in omarchy update fails under pkexec/agent-driven runs: OMARCHY_PATH unbound, then -y blocks on an interactive mise prompt #14325 and Omarchy 'omarchy update' #8239 can be hit again on quattro.
  • The default at bin/omarchy-update:22 was there to get past that guard, which is gone. It no longer does anything, and it is where the conflict is. The test at test/shell.d/update-dev-test.sh:118-126 looks for omarchy_security_require_source_root in bin/omarchy-update, so it fails once this is rebased. It also greps the source, which the testing section of quattro's AGENTS.md asks tests not to do.

#8590 makes the same omarchy-update-dev fix and is older. It defaults the variable at the same point in bin/omarchy-update-dev and tests the unset case in the same file. Neither fix misses a case the other covers. When fixes are this close, the older one is the one recommended, so this one isn't. Nothing else here is worth carrying over to #8590. The mise up --yes problem from my last comment still applies at this head: omarchy-update keeps the caller's working directory, and it runs omarchy-update-mise while sudo is still authorized. So --yes would trust and run an untrusted mise.toml from wherever the update was started. #12796 and #12860 also default the variable in omarchy-update-dev.

Nothing was run for this pass. The code is unchanged since the worker run at 57621d6, and these findings come from reading the code against quattro. Codex Medium and muse-wonder via pi (high) each compared the four pull requests. Both picked #8590, found nothing here worth carrying over, and pointed to the same two problems: the --yes trust and the test that breaks after the rebase. I checked both against quattro. They agreed with conclusions I had already reached, and their independence from this review is not guaranteed. This now waits on the maintainer: whether #8590 lands, and how a root-started update should behave (#11479, #13329).

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.

omarchy update fails under pkexec/agent-driven runs: OMARCHY_PATH unbound, then -y blocks on an interactive mise prompt

4 participants