From be781574d1eaafd640d2a5af82c5a89a21f574a0 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Fri, 24 Jul 2026 18:57:51 -0700 Subject: [PATCH] Let the invitation terminals actually open Clicking the Voxtype or fingerprint invitation did nothing. The launcher execs setsid, which forks because the transient unit's main process is already a process group leader, so the unit exits within milliseconds and systemd's default control-group kill took the still-starting terminal down with it. Run those units with KillMode=process instead. The invitation tests had also drifted from the two-unit design and were failing; teach the systemd-run mock to run the command it is given. --- install/user/first-run/install-voxtype.hook | 5 ++++- install/user/first-run/setup-fingerprint.hook | 5 ++++- test/shell.d/fingerprint-invitation-test.sh | 16 +++++++++++----- test/shell.d/voxtype-invitation-test.sh | 16 +++++++++++----- 4 files changed, 30 insertions(+), 12 deletions(-) diff --git a/install/user/first-run/install-voxtype.hook b/install/user/first-run/install-voxtype.hook index 14c556f9..1fcb0cbc 100644 --- a/install/user/first-run/install-voxtype.hook +++ b/install/user/first-run/install-voxtype.hook @@ -8,7 +8,10 @@ show_invitation() { # can exit right after the click. If it stayed alive for the life of the # install terminal, the installer's omarchy-restart-shell would re-trigger # this still-running *-invitation unit and pop the toast a second time. - systemd-run --user --collect --quiet \ + # KillMode=process because the launcher's setsid forks and returns, so the + # unit's main process exits within milliseconds. The default control-group + # kill would take the terminal down with it before it ever appears. + systemd-run --user --collect --quiet -p KillMode=process \ --unit=omarchy-voxtype-install \ omarchy-launch-floating-terminal-with-presentation omarchy-voxtype-install fi diff --git a/install/user/first-run/setup-fingerprint.hook b/install/user/first-run/setup-fingerprint.hook index 4ef1ba47..b863a92d 100644 --- a/install/user/first-run/setup-fingerprint.hook +++ b/install/user/first-run/setup-fingerprint.hook @@ -8,7 +8,10 @@ show_invitation() { # exit right after the click. If it stayed alive for the life of the setup # terminal, the setup's omarchy-restart-shell would re-trigger this # still-running *-invitation unit and pop the toast a second time. - systemd-run --user --collect --quiet \ + # KillMode=process because the launcher's setsid forks and returns, so the + # unit's main process exits within milliseconds. The default control-group + # kill would take the terminal down with it before it ever appears. + systemd-run --user --collect --quiet -p KillMode=process \ --unit=omarchy-setup-security-fingerprint \ omarchy-launch-floating-terminal-with-presentation omarchy-setup-security-fingerprint fi diff --git a/test/shell.d/fingerprint-invitation-test.sh b/test/shell.d/fingerprint-invitation-test.sh index 57f7fe0d..a746530e 100644 --- a/test/shell.d/fingerprint-invitation-test.sh +++ b/test/shell.d/fingerprint-invitation-test.sh @@ -45,10 +45,13 @@ cat >"$test_bin/systemd-run" <<'EOF' #!/bin/bash echo "systemd-run:$*" >>"$TEST_LOG" while (($# > 0)); do - [[ $1 == "bash" ]] && exec "$@" - shift + case $1 in + -p) shift 2 ;; + -*) shift ;; + *) break ;; + esac done -exit 1 +exec "$@" EOF chmod +x "$test_bin/systemd-run" @@ -67,14 +70,17 @@ run_invitation_hook [[ -f $test_home/.local/state/omarchy/done/fingerprint-setup-invitation ]] || fail "fingerprint invitation records completion" [[ -f $hook_path ]] || fail "fingerprint invitation keeps its hook installed" -[[ $(grep -c '^systemd-run:' "$log_file") -eq 1 ]] || fail "fingerprint invitation uses a durable user service" +[[ $(grep -c '^systemd-run:' "$log_file") -eq 2 ]] || fail "fingerprint invitation uses durable user services" grep -q -- '--user --collect --quiet --service-type=exec --unit=omarchy-fingerprint-setup-invitation' "$log_file" || fail "fingerprint invitation configures its user service" +# KillMode=process keeps the launcher's setsid child alive once the short-lived +# main process exits, otherwise the setup terminal never appears. +grep -q -- '--user --collect --quiet -p KillMode=process --unit=omarchy-setup-security-fingerprint ' "$log_file" || fail "fingerprint invitation outlives its launcher unit" [[ $(grep -c '^notification$' "$log_file") -eq 1 ]] || fail "fingerprint invitation sends one notification" [[ $(grep -c '^launch$' "$log_file") -eq 1 ]] || fail "fingerprint invitation handles the notification action" HOME="$test_home" PATH="$test_bin:$ROOT/bin:$PATH" TEST_LOG="$log_file" TEST_HW_MARKER="$hw_marker" bash "$hook_path" -[[ $(grep -c '^systemd-run:' "$log_file") -eq 1 ]] || fail "completed fingerprint invitation does not schedule again" +[[ $(grep -c '^systemd-run:' "$log_file") -eq 2 ]] || fail "completed fingerprint invitation does not schedule again" [[ $(grep -c '^notification$' "$log_file") -eq 1 ]] || fail "completed fingerprint invitation hook does not notify again" pass "fingerprint invitation waits for a reader and only runs once" diff --git a/test/shell.d/voxtype-invitation-test.sh b/test/shell.d/voxtype-invitation-test.sh index 827e4638..6038950f 100644 --- a/test/shell.d/voxtype-invitation-test.sh +++ b/test/shell.d/voxtype-invitation-test.sh @@ -32,10 +32,13 @@ cat >"$test_bin/systemd-run" <<'EOF' #!/bin/bash echo "systemd-run:$*" >>"$TEST_LOG" while (($# > 0)); do - [[ $1 == "bash" ]] && exec "$@" - shift + case $1 in + -p) shift 2 ;; + -*) shift ;; + *) break ;; + esac done -exit 1 +exec "$@" EOF chmod +x "$test_bin/systemd-run" @@ -48,15 +51,18 @@ run_invitation_hook [[ -f $test_home/.local/state/omarchy/done/voxtype-install-invitation ]] || fail "Voxtype invitation records completion" [[ -f $hook_path ]] || fail "Voxtype invitation keeps its hook installed" -[[ $(grep -c '^systemd-run:' "$log_file") -eq 1 ]] || fail "Voxtype invitation uses a durable user service" +[[ $(grep -c '^systemd-run:' "$log_file") -eq 2 ]] || fail "Voxtype invitation uses durable user services" grep -q -- '--user --collect --quiet --service-type=exec --unit=omarchy-voxtype-install-invitation' "$log_file" || fail "Voxtype invitation configures its user service" +# KillMode=process keeps the launcher's setsid child alive once the short-lived +# main process exits, otherwise the install terminal never appears. +grep -q -- '--user --collect --quiet -p KillMode=process --unit=omarchy-voxtype-install ' "$log_file" || fail "Voxtype invitation outlives its launcher unit" [[ $(grep -c '^notification$' "$log_file") -eq 1 ]] || fail "Voxtype invitation sends one notification" [[ $(grep -c '^launch$' "$log_file") -eq 1 ]] || fail "Voxtype invitation handles the notification action" HOME="$test_home" PATH="$test_bin:$ROOT/bin:$PATH" TEST_LOG="$log_file" bash "$hook_path" [[ -f $hook_path ]] || fail "completed Voxtype invitation keeps its hook installed" -[[ $(grep -c '^systemd-run:' "$log_file") -eq 1 ]] || fail "completed Voxtype invitation does not schedule again" +[[ $(grep -c '^systemd-run:' "$log_file") -eq 2 ]] || fail "completed Voxtype invitation does not schedule again" [[ $(grep -c '^notification$' "$log_file") -eq 1 ]] || fail "completed Voxtype invitation hook does not notify again" [[ $(grep -c '^launch$' "$log_file") -eq 1 ]] || fail "completed Voxtype invitation hook does not launch again"