Skip to content

End omarchy update when its terminal closes at a prompt (4.5) - #18933

Merged
ryanrhughes merged 1 commit into
v4-5-1from
backport/v4-5-1-update-hangup
Nov 14, 2026
Merged

ryanrhughes merged 1 commit into
v4-5-1from
backport/v4-5-1-update-hangup

Conversation

@ryanrhughes

Copy link
Copy Markdown
Collaborator

Backports #16045 to 4.5.1. It fixes #16044: if the terminal running omarchy update goes away while it's waiting at "Continue with update?", the updater and gum can stay alive for days and keep holding the update lock, so later updates report "An Omarchy update is already running." It has been reported several times on 4.x installs, including one that lasted almost seven days.

omarchy-update now runs itself inside script with ; exit $? after the command. That keeps a plain Bash with no signal traps as the terminal session's leader. When the terminal is lost, that shell exits and the kernel sends the hangup on to the prompt. Before, the updater was the leader, and its HUP/TERM traps waited on the prompt, which never got the hangup. omarchy-update-lock also records the PID that took the lock and prints it when a second update is turned away. That PID is only for diagnostics; flock still decides who holds the lock.

This is a cherry-pick of 9ac08836cf from #16045. All four files match that commit byte for byte, and the files it changes were identical on v4-5-1 and quattro before it. On this branch these pass: update-hangup, update-lock, update-user-path, update-sequence, update-hook-security and update-stay-awake-security.

Scope and risk

Only omarchy update runs and the update lock are affected. Closing the terminal during a package step now sends that step a hangup about a second after the terminal closes. On 4.5.1 it already got one about 2–3 seconds later, when script gives up on its child. The one new case is when script itself vanishes, which is the bug being fixed. script now always runs the command with Bash and passes the caller's SHELL through unchanged. A user whose login shell is zsh or fish no longer has ~/.zshenv or config.fish sourced into the update.

🤖 Generated with Claude Code

* End omarchy update when its terminal closes at a prompt

* Record the update lock acquiring PID for diagnostics

---------

Co-authored-by: Tobi Lutke <tobi@shopify.com>
(cherry picked from commit 9ac0883)
@ryanrhughes
ryanrhughes merged commit 8a3e629 into v4-5-1 Nov 14, 2026
2 checks passed
@ryanrhughes
ryanrhughes deleted the backport/v4-5-1-update-hangup branch November 14, 2026 18:43
@greptile-apps

greptile-apps Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The changes affect interrupted updates and diagnostics for the shared update lock.

The runtime changes appear sound, but the new tests must join the existing update suite before merging to satisfy the repository's rule.

Findings

  1. P2 Update tests are split ▶

Summary

This backport keeps a plain Bash shell above the updater so losing the terminal can end a waiting prompt and release its update lock.

  • Closing the update terminal now ends its waiting prompt.
  • A rejected update now shows the recorded PID of the lock holder.

No tests were executed during this review.

Acknowledgments: ryanrhughes explicitly describes the earlier hangup during package steps and the removal of zsh/fish startup-file loading as intentional. Neither is reported as a defect.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A["omarchy-update"] --> B["script with Bash"]
  B --> C["Plain Bash session leader"]
  C --> D["omarchy-update-lock"]
  D --> E["Updater and confirmation prompt"]
  F["Terminal closes or script disappears"] --> G["Plain Bash exits on hangup"]
  G --> H["Foreground prompt receives hangup"]
  H --> I["Prompt and updater exit"]
  I --> J["Update lock released"]
Loading

Reviews (1) · Last reviewed commit: "End omarchy update when its terminal clo..." · Reviewed by Greptile

Comment on lines +5 to +6
source "$(dirname "$0")/base-test.sh"
source "$SHELL_TEST_DIR/fixtures/sudo-boundary-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 split

This file adds a separate suite for omarchy-update, although test/shell.d/update-lock-test.sh already tests that command and its lock. AGENTS.md requires extending the area's existing test file rather than adding a new *-test.sh. Move these checks into the existing suite before merging, keeping the private terminal and process cleanup.

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!

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.

2 participants