Skip to content

Keep speakersafetyd retrying after 96 kHz panics and toast if amps stay locked - #12977

Closed
ijt wants to merge 1 commit into
omacom:quattrofrom
ijt:fix/speakersafetyd-silent-mute
Closed

ijt wants to merge 1 commit into
omacom:quattrofrom
ijt:fix/speakersafetyd-silent-mute

Conversation

@ijt

@ijt ijt commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

Fixes #12976.

A screen recording that opens the Asahi speaker path at 96 kHz panics speakersafetyd on bad ivsense. Stock StartLimitBurst=10 / 60s then leaves the unit in start-limit-hit. macaudio clamps the amps (Speaker Volume Unlock=0) while PipeWire still reports 100% unmuted, so YouTube/X go silent with no UI cue.

This does not fix the 96 kHz trigger (see #10970 / #11092 for the file sample rate). It stops the desktop from staying muted after the capture client is gone, and it toasts if the lock lasts ~20s.

  • Drop-in disables the start limit and waits 5s between restarts. Copied only when speakersafetyd.service is installed (install + migration), so x86 images do not grow a unit directory they will never load.
  • User watcher (inert without /usr/bin/speakersafetyd and a Wayland display) toasts once while Speaker Volume Unlock stays at 0. It never writes mixer controls.
  • Migration also reset-failed + starts the daemon when it is already dead on an existing install.

Related: #10970, #10858.

…ay locked

A screen recording that opens the Asahi speaker path at 96 kHz panics
speakersafetyd on bad ivsense. Stock StartLimitBurst=10/60s then leaves
the daemon dead and the kernel clamps the amps, while PipeWire still
shows 100%. Disable the start limit, copy the drop-in on Asahi, and
toast once when Speaker Volume Unlock stays at 0.
@llstrk

llstrk commented Sep 23, 2026

Copy link
Copy Markdown

Two conditional paths can prevent the promised speaker-lock warning at 9d07e446f846.

Offline migration leaves the watcher outside the unit search path

The failed-enable fallback creates only a graphical-session.target.wants/ symlink to the unit under $OMARCHY_PATH/default/systemd/user/. That directory is outside systemd's normal user-unit search path. A successful systemctl --user enable /absolute/path also creates the top-level unit link; this fallback does not.

Source-derived path, not a live systemd reproduction:

Update without a reachable user manager
  -> enable fails
  -> .wants link created, but no loadable top-level unit
Next graphical login
  -> target wants the watcher by name, but cannot find its unit

Impact: On an existing install taking this fallback, the watcher does not start unless the unit is separately installed in a search directory. The migration can still finish, leaving no speaker-lock warning. The system-service restart override is independent of this issue.

Suggested change: Also create the top-level linked unit in the user unit directory, checking both link operations, or package the service under /usr/lib/systemd/user and enable it by name.

Failed notification readiness consumes the only warning

announce_lock returns success when omarchy-notification-wait times out. The caller then unconditionally sets notified=1.

Two locked polls -> readiness times out -> notified=1, no toast
Lock persists    -> notification server returns -> no retry

Impact: A delayed notification server at startup or during a shell restart can suppress the warning for the entire continuous lock episode. A synthetic locked-state sequence confirmed one readiness attempt and no send or later retry; the server-recovery consequence follows from the unchanged notified state.

Suggested change: Return failure when readiness or sending fails, and set notified=1 only after successful delivery. Handle failure conditionally so the watcher continues polling rather than exiting under set -e.

Verified: The watcher only reads mixer controls. With synthetic lock and notification responses, it warns once for a sustained lock, suppresses alternating locked/unlocked observations, and warns again after unlock/relock. The focused PR shell test passed. Source inspection confirms the drop-in disables the start limit and sets five-second restart spacing.


Review information

Test scope: Pinned-source review and isolated shell tests with stubbed audio, timing and notification calls. No native Asahi hardware, 96 kHz crash/recovery, live systemd activation or real notification delivery was tested. Offline unit resolution is source/documentation-derived.

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

Automated AI review: Astra Medium initial inspection and synthesis, independent Opus 5.5 High and GPT 6 Sol Xhigh technical reviews, and a fresh Astra Medium editorial check. Public claims were checked against source and retained targeted evidence.

@omarchybot omarchybot added the enhancement New feature or request label Oct 3, 2026
@jandrusk

jandrusk commented Oct 8, 2026

Copy link
Copy Markdown

Thanks for separating this from #10970 and #10858. Two things still look like they need fixing at 9d07e446, the head @llstrk reviewed. Both are still there:

1. The watcher unit is enabled from $OMARCHY_PATH, not the packaged path (BLOCKING). All the other user units are enabled by name: first-run enable-user-units.sh does it that way, and the offline fallback in migrations/1786539345.sh symlinks /usr/lib/systemd/user/omarchy-crash-watch.service. This PR instead enables $OMARCHY_PATH/default/systemd/user/omarchy-speakersafetyd-watch.service by absolute path. In the migration's fallback it only writes a .wants link to a directory that isn't on the user unit search path, so after an update from a TTY the watcher never loads. Following the crash-watch pattern fixes both places:

# install/user/first-run/enable-user-units.sh
  omarchy-crash-watch.service \
  omarchy-speakersafetyd-watch.service

# migrations/1790123774.sh
if ! systemctl --user enable omarchy-speakersafetyd-watch.service >/dev/null 2>&1; then
  wants_dir="$HOME/.config/systemd/user/graphical-session.target.wants"
  mkdir -p "$wants_dir"
  ln -sfn /usr/lib/systemd/user/omarchy-speakersafetyd-watch.service \
    "$wants_dir/omarchy-speakersafetyd-watch.service"
fi

2. A notification-wait timeout uses up the only warning. announce_lock returns 0 when omarchy-notification-wait fails, and the loop then sets notified=1, so a shell that's slow to come up suppresses the toast for the whole lock episode:

announce_lock() {
  omarchy-notification-wait || return 1
  omarchy-notification-send ... || return 1
}
...
    if ((locked_streak >= 2 && notified == 0)) && announce_lock; then
      notified=1
    fi

I checked the migration name 1790123774.sh against every open PR and quattro, and nothing else uses it.

@omarchybot

Copy link
Copy Markdown
Collaborator

Closing as out of scope: Omarchy now supports only installs made from the official Omarchy ISO, and this change exists for Apple Silicon, which the ISO doesn't produce. We aren't taking on code paths for setups outside that, because nobody here can test or maintain them. The community-maintained omarchy-mac project is the place for Apple Silicon work. Thanks for the work that went into this. (Checked by Claude Opus 5.5; no second review.)

@omarchybot omarchybot closed this Oct 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Apple Silicon: speakersafetyd start-limit leaves speakers locked with volume UI at 100%

4 participants