Repository navigation
Conversation
Channel switching still prompted for sudo on every privileged step after omacom#13323 taught omarchy update to ask once. Establish one authorization up front, share it with refresh-pacman and the package swap (including the pre-refresh hook), then revoke before handing off so the update asks once for its own phases. Fixes omacom#13415 Co-authored-by: AnPod <AnPod@users.noreply.github.com>
Automated AI review
Verified: at b19dfb1, a channel switch asks for one authorization for the switch itself and then hands off to the update's own single authorization. The keepalive refreshes the ticket through long pacman transactions and is stopped before the ticket is revoked at the hand-off. HUP, INT, TERM, step failures, a refused password and Prompts per switch, from a mock sudo modelled on sudo 1.9.17p2 source (default sudoers, a hook that does not call sudo, no AUR updates):
The dev counts assume the Four points follow: an existing test that now fails, a relaxed hook boundary that the docs still describe as cold, a session flag that also applies inside
|
| Nested refresh from a post-update hook (mock model) | 3faafba | b19dfb1 |
|---|---|---|
sudo -k during the refresh |
4 | 0 |
Ticket at its pre-refresh-pacman hook |
none | live |
| Ticket after the refresh returns | revoked | live |
Impact: this contradicts docs/update-process.md:156 ("Standalone commands that keep their own cold boundary, such as omarchy-refresh-pacman, still revoke if a post-update hook calls them"). The flag is also an ordinary inherited variable. These entrypoints strip shell-startup variables such as BASH_ENV and exported functions, but not this one. omarchy-update-stay-awake already honours it, but there it guards no user code. A standalone run with the variable set and an existing ticket issues no sudo -k at all. Setting it already requires running as the user, so this part is low severity.
Suggested change: use a channel-specific variable passed only on the refresh call from omarchy-channel-set, instead of exporting the update's flag for the whole switch. That fixes the overlap with omarchy update; any caller could still set a channel-only variable, which is the low-severity part above. Alternatively, keep the shared flag and update docs/update-process.md:156. channel_sudo_session (bin/omarchy-refresh-pacman:23,25) is set but never read.
Dev path asks for the password before cloning and validating the checkout
authorize_channel (bin/omarchy-channel-set:172) now runs before link_dev_checkout, which clones ~/omarchy if needed and then checks the required files. In the mock run with a stale checkout, b19dfb1 prompts for the password and then fails with "Update the checkout before switching to dev…". 3faafba rejected it with no prompt. The existing test "a stale dev checkout is rejected before linking or privileged work" still passes, because its check looks for sudo -N calls and dev-link/state steps, not the direct sudo /usr/bin/true. A fresh git clone also now runs while the ticket is live. Git runs a post-checkout hook after a clone, which can come from the user's template directory or core.hooksPath; this was taken from git's documentation and not executed.
Impact: a user with an outdated ~/omarchy enters a password for a switch that is then rejected, and the existing stale-checkout test does not detect the new prompt. On a fresh clone, any post-checkout hook from the user's git configuration runs while the ticket is live.
Suggested change: clone and validate the checkout first (no sudo needed), then call authorize_channel just before omarchy-dev-link.
Optional test improvement: these mutants still pass all 19 checks in channel-sudo-boundary-test.sh:
- Removing
end_channel_authorization || exit 1before the hand-off still passes. The "revokes before the update starts" assertion is satisfied byomarchy-update's own entrysudo -k(bin/omarchy-update:28), which is logged beforestep:omarchy-update-lock. - Removing
trap cleanup_channel EXIT, or the kill and wait inend_channel_authorization, also passes. Nothing observes the keepalive, whose 60 s sleep never elapses in a test run.
The HUP/INT/TERM and failure blocks the PR body lists are unchanged from 3faafba. They now run through cleanup_channel but still check only the end state (no ticket, a final revocation, post-update not reached), not the keepalive.
Coordination: open #13444 changes the same omarchy-update -y hand-off line that this PR inserts the revocation above. Whichever merges second needs a small manual resolution that keeps both changes.
Review information
Test scope: source review of b19dfb1 against quattro 3faafba, plus sandboxed runs of the seven repository shell test files that exercise the changed scripts and of diagnostic scenarios on both revisions. Sudo was always a mock: the repository's own in its tests, and one modelled on sudo 1.9.17p2 source (check.c, timestamp.c, parse_args.c) in the diagnostic runs. No real sudo, pacman or channel switch ran. Prompt counts assume default sudoers (tty tickets). With timestamp_type=ppid or timestamp_timeout=0, the shared ticket may not reach child sudo calls; this was inferred from source and not tested. Merge conflicts with other open PRs were checked by text merge only.
AI process: Opus 5.5 Medium coordination and synthesis, Opus 5.5 Xhigh technical review and final fact check, GPT 6 Sol Xhigh search for related issues, Opus 5.5 Medium editorial check.
Opt out: To stop receiving these reviews, reply to this comment saying so.
Summary
Channel switching still prompted for sudo on every privileged step after #13323 taught
omarchy updateto ask once (#13415).This change:
bin/omarchy-channel-set.bin/omarchy-refresh-pacmanand the package swap (includingpre-refresh-pacmanhook).test/shell.d/channel-sudo-boundary-test.shverifying single authorization, signal traps (HUP/INT/TERM), and failure handling.Fixes #13415