Skip to content

Keep supervising the shell through a slow compositor resume - #11827

Open
devYRPauli wants to merge 8 commits into
omacom:quattrofrom
devYRPauli:fix/launch-shell-resume-budget
Open

devYRPauli wants to merge 8 commits into
omacom:quattrofrom
devYRPauli:fix/launch-shell-resume-budget

Conversation

@devYRPauli

@devYRPauli devYRPauli commented Sep 14, 2026 •

Copy link
Copy Markdown

Refs #11820.

compositor_alive allows three hyprctl queries and two 0.5s sleeps. When all three fail, the supervisor reads the session as tearing down, exits 0 and never relaunches the shell. When the shell that died held the ext-session-lock, the seat stays locked with no locker to authenticate against. A TTY or a reset is the only way back in.

The guard is right to exist. Relaunching into a session that is going away burns the attempt budget. What it lacks is a way to tell "not answering yet" from "gone".

Hyprland's IPC socket is that signal, and the repo already reads it that way. omarchy-upgrade-to-quattro:294 validates a signature by testing .socket.sock, and compositor_reachable in base-test.sh probes a socket before it trusts hyprctl. This change keeps the three fast queries. Then, while the socket is present, it polls up to 60 more times, 0.5s apart. Without a socket it gives up at once. A poll to a compositor that accepts the connection but does not answer takes up to 5s more, which is the hyprctl read timeout. So 30s is the wait when the compositor refuses the connection, not a bound for a stalled compositor.

The wait checks terminating before each poll. The supervisor also checks it after a successful probe, before consuming the restart budget or logging a relaunch, so teardown takes the clean-exit path. The give-up path writes a logger line, and a teardown does not write it. Neither existing message appears in the reporter's journal on any boot, which is why the failure reads as nothing happening at all.

This does not confirm the cause of #11820. With no outputs, hyprctl -j monitors still exits 0 with [], so an output blackout alone does not fail the guard. The change covers a compositor that keeps its socket but does not answer IPC. On the next occurrence, the new journal line, or its absence, shows whether that was the path.

Measured with the three shell test files that reach the launcher: launch-shell-test.sh, restart-shell-test.sh and compositor-guard-test.sh.

build ok not ok
8b4eae66 25 0
this branch 29 0

With the tests from this branch and the launcher from 8b4eae66, launch-shell-test.sh stops at:

not ok - a slow resume does not end supervision

Each added case fails against a mutant of the launcher:

mutant failing check
no terminating check in the wait a teardown during the wait ends supervision promptly, after 30s
no terminating check before the logger line a teardown during the wait is not logged as a compositor that stopped answering
compositor_socket_present checks only the signature a compositor that left no socket ends supervision

The socket fixture binds a real AF_UNIX socket the way compositor-guard-test.sh does. When the sandbox refuses the bind, the two cases that need it report # SKIP. ./test/cli reports the same one failure before and after, main help includes hardware group, which my macOS checkout produces on both sides.

Greptile identified a teardown race during a successful recovery probe and the short resume fixture. Fixed in 2c73dca. The new signal-on-success case fails on the previous head because it logs a relaunch. The resume fixture now rejects 62 queries before answering on the final recovery poll, exercising about 30 seconds of waiting. Its deadline is 45 seconds. A mutant reducing the recovery loop from 60 polls to 20 fails the slow-resume case. All three focused shell test files pass, 29 checks and no skips; Bash syntax and git diff --check also pass

compositor_alive gives Hyprland three queries and two 0.5s sleeps before it
reports the session gone. Resume from suspend holds the outputs down for
tens of seconds, so a live compositor reads as a dead session. The
supervisor stands down, the shell that held the ext-session-lock is never
relaunched, and the seat stays locked with no locker to authenticate
against.

Wait past those three queries while Hyprland's IPC socket is still there, and
log the give-up path so it shows in the journal.

Fixes omacom#11820

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
devYRPauli added a commit to devYRPauli/devYRPauli that referenced this pull request Sep 14, 2026
Open external pull requests: 39 -> 40. The new one is omacom/omarchy#11827,
which keeps the shell supervisor alive through a slow compositor resume.

Merged stays at 97 across the same 38 projects. Upstream issues stay at 16.
Closed unmerged stays at 37.

No table row moved. The table still covers 52 merges across 11 projects, so
the remainder stays at 45 across 27.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@omarchybot omarchybot added the bug Something isn't working label Sep 27, 2026
@llstrk

llstrk commented Sep 30, 2026

Copy link
Copy Markdown

Automated AI review

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

Outcome: The change is not shown to fix #11820, which Fixes would close.

Fixes #11820 is not established

On Hyprland 0.56.2, hyprctl -j monitors exits 0 with [] when there are no outputs, so a blackout alone does not trip compositor_alive. The base guard stands down on a connect failure or ~16 s of stalled IPC, and the issue's log of a resume the shell survived shows IPC events 3 s in. Impact: the issue would close on a hypothesis.

Suggested change: use Refs #11820 until the new journal line confirms this path.

Evidence (hyprctl probe, not a failing test)

Sources, Hyprland v0.56.2:

  • src/debug/HyprCtl.cpp:313-343: monitorsRequest builds [ + entries + ], so no monitors gives [].
  • hyprctl/src/main.cpp:201-281: with the signature set, exit 4 on connect failure, 5 on write failure, 6 on a read failure or the 5 s receive timeout, 7 on an error: reply; otherwise 0.
  • The issue's quickshell.hyprland.ipc: Got removal for monitor "FALLBACK" at 15:02:04 (from a resume the shell survived; the issue says that resume shows the same churn and 26 s gap) is logged when Quickshell 0.3.1 reads a monitorremoved event from .socket2.sock. Hyprland writes those events from the same event loop that serves .socket.sock.
  • When a lock client disconnects, Hyprland stays locked and draws its own lock-dead screen (src/render/Renderer.cpp:1676-1683), not the client's last frame. The issue reports the password box still visible.

