Skip to content

Launch-feedback OSD: serial-tag the close so it wins the show/close race - #16883

Open
AnPod wants to merge 1 commit into
omacom:quattrofrom
AnPod:launch-osd-serial-race
Open

AnPod wants to merge 1 commit into
omacom:quattrofrom
AnPod:launch-osd-serial-race

Conversation

@AnPod

@AnPod AnPod commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

Fixes #16808 (also reported as #16814)

Problem

The "Launching …" OSD can stay on screen forever. closeLaunchFeedback spawns omarchy-shell osd close as its own process, racing the omarchy-shell osd show '{duration: 0}' that the 2 s launch delay spawned. The two IPC calls have no arrival ordering: if close lands first, the OSD then opens with duration: 0, which calls hideTimer.stop() and can never auto-hide — and closeLaunchFeedback skips any further close IPC because it already cleared its state. Under system load, which is exactly when launch delays happen, the inversion is likely.

Fix

Serial-tag the launch OSD so the close wins regardless of arrival order:

  • AppLibrary.beginLaunchFeedback already bumps a per-shell launchSerial; the show payload now carries it (launch: <serial>).
  • New osd closeLaunch <serial> IPC handler records the highest closed serial and closes the OSD if the launch it is showing is that launch or older. closeLaunchFeedback calls it instead of osd close.
  • Osd.open drops a show whose launch serial is already closed, instead of opening a sticky duration-0 OSD. A launch-less show (volume, brightness, media — every other caller routes through the same open) clears the launch serial, so its closeLaunch can never take the replacement down.
  • Osd.close also records the launch it is showing, so a manual omarchy-shell osd close beats the in-flight show of that launch too.

The existing osd close handler and its argument count are unchanged, so all other callers keep working.

Test

Extended test/shell.d/osd-test.sh: extracts Osd.qml's open/close and the closeLaunch handler and runs them against a bare stand-in, covering close-before-show (dropped), show-then-close (closed), manual close beating an in-flight show, a generic OSD surviving an old launch's closeLaunch, and a newer launch still opening after a close. The new assertions fail on clean quattro (the handler does not exist) and pass with the fix; the pre-existing OsdModel assertions in the file are untouched.

closeLaunchFeedback spawns 'omarchy-shell osd close' as its own process,
racing the 'osd show' the 2s launch delay spawned. If close arrives
first, the OSD then opens with duration 0, which stops hideTimer and
never auto-hides, and no later close can take it down. Stamp each
launch's serial into the show payload and record the highest closed
serial in a new 'osd closeLaunch <serial>' handler, so a late show for
an already-closed launch is dropped however the two IPC calls arrive.

Fixes omacom#16808
@greptile-apps

greptile-apps Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues were found.

Summary

Tags launch feedback with a serial so a delayed show cannot reopen an already-closed launch.

  • Launch feedback closes cleanly even when its show arrives late.

No actionable issues found. Runtime and visual checks were not performed.

Diagram

sequenceDiagram
  participant App as AppLibrary
  participant OSD as Osd
  App->>OSD: closeLaunch(serial)
  OSD->>OSD: Record closed serial
  App->>OSD: Delayed show with same serial
  OSD->>OSD: Drop already-closed launch
Loading

Reviews (1) · Last reviewed commit: "Serial-tag the launch-feedback OSD so it..." · Reviewed by Greptile

@s-gato

s-gato commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

Confirmed independently on omarchy 4.5.0rc2-1 (quattro): launched Hermes (slow Electron first window) from the app grid, the "Launching Hermes…" OSD stayed up, and omarchy-shell osd state still reported open more than 8 minutes later. omarchy-shell osd close cleared it. That is the show/close inversion described here.

Verification of this PR:

  • Applies cleanly to current quattro (dff02d38).
  • test/shell.d/osd-test.sh passes, including all seven new assertions: close-before-show dropped, normal show/close, manual close beating a late show, a launch-less OSD surviving an old closeLaunch, and a newer serial still opening.
  • app-search-test.sh, shell-ipc-test.sh, and qml-text-format-test.sh also pass.

One residual, not blocking: closeLaunch still rides a detached omarchy-shell process. This fixes reordering, but if that process never reaches the shell, the OSD can still stick (the "close is lost" case in #12123). Driving show/close in-process, e.g. IpcRegistry.call("osd", ...) from AppLibrary.qml, would remove both failure modes.

@omarchybot omarchybot added the bug Something isn't working label Nov 3, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Thanks @AnPod. The race you describe is real. If osd close arrives before the delayed osd show '{duration: 0}', the OSD opens with no auto-hide and stays up. @s-gato reproduced that on 4.5.0rc2 above.

This is one of several open pull requests for the stuck "Launching…" OSD, so I compared them before running anything: #9819, #11568, #13095, #13536, #13606, #15475, #15962 and this one. Policy is that the oldest fix wins unless a newer one is clearly better. The oldest here, #9819 (opened 2026-09-02), already covers what this one does and more. It drops the detached omarchy-shell processes and drives the OSD in-process through shell.summon()/shell.hide(). That makes show and close ordered, and a close can no longer get lost. It also gives the toast a finite 13s duration as a backstop. It has already been reproduced and verified on a worker.

This PR handles close-before-show, but not a close that never arrives. closeLaunchFeedback() still sends one fire-and-forget omarchy-shell osd closeLaunch process (shell/services/AppLibrary.qml:192), and the show still uses duration: 0 (AppLibrary.qml:263). If that process times out, nothing retries, and the OSD sticks as before. That is the residual @s-gato pointed out, and the case reported in #12123. One smaller gap: Osd.close() records only a launch that is already showing. So a plain osd close that arrives before the first show of a launch does not stop that show from opening.

I reviewed the diff and the surrounding Osd.qml and AppLibrary.qml code at c75332b. I did not run it on a worker, because a fix that loses to an older competitor is not taken further. Codex Medium and muse-wonder (pi, thinking high) were each asked to choose among the competing PRs without being told my answer. Both picked #9819 and both found the lost-close gap above; their independence from my review is not guaranteed. Codex also noted one behaviour #9819 lacks: this PR keeps a volume or brightness OSD that replaced the launch toast on screen when the launch finishes. Base behaves the same way, so I've left that for the maintainer rather than folding it into #9819.

Choosing between these fixes is the maintainer's call, so this is now waiting on them.

@chessing234

Copy link
Copy Markdown
Contributor

your commit is in #21025. the show payload includes the launch serial, and close uses closeLaunch so a late show for a closed launch is dropped. osd-test.sh passed those cases here. the show is still the tracked process from #18453, with a finite duration. @dhh @omarchybot if 21025 lands, this can close as superseded.

@omarchybot

Copy link
Copy Markdown
Collaborator

I compared this diff with quattro at 80d88d53c8. The fix in #9819 now shows and dismisses launch feedback inside the shell, removing the detached IPC race reported in #16808. The overlay also expires after 13 seconds if its show is delivered late. #21025, which included the serial-tagged change, closed without merging. Merged fix #9819 · #21025

A volume or brightness overlay that replaces the launch toast can still be dismissed early when the launch finishes. This PR's serial check protects that replacement. That behavior is with the maintainer to decide whether to carry forward as a separate change.

GPT-6 High in Codex, Opus 5.5 High, and muse-wonder via pi at high effort checked the source. The reviewers agreed and their independence from my review is not guaranteed. This was a source-only review.

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.

Launch-feedback OSD can get stuck on screen forever ("Launching <app>…")

4 participants