Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions default/systemd/user/bt-agent.service
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ Requires=dbus.socket

[Service]
Type=simple
# If bluetoothd is unavailable (for example in VMs or machines without a
# usable adapter), skip cleanly instead of entering a restart loop.
ExecCondition=/usr/bin/systemctl is-active --quiet bluetooth.service
# ExecCondition would skip permanently when it races bluetooth.service at
# login (#13247). Fail the start instead so Restart=on-failure retries until
# bluetoothd is up.
ExecStartPre=/usr/bin/systemctl is-active --quiet bluetooth.service

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Repeated starts when Bluetooth stays down If a machine has a Bluetooth adapter but bluetooth.service is masked or persistently failing, this check fails on every start attempt. The existing two-second restart interval then produces repeated failures and log entries instead of leaving the unit idle as ExecCondition did. Consider a backoff or a way to distinguish delayed startup from a service that will not start.

Knowledge Base Used: Desktop session and window management

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

# NoInputNoOutput auto-accepts pair requests. Safe because the adapter
# is only `pairable: true` when the user explicitly opens the omarchy
# bluetoothPanel and starts scanning; outside that window bluez refuses
Expand Down
5 changes: 4 additions & 1 deletion install/user/first-run/enable-user-units.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,15 @@ set -euo pipefail

systemctl --user daemon-reload
systemctl --user enable --now \
bt-agent.service \
owed.service \
omarchy-recover-internal-monitor.service \
omarchy-sleep-lock.service \
omarchy-migrate-notify.service \
omarchy-fcitx5.service \
omarchy-crash-watch.service

# bt-agent fails its start until bluetoothd is up and retries on its own, so
# don't wait on it.
systemctl --user enable --now --no-block bt-agent.service

omarchy-hook-install theme-set /usr/share/owe/10-owe-sync
7 changes: 5 additions & 2 deletions test/shell.d/systemd-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ source "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)/base-test.sh"

service="$ROOT/default/systemd/user/bt-agent.service"

grep -Fx 'ExecCondition=/usr/bin/systemctl is-active --quiet bluetooth.service' "$service" >/dev/null
pass "bt-agent skips when bluetooth.service is inactive"
grep -Fx 'ExecStartPre=/usr/bin/systemctl is-active --quiet bluetooth.service' "$service" >/dev/null
pass "bt-agent retries when bluetooth.service is not yet active"
Comment on lines +9 to +10

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Retry recovery remains untested This assertion checks that the pre-start command is present, but it does not test whether the agent starts after bluetooth.service changes from inactive to active. A test of that transition would protect the race fix; the current test could pass even if recovery stopped working.


grep -Fx 'Restart=on-failure' "$service" >/dev/null
pass "bt-agent still restarts after runtime failures"
Expand All @@ -31,6 +31,9 @@ grep -Fx 'systemctl --user daemon-reload' "$first_run_units" >/dev/null
grep -F 'omarchy-sleep-lock.service' "$first_run_units" >/dev/null
pass "first-run reloads and enables the sleep lock service"

grep -Fx 'systemctl --user enable --now --no-block bt-agent.service' "$first_run_units" >/dev/null
pass "first-run does not fail while bt-agent waits for bluetoothd"

upgrade_to_quattro="$ROOT/bin/omarchy-upgrade-to-quattro"
grep -F '6870b232a6c0474b59187882e6d25ae771bba735098bcbedef8a2b73b97e2b6a' "$upgrade_to_quattro" >/dev/null
grep -F 'bcd1a76cb5c63514922bc5e11af22ae480fc6d06a99863364e02bdf3c7bdceaf' "$upgrade_to_quattro" >/dev/null
Expand Down