Repository navigation
Report Bluetooth device failures and verify pairing - #14319
davidboulay wants to merge 1 commit into
Conversation
|
| timeout 10s bluetoothctl remove "$address" >/dev/null 2>&1 || true | ||
| # An already disconnected device can still be forgotten. | ||
| if device_has_state Connected; then | ||
| run_device_command 10s disconnect |
There was a problem hiding this comment.
| : >"$device_tmp/log" | ||
| rm -f "$POWERED_FILE.connected" | ||
| if PATH="$mock_bin:$ROOT/bin:$PATH" BLUETOOTHCTL_LOG="$device_tmp/log" MOCK_DEVICE_FAIL=connect \ | ||
| "$ROOT/bin/omarchy-bluetooth-device" connect AA:BB:CC:DD:EE:FF >"$device_tmp/error" 2>&1; then | ||
| fail "connection failure exits nonzero even when bluetoothctl exits zero" | ||
| fi | ||
| grep -q 'Bluetooth connect failed' "$device_tmp/log" || fail "connection failure notifies" | ||
| pass "connection failure is reported" |
There was a problem hiding this comment.
Forget flow lacks tests The new action tests cover pair and connect, but never exercise the changed disconnect or forget paths. Add cases for a disconnect failure during forget and for forgetting an already-disconnected device, so regressions in the new removal flow do not go unnoticed.
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!
|
I compared this with #7880 and #13811 on real hardware (ThinkPad T14 Gen 2a, Realtek, BLE mouse), applied onto 4.0.4 at The reporting works. With the pairing agent stopped, the pair failed with exit 1 and a "Bluetooth pair failed" notification, and the device was not left trusted. With the agent running it paired normally (2 runs). One problem is in the timeout path.
That body also stays in notification history, with other people's device addresses in it. Suggestions (untested):
Tested with help from Claude Code; every run was on my machine. |
|
Thanks for this. Reviewed at 91d98fb. It overlaps with an older open pull request, so it waits on the maintainer and was not run on a worker. Overlap. The part of this change that stops a failed pair from going on to trust and connect is also what #7880 (opened 2026-08-23) does, in the same lines of What this adds. Only this pull request tells the user. The panel starts the helper with Two defects, found by reading the source:
Also, the helper's check for output containing Who checked. I reviewed it (Claude Opus 5.5), with Codex Medium as the second opinion. Codex was given this pull request, #7880 and #11260 and asked which should win, without my answer. It picked #7880 for the same reason. The two defects above came from its review, and I confirmed both against the source. Its independence is not guaranteed. Next. This waits on the maintainer. Nothing is needed from you unless they ask for it. |
The panel launches omarchy-bluetooth-device with Quickshell.execDetached, so it never sees the helper's exit status or stderr: a failed pair now leaves the device retryable, but nothing says it failed. Notify instead, with a fixed message and a distinct one for the 20 second timeout, and exit 1 for anyone running it by hand. The message never carries bluetoothctl's output, which after a timeout is discovery chatter naming other nearby devices. Folded in from omacom#14319. Co-Authored-By: David Boulay <david.boulay@lojel.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Bluetooth device actions launched from the panel discard all errors and return success. A failed pairing still proceeds to trust and connect, leaving the user without an explanation.
This change reports failures through stderr and an Omarchy notification, returns nonzero, and stops the pairing sequence before trust/connect when pairing fails. It also catches bluetoothctl's printed failures when its exit status is zero, checks Paired and Connected state, and skips a redundant connection request when pairing already established the connection. Disconnect and forget failures are surfaced too; forgetting an already disconnected device still works.
Found while investigating an AirPods Pro pairing failure. Direct BlueZ pairing later succeeded, but the original failure's cause is not established; this PR addresses the confirmed suppressed-error behavior and does not replace the Bluetooth transport or add AirPods-specific handling.
Validation:
bash test/shell.d/bluetooth-test.shpassed, including regression coverage for pair failures with exit statuses 0, 1, and 124, unconfirmed pairing, already-connected pairing, and connection failure../test/clipassed.bash -n bin/omarchy-bluetooth-deviceandgit diff --checkpassed.