Hypothesis, not reproduced: a shell that hung but did not exit would match the report too. In that case the launcher is still in wait, logs nothing, and this PR does not change the outcome. On the next occurrence, the new journal line (or its absence) and, from a TTY, pgrep -af 'quickshell|omarchy-launch-shell' would settle it. The PR still helps when Hyprland keeps its socket but stops serving IPC.

Probe of hyprctl answers:

Needs python3 and hyprctl (run here with hyprland 0.56.2-2). It uses a private XDG_RUNTIME_DIR and stand-in sockets, never the running session.

The first stand-in replies [], which is what Hyprland 0.56.2 sends for j/monitors when it has no monitors (monitorsRequest in src/debug/HyprCtl.cpp builds [ + entries + ]). Once the signature is set, hyprctl (request() in hyprctl/src/main.cpp) exits 0 unless the connect fails (4), the write fails (5), the read fails or times out after 5 s (6), or the reply starts with error: (7).

#!/bin/bash
# How `hyprctl -j monitors` answers for three compositor states, using a private
# runtime dir and stand-in sockets (never the running session).
# Needs python3 and hyprctl.
set -u
rt=$(mktemp -d)
sig=review_0_0
mkdir -p "$rt/hypr/$sig"
sock="$rt/hypr/$sig/.socket.sock"

ask() {
  local start end rc
  start=$(date +%s.%N)
  XDG_RUNTIME_DIR="$rt" HYPRLAND_INSTANCE_SIGNATURE="$sig" hyprctl -j monitors >"$rt/out" 2>&1
  rc=$?
  end=$(date +%s.%N)
  printf '%-40s exit %s after %.1fs: %s\n' "$1" "$rc" "$(awk -v a="$start" -v b="$end" 'BEGIN { print b - a }')" "$(tr '\n' ' ' <"$rt/out")"
}

serve() {  # $1 = answer: reply "[]" to one request; stall: listen, never accept
  rm -f "$sock" "$rt/ready"
  python3 -c '
import socket, sys, time
s = socket.socket(socket.AF_UNIX)
s.bind(sys.argv[1])
s.listen(10)
open(sys.argv[2], "w").write("ready")
if sys.argv[3] == "answer":
    c, _ = s.accept()
    c.recv(8192)
    c.sendall(b"[]")
    c.close()
else:
    time.sleep(60)
' "$sock" "$rt/ready" "$1" &
  server=$!
  until [[ -f $rt/ready ]]; do sleep 0.05; done
}

serve answer
ask "live compositor, every output gone:"
wait "$server"

serve stall
ask "live compositor, event loop stalled:"
kill "$server"; wait "$server" 2>/dev/null

rm -f "$sock"
python3 -c 'import socket, sys; socket.socket(socket.AF_UNIX).bind(sys.argv[1])' "$sock"
ask "crashed compositor, socket left behind:"

rm -rf "$rt"

Output:

live compositor, every output gone:      exit 0 after 0.0s: [] 
live compositor, event loop stalled:     exit 6 after 5.2s: Hyprland IPC didn't respond in time  Couldn't read (6) 
crashed compositor, socket left behind:  exit 4 after 0.0s: Couldn't connect to /tmp/tmp.H6OvQ7rYPI/hypr/review_0_0/.socket.sock. (4) 
exit 0

Launcher timing, base and head: see "Reproducer (launcher timing, base and head)" under More findings.

The slow-resume case skips silently

If the bind is refused, the slow-resume case is dropped without skip, so the quattro tip's ./test/shell does not report it. Impact: the regression check can vanish unnoticed.

Suggested change: after rebasing, add an else skip "<reason>" branch.

Reproducer (bind refused, at d4b4b75)

Run from a checkout of the PR head. A python3 that always fails stands in for a sandbox that refuses the bind.

#!/bin/bash
# Run from a checkout of the PR head. A python3 that always fails stands in for
# a sandbox that refuses the socket bind.
set -u
nopy=$(mktemp -d)
printf '#!/bin/bash\nexit 1\n' >"$nopy/python3"
chmod +x "$nopy/python3"

echo '$ bash test/shell.d/launch-shell-test.sh   # bind refused'
PATH="$nopy:$PATH" bash test/shell.d/launch-shell-test.sh
echo "exit $?"
echo
echo '$ bash test/shell.d/compositor-guard-test.sh | tail -n 1   # bind refused'
PATH="$nopy:$PATH" bash test/shell.d/compositor-guard-test.sh | tail -n 1
rm -rf "$nopy"

