omarchy icon indicating copy to clipboard operation
omarchy copied to clipboard

omarchy-update hangs at migration 1787481315 when brave-origin is the daily browser (theme-set-browser blocks on brave that never exits)

Open sivaxreddy opened this issue 3 months ago • 3 comments

What happened

omarchy update froze for over an hour right after the pacman phase, stuck at:

Running migration (1787481315)
Re-stage the current theme so an installed theme's code is dropped

Process tree showed the cause:

omarchy-migrate
└─ migrations/1787481315.sh
   └─ omarchy-theme-refresh
      └─ omarchy-theme-set eldritch
         └─ omarchy-theme-set-browser
            └─ /opt/brave-bin/brave --refresh-platform-policy --no-startup-window
               └─ full resident session: zygotes, gpu, network service, renderers — zero windows

refresh_running_browser brave brave in omarchy-theme-set-browser launched brave --refresh-platform-policy --no-startup-window, which never returned, blocking the migration and the entire update.

I daily-drive brave-origin (brave-origin-bin), so this stray plain-brave instance had no visible windows and the update just looked dead.

Expected

The refresh invocation should signal a running instance and exit promptly; the update should not hang on it indefinitely.

Workaround

Killing the spawned brave PID let the migration finish instantly and the update completed normally. No data lost (the stray process had no windows).

Steps to reproduce

  1. Have both brave-bin and brave-origin-bin installed; use brave-origin as the running browser.
  2. Run omarchy update.
  3. Update hangs at migration 1787481315 while omarchy-theme-set-browser waits on the never-exiting brave --refresh-platform-policy --no-startup-window child.

Suggested fix

Bound the call, e.g. timeout 10 "" --refresh-platform-policy --no-startup-window, or ensure flags that force exit after the policy handoff.

System

  • Omarchy 4.0.1-1
  • kernel 7.1.9-arch1-2
  • brave-bin 1:1.93.138-1, brave-origin-bin 1:1.93.138-1

sivaxreddy avatar Aug 25 '26 14:08 sivaxreddy

Confirmed the same unbounded browser-refresh wait on Omarchy 4.0.2-1, but with Chromium and migration 1787515927 ("Stop world-writable Chromium and Firefox policy directories").

The migration began at 23:46:54; omarchy-theme-set-browser launched a transient Chromium process at 23:46:55, which did not exit until 23:48:03 (68 seconds). The migration completion marker was written immediately afterward, and all subsequent migrations completed.

The policy hardening itself took under a second. The delay came from the synchronous chromium --refresh-platform-policy --no-startup-window invocation. This supports bounding every browser refresh with a timeout or omitting live refresh during migrations, since the policy applies on the next browser launch.

Filed by gpt-5.6-terra via OpenCode.

Domingocs avatar Aug 31 '26 04:08 Domingocs

Confirmed still present on current quattro. refresh_running_browser in bin/omarchy-theme-set-browser runs

"$command" --refresh-platform-policy --no-startup-window &>/dev/null

in the foreground with nothing bounding it, so a browser that doesn't return holds up theme-set, the migration that called it, and the update.

Two things worth adding from digging into the fix. First, @Domingocs's Chromium case matters more than it looks: that was a correctly detected running browser taking 68 seconds, so this isn't only the brave/brave-origin detection mix-up — #8258 fixes that detection and this would still hang. Second, a plain timeout 10 isn't enough. If the browser ignores SIGTERM, timeout waits for it anyway:

timeout 2s      <TERM-ignoring child>   -> returned after 20s (the child's own lifetime)
timeout -k 1s 2s <same child>           -> returned after 3s

So the bound needs a kill fallback to actually be a bound. Plain timeout does clean up the process tree when the child cooperates — I checked, the parent and both children died — it just can't help when it doesn't.

I'll send a scoped fix with hermetic coverage for the hanging-browser case.

VykosMolt avatar Aug 31 '26 18:08 VykosMolt

Automated duplication check: this issue looks similar to #8158, which covers the same theme-set-browser hangs on brave-origin false-positive. I keep that one open and close this one to keep the discussion in one place.

If you feel this is the wrong decision, please open the issue again with a note on the difference.

bjarneo avatar Sep 21 '26 09:09 bjarneo