Skip to content

Default OMARCHY_PATH in update-dev and channel-current - #12860

Open
anandude wants to merge 2 commits into
omacom:quattrofrom
anandude:fix-unbound-omarchy-path
Open

anandude wants to merge 2 commits into
omacom:quattrofrom
anandude:fix-unbound-omarchy-path

Conversation

@anandude

@anandude anandude commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Reported as #12858, which was closed as a duplicate of #8239. This does not resolve
#8239 — omarchy update with OMARCHY_PATH unset still stops at the entry check —
so it references the report rather than closing it.

Problem

omarchy update aborts from stripped environments (sudo, cron/timer, non-bash shells) with omarchy-update-dev: line 7: OMARCHY_PATH: unbound variable. The script runs under set -euo pipefail and compares the bare variable, with no fallback to the packaged default.

Change

  • bin/omarchy-update-dev: [[ ${OMARCHY_PATH:-/usr/share/omarchy} != ... ]], matching the issue's suggested fix and the env-bootstrap precedent — unset means package-backed, so it exits 0 before touching git.
  • bin/omarchy-channel-current: same one-line shape at line 10, same crash under env -i (verified before the fix). Included since it is the identical defect in the neighboring command rather than a separate issue.
  • test/shell.d/update-dev-test.sh, test/shell.d/channel-test.sh: env -i regression tests asserting clean exit, no git invocation (update-dev), correct channel resolution, and no "unbound variable" output.

Verification

  • Both new tests fail against the pre-fix scripts and pass with the fix
  • ./test/all: CLI suite fully green; shell suite shows only the 5 pre-existing environment failures (missing omarchy-pkgs checkout, omasnap, Qt portal) — confirmed identical on the clean tree

@llstrk

llstrk commented Sep 22, 2026

Copy link
Copy Markdown

Verified: At 58a9479a91a8, both changed helpers handle an unset OMARCHY_PATH without the original nounset abort. Their new regression cases fail against the baseline and pass against the PR. No regression was found in the changed production code; the same unset-variable issue remains in a later update helper.

Unset OMARCHY_PATH Baseline PR
omarchy-update-dev Unbound-variable error Exit 0, no Git call
omarchy-channel-current Unbound-variable error Resolves the supplied package channel

Remaining pre-existing nounset failure in update-status

omarchy-update-available:9 still compares bare $OMARCHY_PATH under set -u. Running that helper with the variable absent still exits 1 with OMARCHY_PATH: unbound variable.

Inspected update call chain, if execution reaches status:
omarchy-update
  -> omarchy-update-status
     -> omarchy-update-available: nounset error, exit 1
     -> selects the shell's "clear" branch, not "refresh"

Impact: The missing environment variable is treated like “no updates available” without checking updates. This is a pre-existing, non-fatal condition failure, not a regression introduced by the PR. The helper failure and branch selection were reproduced; the full update and actual shell indicator were not exercised.

Suggested change: Apply the same ${OMARCHY_PATH:-/usr/share/omarchy} fallback to this helper's initial comparison.

Optional test improvement: In test/shell.d/update-dev-test.sh:64, forward TEST_GIT_LOG="$git_log" through env -i. Without it, a diagnostic Git call added only to the unset-path branch still passes the “invokes no git” assertion because the stub loses its log destination. Supplying the logger makes that diagnostic case fail while the unmodified helper still passes. This is test-only; the PR helper itself made no Git call.


Review information

Test scope: Targeted shell tests and baseline/head helper execution with synthetic Git, package and channel dependencies, including explicit package/dev paths. No real sudo/cron invocation, package upgrade, Git remote, desktop indicator, full update or full test suite was exercised.

Community review: Independent automated community review, unaffiliated with the Omarchy team, intended to help prepare PRs for their review.

Automated AI review: Astra initial source inspection, independent Fable 5.1 High and Astra Xhigh technical reviews, followed by Astra synthesis against source and targeted execution evidence.

@anandude

Copy link
Copy Markdown
Contributor Author

Both done in 4a00459. omarchy-update-available got the same fallback plus a regression test, and the env -i call in update-dev-test now forwards TEST_GIT_LOG so a git call on that path cannot hide from the assertion.

@llstrk

llstrk commented Sep 23, 2026

Copy link
Copy Markdown

Verified by source inspection: Both points from the earlier review are addressed at 4a004591c492. No new issue was found in this scoped reassessment.

Prior point Resolution in the inspected revision
Pre-existing nounset failure in omarchy-update-available The initial comparison now uses ${OMARCHY_PATH:-/usr/share/omarchy}. An unset variable skips the Git branch and reaches the package check.
Test-only loss of the Git logger in update-dev-test.sh The stripped-environment invocation now forwards TEST_GIT_LOG, connecting the Git stub to the file checked by the no-Git assertion.

The added update-available regression case checks the unset-variable, no-package-updates outcome. That outcome correctly uses exit 1 with the up-to-date message, rather than treating every nonzero exit as a nounset failure.


Review information

Test scope: Conclusions are based on pinned source and test-code inspection, not runtime validation. This follow-up does not establish full updater behavior, real package or Git operations, sudo/cron execution, or the desktop update indicator.

Community review: Independent automated community review, unaffiliated with the Omarchy team, intended to help prepare PRs for their review.

Automated AI review: Astra initial inspection, independent Opus 5.5 High and GPT 6 Sol Xhigh technical reviews, followed by Astra synthesis against the pinned source.

@omarchybot

Copy link
Copy Markdown
Collaborator