Output (nine checks, none of them the slow-resume case, and no # SKIP marker; compositor-guard-test.sh reports its skip):

$ bash test/shell.d/launch-shell-test.sh   # bind refused
ok - a shell that exits cleanly is left alone
ok - the shell launches with Quickshell's config watcher and reload popup off
ok - a shell that dies without a signal is relaunched
ok - a shell that keeps dying is not relaunched forever
ok - the shell is not relaunched once the compositor is gone
ok - a compositor too busy to answer is not mistaken for one that is gone
ok - a compositor that left no socket is not waited on
ok - a signal during backoff stops the supervisor before it relaunches
ok - stopping the supervisor stops the shell it is watching
exit 0

$ bash test/shell.d/compositor-guard-test.sh | tail -n 1   # bind refused
ok - cannot bind a Unix socket here; skipping the cases that need one

The same with the PR commit applied to the current quattro tip (8b4eae6), whose ./test/shell lists files with skipped checks. The script below was run with that checkout as its argument; to keep the run short it removes every other *-test.sh file from a copy (base-test.sh is kept), then runs the tip runner with the bind refused and allowed. REVIEW_OUTPUT is the directory the results were written to.

#!/bin/bash
# The tip's ./test/shell runner, with the PR applied, restricted to the two
# files that bind a socket fixture, once with the bind refused and once with it
# allowed. base-test.sh is kept.
# usage: tip-runner.sh <tippr-src>
set -u
tippr=$1
out="$REVIEW_OUTPUT/tip-runner"
mkdir -p "$out"
work=$(mktemp -d)
cp -a "$tippr/." "$work/"
chmod -R u+w "$work"
find "$work/test/shell.d" -maxdepth 1 -name '*-test.sh' \
  ! -name base-test.sh ! -name launch-shell-test.sh ! -name compositor-guard-test.sh -delete
ls "$work/test/shell.d" >"$out/files.txt"
nopy=$(mktemp -d)
printf '#!/bin/bash\nexit 1\n' >"$nopy/python3"
chmod +x "$nopy/python3"
(cd "$work" && PATH="$nopy:$PATH" ./test/shell) >"$out/bind-refused.out" 2>&1
echo "exit $?" >>"$out/bind-refused.out"
(cd "$work" && ./test/shell) >"$out/bind-allowed.out" 2>&1
echo "exit $?" >>"$out/bind-allowed.out"
rm -rf "$work" "$nopy"

bind-refused.out (only compositor-guard-test.sh is listed as having skipped checks):

==> test/shell.d/compositor-guard-test.sh
ok - guard skips without a display
ok - guard skips when the socket is unreachable
ok - cannot bind a Unix socket here; skipping the cases that need one # SKIP
==> test/shell.d/launch-shell-test.sh
ok - a shell that exits cleanly is left alone
ok - the shell launches with Quickshell's config watcher and reload popup off
ok - a shell that dies without a signal is relaunched
ok - a shell that keeps dying is not relaunched forever
ok - the shell is not relaunched once the compositor is gone
ok - a compositor too busy to answer is not mistaken for one that is gone
ok - a compositor that left no socket is not waited on
ok - a signal during backoff stops the supervisor before it relaunches
ok - stopping the supervisor stops the shell it is watching

Skipped checks in 1 of 2 test files:
  test/shell.d/compositor-guard-test.sh

2 test files completed without failures; 1 had skipped checks.
exit 0

Last lines of bind-allowed.out:


All 2 test files passed.
exit 0
More findings

A teardown during the wait is logged as a compositor failure

Inside the socket wait, compositor_alive returns 1 once terminating is set, and the caller then logs "the compositor stopped answering". Impact: after a teardown signal that lands during the wait, the journal names the compositor rather than the teardown.

Suggested change: put (( terminating )) && exit 0 as the first line inside if ! compositor_alive; then.

Reproducer (teardown during the wait, at d4b4b75):

Case below inserted into test/shell.d/launch-shell-test.sh at the PR head, just before # A signal mid-backoff only reaches the trap once the sleep is over. It reuses the file's own stubs: the fake hyprctl misses 1000 queries while the bound socket from the PR's fixture is present, so the launcher is inside the new wait when it gets SIGTERM.

# A session teardown during the socket wait ends supervision promptly.
# Inserted before "# A signal mid-backoff only reaches the trap once the sleep
# is over." in test/shell.d/launch-shell-test.sh.
if (( socket_bound )); then
  : >"$qs_log"
  : >"$qs_env_log"
  : >"$logger_log"
  rm -f "$hyprctl_misses"

  PATH="$fake_bin:$PATH" \
  OMARCHY_PATH="$shell_root" \
  OMARCHY_TEST_QS_LOG="$qs_log" \
  OMARCHY_TEST_QS_ENV_LOG="$qs_env_log" \
  OMARCHY_TEST_QS_STATUSES=$'255\n0' \
  OMARCHY_TEST_COMPOSITOR_GONE=0 \
  OMARCHY_TEST_LOGGER_LOG="$logger_log" \
  OMARCHY_TEST_QS_TERMINATED="$qs_terminated" \
  OMARCHY_TEST_HYPRCTL_MISSES=1000 \
  OMARCHY_TEST_HYPRCTL_MISS_COUNT="$hyprctl_misses" \
  XDG_RUNTIME_DIR="$runtime_dir" \
  HYPRLAND_INSTANCE_SIGNATURE="$signature" \
    "$ROOT/bin/omarchy-launch-shell" &
  launch_pid=$!

  # Past the three quick queries and inside the wait.
  for (( waited = 0; waited < 200; waited++ )); do
    (( $(cat "$hyprctl_misses" 2>/dev/null || echo 0) >= 5 )) && break
    sleep 0.05
  done

  signalled=$SECONDS
  kill -TERM "$launch_pid"
  wait "$launch_pid" || fail "a supervisor signalled during the wait exits cleanly"
  launch_pid=""
  (( SECONDS - signalled <= 2 )) || fail "a teardown during the wait ends supervision promptly" "took $(( SECONDS - signalled ))s"
  [[ $(launches) == 1 ]] || fail "a supervisor signalled during the wait does not relaunch" "$(<"$qs_log")"
  pass "a teardown during the wait ends supervision promptly"

  # Optional wording check: the journal line blames the compositor.
  if [[ ${CHECK_WORDING:-0} == 1 ]]; then
    ! grep -F 'stopped answering' "$logger_log" >/dev/null ||
      fail "a teardown during the wait is not logged as a compositor that stopped answering" "$(<"$logger_log")"
    pass "a teardown during the wait is not logged as a compositor that stopped answering"
  fi
fi
  1. At the PR head the case passes (bash test/shell.d/launch-shell-test.sh):
ok - a shell that exits cleanly is left alone
ok - the shell launches with Quickshell's config watcher and reload popup off
ok - a shell that dies without a signal is relaunched
ok - a shell that keeps dying is not relaunched forever
ok - the shell is not relaunched once the compositor is gone
ok - a compositor too busy to answer is not mistaken for one that is gone
ok - a compositor slow to answer after resume is not mistaken for one that is gone
ok - a compositor that left no socket is not waited on
ok - a teardown during the wait ends supervision promptly
ok - a signal during backoff stops the supervisor before it relaunches
ok - stopping the supervisor stops the shell it is watching
exit 0
  1. With the new (( terminating )) && return 1 line removed from the wait, the PR's own ten checks still pass; only this case fails:
@@ -59,7 +59,6 @@
   compositor_socket_present || return 1
 
   for (( waited = 0; waited < 60; waited++ )); do
-    (( terminating )) && return 1
     sleep 0.5
     hyprctl -j monitors >/dev/null 2>&1 && return 0
     compositor_socket_present || return 1
ok - a shell that exits cleanly is left alone
ok - the shell launches with Quickshell's config watcher and reload popup off
ok - a shell that dies without a signal is relaunched
ok - a shell that keeps dying is not relaunched forever
ok - the shell is not relaunched once the compositor is gone
ok - a compositor too busy to answer is not mistaken for one that is gone
ok - a compositor slow to answer after resume is not mistaken for one that is gone
ok - a compositor that left no socket is not waited on
took 29s
not ok - a teardown during the wait ends supervision promptly
exit 1
  1. With CHECK_WORDING=1 at the PR head: the journal line written after the teardown signal blames the compositor:
ok - a shell that exits cleanly is left alone
ok - the shell launches with Quickshell's config watcher and reload popup off
ok - a shell that dies without a signal is relaunched
ok - a shell that keeps dying is not relaunched forever
ok - the shell is not relaunched once the compositor is gone
ok - a compositor too busy to answer is not mistaken for one that is gone
ok - a compositor slow to answer after resume is not mistaken for one that is gone
ok - a compositor that left no socket is not waited on
ok - a teardown during the wait ends supervision promptly
Omarchy shell exited with status 255; the compositor stopped answering, so supervision ends here.
not ok - a teardown during the wait is not logged as a compositor that stopped answering
exit 1

"Up to 30 more seconds" is not a bound

The 30 s is only the sleep budget: against a stand-in for a crashed compositor that left its socket (Hyprland unlinks it only on a clean exit), the head waited 31.4 s, and against a stalled one it was still waiting at 120 s, where the base stood down after 16.4 s. A SIGTERM to the launcher's process group ended the wait in 0.01 s (0.50 s when sent to the launcher alone). Impact: the PR text understates how long supervision can continue on a dead or stalled compositor.

Suggested change: describe the wait as up to 60 polls rather than 30 s in the PR text.

Reproducer (launcher timing, base and head):

Runs bin/omarchy-launch-shell from a base checkout (b679363) and a PR-head checkout (d4b4b75) with the real hyprctl client (hyprland 0.56.2-2) against two stand-in sockets: crashed (bound, nobody listening, what a compositor that aborted leaves behind) and stalled (listening with Hyprland's backlog of 10, never accepting, like an event loop that is not running). Quickshell, logger and systemd-cat are stubs; the first shell exits 255. Needs python3 and hyprctl; private runtime dir only.

#!/bin/bash
# How long bin/omarchy-launch-shell supervises after the shell dies, against
# stand-in compositor sockets and the real hyprctl client. Quickshell, logger
# and systemd-cat are stubs; the runtime dir is private.
# usage: guard-timing.sh <checkout> [<checkout>...]   (e.g. base and PR head)
set -u
tmp=$(mktemp -d)
sig=review_0_0

mkdir -p "$tmp/bin" "$tmp/root/shell"
cat >"$tmp/bin/quickshell" <<'SH'
#!/bin/bash
echo launch >>"$TMP_QS_LOG"
(( $(wc -l <"$TMP_QS_LOG") == 1 )) && exit 255   # first shell dies like Qt on a broken connection
trap 'exit 143' TERM
while true; do sleep 0.05; done
SH
cat >"$tmp/bin/systemd-cat" <<'SH'
#!/bin/bash
while (( $# > 0 )); do [[ $1 == "--" ]] && { shift; break; }; shift; done
exec "$@"
SH
cat >"$tmp/bin/logger" <<'SH'
#!/bin/bash
shift 2
echo "logger: $*" >>"$TMP_LOGGER_LOG"
SH
cat >"$tmp/bin/hyprctl" <<'SH'
#!/bin/bash
echo query >>"$TMP_HYPRCTL_LOG"
exec /usr/bin/hyprctl "$@"
SH
chmod +x "$tmp/bin"/*

# crashed: a bound socket nobody listens on. stalled: listening (backlog 10, as
# Hyprland), never accepting, like an event loop that is not running.
make_socket() {
  local kind=$1 dir="$tmp/rt-$kind-$RANDOM/hypr/$sig"
  mkdir -p "$dir"
  if [[ $kind == crashed ]]; then
    python3 -c 'import socket, sys; socket.socket(socket.AF_UNIX).bind(sys.argv[1])' "$dir/.socket.sock"
  else
    python3 -c '
import socket, sys, time
s = socket.socket(socket.AF_UNIX); s.bind(sys.argv[1]); s.listen(10)
open(sys.argv[2], "w").write("ready"); time.sleep(3600)
' "$dir/.socket.sock" "$dir/ready" >/dev/null 2>&1 &
    listener=$!
    until [[ -f $dir/ready ]]; do sleep 0.05; done
  fi
  runtime=${dir%/hypr/$sig}
}

run() {  # <checkout> <kind>
  local checkout=$1 kind=$2 start end rc
  listener=""
  make_socket "$kind"
  : >"$tmp/qs.log"; : >"$tmp/logger.log"; : >"$tmp/hyprctl.log"
  start=$(date +%s.%N)
  PATH="$tmp/bin:$PATH" OMARCHY_PATH="$tmp/root" XDG_RUNTIME_DIR="$runtime" \
    HYPRLAND_INSTANCE_SIGNATURE="$sig" TMP_QS_LOG="$tmp/qs.log" \
    TMP_LOGGER_LOG="$tmp/logger.log" TMP_HYPRCTL_LOG="$tmp/hyprctl.log" \
    timeout 120 "$checkout/bin/omarchy-launch-shell"
  rc=$?
  end=$(date +%s.%N)
  [[ -n $listener ]] && { kill "$listener"; wait "$listener" 2>/dev/null; }
  printf '%-8s %-8s exit %-3s after %5.1fs, %2d hyprctl queries, %d launch(es)%s\n' \
    "$(basename "$checkout")" "$kind" "$rc" "$(awk -v a="$start" -v b="$end" 'BEGIN { print b - a }')" \
    "$(wc -l <"$tmp/hyprctl.log")" "$(wc -l <"$tmp/qs.log")" \
    "$( (( rc == 124 )) && echo ', still waiting when timeout 120 stopped it')"
  sed 's/^/         /' "$tmp/logger.log"
}

for checkout in "$@"; do
  run "$checkout" crashed
  run "$checkout" stalled
done
rm -rf "$tmp"

Output of ./guard-timing.sh base head (both arguments are checkouts):

$ ./guard-timing.sh base head
base     crashed  exit 0   after   1.0s,  3 hyprctl queries, 1 launch(es)
base     stalled  exit 0   after  16.4s,  3 hyprctl queries, 1 launch(es)
head     crashed  exit 0   after  31.4s, 63 hyprctl queries, 1 launch(es)
         logger: Omarchy shell exited with status 255; the compositor stopped answering, so supervision ends here.
Terminated                 hyprctl -j monitors > /dev/null 2>&1
head     stalled  exit 124 after 120.0s, 12 hyprctl queries, 1 launch(es), still waiting when timeout 120 stopped it
         logger: Omarchy shell exited with status 255; the compositor stopped answering, so supervision ends here.
exit 0

In the head stalled row the launcher had made 12 queries in 120 s and was still waiting when timeout 120 stopped it; the logger line under it was written after that SIGTERM. Terminated ... is bash reporting the hyprctl that the SIGTERM killed. (A separate run that timestamped each query showed the first 11 failing with exit 6 after about 5.1 s each and the 12th still pending about 40 s later when that run's 100 s cap stopped it, consistent with connect() blocking once the listen queue is full.)

Open PRs on the same launcher

Impact: whichever PR lands second needs its loop or test reconciled with the other.

Suggested change: agree one wait-and-adopt algorithm with #13490, and use the #10709-style case for the slow-resume test.

Optional notes

Optional test improvement (teardown path): removing (( terminating )) && return 1 from the wait still passes all 10 checks. The case in "Reproducer (teardown during the wait)" under More findings passes at the head and fails with that line removed (took 29s).

Optional test improvement (no-socket case): that case passes an empty signature, so the -S test is never false anywhere in the file. A launcher that checks only for a non-empty signature passes all 10 checks. One added argument makes the case reach -S:

At the PR head, the no-socket case (test/shell.d/launch-shell-test.sh:168-173) calls launch_shell without a fourth argument, so HYPRLAND_INSTANCE_SIGNATURE is empty and compositor_socket_present returns at [[ -n $signature ]] || return 1. The [[ -S ... ]] line is only ever reached with the fixture socket present. So a launcher that checks only for a non-empty signature still passes the whole file.

Mutant (bin/omarchy-launch-shell):

--- a/bin/omarchy-launch-shell
+++ b/bin/omarchy-launch-shell
@@ -39,7 +39,7 @@
   local signature=${HYPRLAND_INSTANCE_SIGNATURE:-}
 
   [[ -n $signature ]] || return 1
-  [[ -S ${XDG_RUNTIME_DIR:-/run/user/$UID}/hypr/$signature/.socket.sock ]]
+  return 0
 }
 
 # A compositor busy reconfiguring outputs can miss a query without being gone,

bash test/shell.d/launch-shell-test.sh with that mutant, test file unchanged (exit 0):

ok - a shell that exits cleanly is left alone
ok - the shell launches with Quickshell's config watcher and reload popup off
ok - a shell that dies without a signal is relaunched
ok - a shell that keeps dying is not relaunched forever
ok - the shell is not relaunched once the compositor is gone
ok - a compositor too busy to answer is not mistaken for one that is gone
ok - a compositor slow to answer after resume is not mistaken for one that is gone
ok - a compositor that left no socket is not waited on
ok - a signal during backoff stops the supervisor before it relaunches
ok - stopping the supervisor stops the shell it is watching

Proposed test change: give the no-socket case a signature that has no socket.

--- a/test/shell.d/launch-shell-test.sh
+++ b/test/shell.d/launch-shell-test.sh
@@ -167,7 +167,7 @@
 
 # Without a socket there is nothing to wait for, and the short budget decides.
 rm -f "$hyprctl_misses"
-launch_shell $'255\n0' 0 12 || fail "a shell outliving the compositor exits cleanly"
+launch_shell $'255\n0' 0 12 "no-socket-instance" || fail "a shell outliving the compositor exits cleanly"
 [[ $(launches) == 1 ]] || fail "a compositor that left no socket ends supervision" "$(<"$qs_log")"
 grep -F 'stopped answering' "$logger_log" >/dev/null || fail "standing down is recorded in the journal"
 pass "a compositor that left no socket is not waited on"

With the change, at the PR head (exit 0):

ok - a shell that exits cleanly is left alone
ok - the shell launches with Quickshell's config watcher and reload popup off
ok - a shell that dies without a signal is relaunched
ok - a shell that keeps dying is not relaunched forever
ok - the shell is not relaunched once the compositor is gone
ok - a compositor too busy to answer is not mistaken for one that is gone
ok - a compositor slow to answer after resume is not mistaken for one that is gone
ok - a compositor that left no socket is not waited on
ok - a signal during backoff stops the supervisor before it relaunches
ok - stopping the supervisor stops the shell it is watching

With the change and the mutant (exit 1):

ok - a shell that exits cleanly is left alone
ok - the shell launches with Quickshell's config watcher and reload popup off
ok - a shell that dies without a signal is relaunched
ok - a shell that keeps dying is not relaunched forever
ok - the shell is not relaunched once the compositor is gone
ok - a compositor too busy to answer is not mistaken for one that is gone
ok - a compositor slow to answer after resume is not mistaken for one that is gone
-n -p /tmp/tmp.hEuqQnUjk6/root/shell
-n -p /tmp/tmp.hEuqQnUjk6/root/shell
not ok - a compositor that left no socket ends supervision

The changed case needs no socket, so it still runs when the fixture bind is refused (9 checks, exit 0, with a python3 that always fails first on PATH).

Optional test improvement (wait length): the file passes with the 60-poll bound cut to 10 (about 5 s), well below the issue's ~26 s blackout. A case with a sleep stub that returns at once guards a resume-length wait (it fails below 53 polls):

With the 60-iteration bound cut to 20 (about 10 s), bash test/shell.d/launch-shell-test.sh still passes at the PR head (10 checks, exit 0). The slow-resume case needs only 10 iterations: it passes with 10 and fails with 9 (not ok - a slow resume does not end supervision).

Case below inserted before # A signal mid-backoff only reaches the trap once the sleep is over. A sleep stub that returns at once (as hybrid-gpu-test.sh, emojis-test.sh and hermes-theme-test.sh already do) lets it count the half-second waits instead of sitting through them. With 55 misses, the answer comes 53 waits (26.5 s nominal) into the socket wait.

# The wait has to outlast a resume that takes tens of seconds. A sleep that
# returns at once lets the case count the half-second waits instead of sitting
# through them: 55 misses put the answer 53 waits (26.5 s) into the socket wait.
if (( socket_bound )); then
  fast_bin="$test_tmp/fast-bin"
  mkdir -p "$fast_bin"
  printf '#!/bin/bash\nexit 0\n' >"$fast_bin/sleep"
  chmod +x "$fast_bin/sleep"

  rm -f "$hyprctl_misses"
  : >"$qs_log"
  : >"$qs_env_log"
  : >"$logger_log"

  PATH="$fast_bin:$fake_bin:$PATH" \
  OMARCHY_PATH="$shell_root" \
  OMARCHY_TEST_QS_LOG="$qs_log" \
  OMARCHY_TEST_QS_ENV_LOG="$qs_env_log" \
  OMARCHY_TEST_QS_STATUSES=$'255\n0' \
  OMARCHY_TEST_COMPOSITOR_GONE=0 \
  OMARCHY_TEST_LOGGER_LOG="$logger_log" \
  OMARCHY_TEST_QS_TERMINATED="$qs_terminated" \
  OMARCHY_TEST_HYPRCTL_MISSES=55 \
  OMARCHY_TEST_HYPRCTL_MISS_COUNT="$hyprctl_misses" \
  XDG_RUNTIME_DIR="$runtime_dir" \
  HYPRLAND_INSTANCE_SIGNATURE="$signature" \
    timeout 30 "$ROOT/bin/omarchy-launch-shell" || fail "a shell survives a resume that takes tens of seconds"
  [[ $(launches) == 2 ]] || fail "a 26-second blackout does not end supervision" "$(<"$qs_log")"
  pass "supervision outlasts a 26-second blackout"
fi

At the PR head (exit 0; the whole file took 18.5 s, against 18.4 s without the case):

ok - a shell that exits cleanly is left alone
ok - the shell launches with Quickshell's config watcher and reload popup off
ok - a shell that dies without a signal is relaunched
ok - a shell that keeps dying is not relaunched forever
ok - the shell is not relaunched once the compositor is gone
ok - a compositor too busy to answer is not mistaken for one that is gone
ok - a compositor slow to answer after resume is not mistaken for one that is gone
ok - a compositor that left no socket is not waited on
ok - supervision outlasts a 26-second blackout
ok - a signal during backoff stops the supervisor before it relaunches
ok - stopping the supervisor stops the shell it is watching

With the bound cut to 20 (exit 1):

--- a/bin/omarchy-launch-shell
+++ b/bin/omarchy-launch-shell
@@ -58,7 +58,7 @@
   # locker to authenticate against. Keep waiting while the socket is there.
   compositor_socket_present || return 1
 
-  for (( waited = 0; waited < 60; waited++ )); do
+  for (( waited = 0; waited < 20; waited++ )); do
     (( terminating )) && return 1
     sleep 0.5
     hyprctl -j monitors >/dev/null 2>&1 && return 0
ok - a shell that exits cleanly is left alone
ok - the shell launches with Quickshell's config watcher and reload popup off
ok - a shell that dies without a signal is relaunched
ok - a shell that keeps dying is not relaunched forever
ok - the shell is not relaunched once the compositor is gone
ok - a compositor too busy to answer is not mistaken for one that is gone
ok - a compositor slow to answer after resume is not mistaken for one that is gone
ok - a compositor that left no socket is not waited on
-n -p /tmp/tmp.sWRfNqwZjN/root/shell
not ok - a 26-second blackout does not end supervision

The case also fails with a bound of 52 and passes with 53.


Review information

Test scope: Source and sandbox tests at d4b4b75 and on the quattro tip, with stand-in sockets; no live session or suspend, and #11820 was not reproduced.

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.

devYRPauli and others added 2 commits September 30, 2026 19:29
A signal during the socket wait makes compositor_alive return 1, and
the caller then logged that the compositor stopped answering. Exit
before that log line when the launcher is terminating.

The tests now cover that case, report the socket cases as skipped when
the sandbox refuses the bind, and give the no-socket case a signature
so the -S check is reached.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

The shell supervisor now waits longer for Hyprland to recover when its IPC socket still exists.

  • The shell supervisor waits through slow compositor resumes.

No new actionable issues found.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Shell exits with an error] --> B{Three quick probes succeed?}
  B -->|No| C{IPC socket exists?}
  C -->|Yes| D[Try up to 60 recovery probes]
  C -->|No| E[Log and end supervision]
  D -->|No answer| E
  D -->|Answer| F{Teardown requested?}
  B -->|Yes| F
  D -->|Teardown| G[Exit cleanly]
  F -->|Yes| G
  F -->|No| H[Apply restart budget and relaunch]
Loading

Reviews (3) · Last reviewed commit: "Merge branch 'quattro' into fix/launch-s..." · Reviewed by Greptile

Comment thread bin/omarchy-launch-shell Resolved
Comment thread test/shell.d/launch-shell-test.sh Resolved
@devYRPauli

Copy link
Copy Markdown
Author
  1. Fixes #11820: changed to Refs #11820. The body now says the change covers a compositor that keeps its socket but does not answer IPC, and that the cause of Permanent lockout after suspend: omarchy-launch-shell's 1.5s compositor_alive guard abandons a dead lock client on slow resume #11820 is not confirmed.

  2. Silent skip: I merged the quattro tip into the branch. Both socket cases now call skip when the bind is refused, so the runner lists the file under skipped checks.

  3. Teardown during the wait: the caller now exits before the logger line when terminating is set. Your teardown case is in the test file, with the wording check always on. It fails when either terminating check is removed.

  4. Wait length: the body now describes the wait as 60 polls, 0.5s apart, and says a stalled compositor adds up to 5s per poll.

  5. Keep the shell supervisor attached after a locked Hyprland restart #13490 and Keep supervising unexpected clean shell exits #10709: I did not change the loop for them. Whichever PR lands second needs a rebase, and I will do it here if this one is second.

  6. No-socket case: it now passes a signature that has no socket, so the -S check is reached. It fails against the signature-only mutant. I did not add the fast sleep case, because the 60-poll bound comes from one 26s report and I do not want a test to fix it.

On a5a1c4a, launch-shell-test.sh, restart-shell-test.sh and compositor-guard-test.sh give 28 ok and 0 not ok.

@omarchybot omarchybot added verified Omarchy Triage has verified that this issue is ready for final review ready Good to merge labels Oct 1, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed at a5a1c4a against quattro (8b4eae6). Nothing found that needs changing.

Reproduction. This ran on a disposable worker built from the Omarchy ISO, with real Hyprland and the real hyprctl. Quickshell was a stand-in that exits 255 and freezes the compositor with SIGSTOP for 25 seconds, so the socket stays in place while IPC stops answering. The quattro launcher ended supervision silently after 17 seconds, with one launch and no journal line. This branch relaunched the shell after 27 seconds, once the compositor answered again. Your launch-shell-test.sh fails against the quattro launcher at a slow resume does not end supervision. This is the "keeps its socket, does not answer" case the description names. It does not confirm the cause of #11820, and Refs rather than Fixes is right until a journal shows the new line.

Tests on the worker. launch-shell-test.sh, restart-shell-test.sh and compositor-guard-test.sh pass, 11/9/8, and both socket cases ran rather than skipped. In ./test/cli and ./test/shell, the same checks fail on quattro and on this branch: vscode generated theme references current theme file, plus nine shell files unrelated to the launcher. Nothing new fails.

Second opinion. Codex Medium reviewed the diff and found no defect introduced here, agreeing that the change is proportionate. Its independence is not guaranteed. It confirmed one point Greptile raised: if a signal arrives during the half-second sleep and the next query answers, the launcher logs "relaunching", or "Giving up" with exit 1 when the attempt budget is spent, before it exits at the top of the loop. It never starts another shell, and the three-query loop on quattro already has the same race, so nothing was pushed for it. Codex also noted that a compositor that is stopped rather than gone holds the wait for up to about 330 seconds, because each hyprctl read can take 5 seconds. That wait is bounded, and only a session already in that state can hit it.

Overlap. #13490 also reworks compositor_alive, for a compositor restarted under a new instance signature. The two fix different failures, and whichever lands second needs a rebase, as you said.

Nothing is waiting on you. This is with the maintainer.

@omarchybot omarchybot added verified Omarchy Triage has verified that this issue is ready for final review ready Good to merge and removed verified Omarchy Triage has verified that this issue is ready for final review ready Good to merge labels Oct 2, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed at a5a1c4a against quattro (8b4eae6). Nothing found that needs changing.

Reproduction. This ran on a disposable worker built from the Omarchy ISO, with real Hyprland and the real hyprctl. Quickshell was a stand-in that exits 255 and freezes the compositor with SIGSTOP for 25 seconds, so the socket stays in place while IPC stops answering. The quattro launcher ended supervision silently after 17 seconds, with one launch and no journal line. This branch relaunched the shell after 27 seconds, once the compositor answered again. Your launch-shell-test.sh fails against the quattro launcher at a slow resume does not end supervision. This is the "keeps its socket, does not answer" case the description names. It does not confirm the cause of #11820, and Refs rather than Fixes is right until a journal shows the new line.

Tests on the worker. launch-shell-test.sh, restart-shell-test.sh and compositor-guard-test.sh pass, 11/9/8, and both socket cases ran rather than skipped. In ./test/cli and ./test/shell, the same checks fail on quattro and on this branch: vscode generated theme references current theme file, plus nine shell files unrelated to the launcher. Nothing new fails.

Second opinion. Codex Medium reviewed the diff and found no defect introduced here, agreeing that the change is proportionate. Its independence is not guaranteed. It confirmed one point Greptile raised: if a signal arrives during the half-second sleep and the next query answers, the launcher logs "relaunching", or "Giving up" with exit 1 when the attempt budget is spent, before it exits at the top of the loop. It never starts another shell, and the three-query loop on quattro already has the same race, so nothing was pushed for it. Codex also noted that a compositor that is stopped rather than gone holds the wait for up to about 330 seconds, because each hyprctl read can take 5 seconds. That wait is bounded, and only a session already in that state can hit it.

Overlap. #13490 also reworks compositor_alive, for a compositor restarted under a new instance signature. The two fix different failures, and whichever lands second needs a rebase, as you said.

Nothing is waiting on you. This is with the maintainer.

@omarchybot

Copy link
Copy Markdown
Collaborator

Correction: the comment just above repeats the previous review of a5a1c4a and was posted by mistake. This is the review of the current head.

Re-reviewed at 2c73dca against quattro (821ae58). Nothing found that needs changing.

The new commit. The terminating check after a successful probe closes the race raised last time. A teardown that lands while the compositor is answering no longer logs a relaunch, spends the restart budget or exits 1. This holds for the three fast probes as well as for the extended wait. On a disposable worker built from the Omarchy ISO, the new case a teardown when the compositor answers ends supervision without a relaunch passes on this branch. It fails with that one line removed, and the launcher then logs "relaunching".

Reproduction, repeated at this head. This used real Hyprland and the real hyprctl, with the compositor SIGSTOPped for 25 seconds after the shell exits 255. The quattro launcher ended supervision silently after 18 seconds, with one launch and no journal line. This branch relaunched the shell after 27 seconds. Your launch-shell-test.sh passes 12/12 here, and it fails against the quattro launcher at a slow resume does not end supervision.

Suites on the worker. In ./test/cli, vscode generated theme references current theme file fails on both quattro and this branch. Everything ./test/shell fails on this branch also fails on quattro, and none of it touches the launcher. omarchy-kernel-migration-test.sh hangs in pacman on quattro itself, so it was left out on both sides.

Second opinion. Codex Medium re-reviewed the delta and found no defect. Its independence is not guaranteed. It confirmed that the fake hyprctl signals the launcher itself and that the trap runs before the new check, so the test exercises the path it names. It also noted that 62 misses is exactly the last poll the wait allows. It pointed out three narrower races this commit does not touch, all present on quattro too: a signal during the "Giving up" logger call still ends with exit 1, a signal after the new check can still precede a "relaunching" line, and a signal between the top-of-loop check and the launch can still start a shell. None of them was pushed.

Overlap. #13490 and #10709 also change bin/omarchy-launch-shell. Whichever lands second needs a rebase.

Nothing is waiting on you. This is with the maintainer.

@omarchybot omarchybot removed ready Good to merge verified Omarchy Triage has verified that this issue is ready for final review labels Oct 14, 2026
omarchybot and others added 3 commits October 14, 2026 10:26
quattro now runs the launch-shell test against a scratch copy of the supervisor with its sleeps shortened. The resume cases keep their socket environment and run that copy too, which also shortens the 60-step resume wait to 3s, so the 30s timeout from quattro is enough.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The test now runs a copy of the supervisor whose resume wait is shortened to about 3s, so a wait that ignored the signal could still finish inside the 2s allowance and pass. Probes made after the signal show whether the wait stopped, whatever the wait's length.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…duler

The stub truncated the counter before writing it, so the snapshot taken before the signal could read it empty, count from zero and fail a correct supervisor. Ten probes after the signal still separates a wait that stops from one that runs on, which makes about 58.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Codex Medium <noreply@openai.com>
@omarchybot omarchybot added verified Omarchy Triage has verified that this issue is ready for final review ready Good to merge labels Oct 14, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

This stopped merging cleanly after #15412 changed test/shell.d/launch-shell-test.sh to run a copy of the launcher with its sleeps shortened, so I merged quattro into the branch and pushed three commits:

  • 5ba285b is the merge. Your resume cases keep their XDG_RUNTIME_DIR and HYPRLAND_INSTANCE_SIGNATURE, and they now run the shortened copy like the other cases, including the teardown-during-the-wait case. That copy also shortens your 60-step wait to about 3s, so the 30s timeout from quattro is enough.
  • 6333c14 replaces the "ends supervision promptly" timing check. With the wait down to about 3s, a wait that ignored the signal could still exit inside the 2s allowance and pass. The check now counts the hyprctl probes made after the signal.
  • fa17474 makes the hyprctl stub write its miss counter to a temporary file and rename it into place. Without that, the count read before the signal could catch the file empty. The allowance is now 10 probes, to leave room for a slow scheduler. A wait that ignores the signal makes 58.

bin/omarchy-launch-shell is unchanged from your head apart from what quattro brought in.

Checked on a worker built from the Omarchy ISO, at fa17474 against quattro 58a289e:

  • launch-shell-test.sh passed 13/13, three runs in a row, with the socket cases running.
  • The same tests against quattro's launcher fail at a slow resume does not end supervision.
  • With the terminating check removed from the wait, the teardown case fails after 58 probes.
  • restart-shell-test.sh (9/9), compositor-guard-test.sh (8/8) and ./test/cli are green.

The change is proportionate to the problem. As you say in the description, it doesn't confirm the cause of #11820, so it is not linked as closing it.

Codex Medium reviewed it over three rounds. The test fixes above came from its findings, and its last round found nothing. It also pointed out that a foreground hyprctl can delay a TERM by up to Hyprland's 5s read timeout. I left that alone: the three quick probes already on quattro behave the same way, and 5s is well inside systemd's stop timeout. Its independence from my review isn't guaranteed.

Nothing is left for you. It's waiting on the maintainer.

@greptile-apps

greptile-apps Bot commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Want your agent to iterate on Greptile's feedback? Try greploops.

@omarchybot omarchybot removed verified Omarchy Triage has verified that this issue is ready for final review ready Good to merge labels Nov 18, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

I read the launcher and regression-test diff at ed8d16d against quattro. Codex High classifies this as a bug fix, but the configured classification reviewer, deepseek-v4p1-flash, returned no classification, so the required classification agreement is still missing.

The full review and worker tests have not run for this head. The earlier verification applies to fa17474, and has not been carried forward. No changes were pushed. This is waiting on the maintainer to resolve classification; nothing is requested from you.

@omarchybot omarchybot removed the bug Something isn't working label Nov 18, 2026
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.

3 participants