I reviewed this at 4a00459, merged onto current quattro (821ae58), on a disposable Omarchy worker. The code does what it says. But the path the description gives, omarchy update from an environment without OMARCHY_PATH, no longer reaches these scripts on quattro, and the change goes against a rule in quattro's AGENTS.md. So whether it should land is the maintainer's call.

What ran on the worker

  • With OMARCHY_PATH removed from the environment, omarchy-update-dev, omarchy-channel-current and omarchy-update-available from quattro each exit 1 with OMARCHY_PATH: unbound variable (lines 7, 10 and 9). With this change, omarchy-update-dev exits 0 without calling git and omarchy-channel-current answers stable.
  • The three new test cases pass with the change (update-dev-test.sh 6/6, channel-test.sh 33/33, update-available-test.sh 9/9). With only the three one-line fixes reverted, each one fails with the unbound-variable error, so none of them passes vacuously.
  • ./test/cli has one failure, vscode generated theme references current theme file. It fails the same way with the fixes reverted, so it is not from this change.
  • I read the rest of all three scripts. Every later $OMARCHY_PATH read sits behind the defaulted comparison, so an unset or empty value never reaches one.

Why it no longer fixes #12858 on quattro

bin/omarchy-update:19 now calls omarchy_security_require_source_root (bin/omarchy-security-functions:47) before anything else, and that check refuses an unset OMARCHY_PATH. On the worker, env -u OMARCHY_PATH bin/omarchy-update -y stops with OMARCHY_PATH does not match this Omarchy command. and exit 1, with or without this change. It never gets as far as omarchy-update-dev at line 121 or omarchy-update-status. That includes the non-login zsh case from the issue thread. That case now fails at the entry check with that message, not partway through the update. Merging this would close #12858 even though omarchy update from such a shell still does not run.

The other callers all run with OMARCHY_PATH set. Those are the channel items in the menu (default/omarchy/omarchy-menu.jsonc:367-370), the bar's update widget (shell/plugins/bar/widgets/SystemUpdate.qml:41), and omarchy-upgrade-to-quattro, which goes through run_as_user_omarchy. What is left is calling these helpers by hand from a shell that never loaded Omarchy's environment.

For the maintainer

Who checked it: Claude Opus 5.5. No second opinion: the configured reviewer, Codex Medium, answered the availability check, but omabot's daily review allowance was used up, so no second model checked this review. No verified or ready label. This is waiting on the maintainer to decide whether bin/ should default OMARCHY_PATH at all. If not, this and its siblings can be closed.

@anandude

Copy link
Copy Markdown
Contributor Author

I think this needs a rule decision before it needs more review, so I'd rather ask than keep it in the queue as "verified, waiting".

The change does what it says. With OMARCHY_PATH unset, omarchy-update-dev, omarchy-channel-current and omarchy-update-available all follow the stable/checkout default instead of aborting on nounset, and each new test case fails against the baseline with only the one-line fix reverted. The rest of each script reads $OMARCHY_PATH only behind that defaulted comparison.

But it no longer fixes #12858 on quattro. bin/omarchy-update:19 calls omarchy_security_require_source_root before anything else, and that refuses an unset OMARCHY_PATH (OMARCHY_PATH does not match this Omarchy command., exit 1), so omarchy update from a shell that never loaded Omarchy's environment now fails at the entry check regardless of this PR. The only callers that reach these helpers are the channel menu items, the bar's update widget and omarchy-upgrade-to-quattro, all of which run with OMARCHY_PATH set. What's left is calling the helpers by hand from a bare shell.

And it cuts against a stated rule. AGENTS.md:64 says bin/ commands should rely on $OMARCHY_PATH and not default it manually; 4ab3377 removed a fallback of exactly this kind from omarchy-channel-current.

The question: should bin/ default OMARCHY_PATH when it is unset, or is the entry check the intended answer everywhere?

Either answer settles five PRs that currently depend on it: this one, #8590 (omarchy-update-dev), #8771 (omarchy-update-available), #9164 (omarchy-channel-current, omarchy-audio-tuning) and #12796 (both update helpers plus sudo handling). I'm happy to close this and the siblings to whichever one the maintainer prefers, or to rework it to fit whatever the rule turns out to be — but I don't think any of them should be merged while the answer is open.

@omarchybot

Copy link
Copy Markdown
Collaborator

Re-checked at 4a00459, merged onto current quattro (087f73d), on a disposable Omarchy worker. Nothing in this pull request changed since my last comment. Three things around it did, and this time a second model reviewed it.

Same result on current quattro. With OMARCHY_PATH unset, the three helpers on quattro still abort with unbound variable (lines 7, 10 and 9). With this change they exit cleanly. The three new tests pass (update-dev-test.sh 7/7, channel-test.sh 33/33, update-available-test.sh 9/9) and each fails with only the one-line fixes reverted. ./test/cli passes. env -u OMARCHY_PATH bin/omarchy-update -y still stops at the entry check with OMARCHY_PATH does not match this Omarchy command., so the update path from #12858 still does not reach these helpers.

What is new

Second opinion: Codex Medium reviewed the merged tree and found no defect in the three guards. It agreed that no shipped caller reaches them with OMARCHY_PATH unset, and that the change conflicts with AGENTS.md:65. This review is not guaranteed independent of mine. It pointed out the omarchy-refresh-pacman caller above. It also noted that an explicitly empty OMARCHY_PATH now counts as package-backed rather than a dev checkout. It found no case where that matters.

This still waits on the maintainer's answer to the question above: should bin/ default OMARCHY_PATH at all? That answer settles this pull request, #8590, #8771, #9164, #12796 and #14337 together. No verified or ready label.

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.

3 participants