fix: expose 'active_no_data' health status for hijacked/silent audio devices#3326
Merged
Merged
Conversation
…devices Fixes #3144 ## Problem When a Bluetooth audio device (e.g. AirPods) is hijacked by another app or becomes silent, the zero-fill watchdog detects this and triggers an automatic reconnect after 30 seconds. However, the health endpoint still reports the device as 'ok', making it impossible for users or the UI to know there's an issue until the watchdog fires. ## Root cause The health check didn't distinguish between a device that is: - Actively capturing audio (ok) - Active but producing no data due to hijack (active_no_data) The watchdog already tracks these hijack/silence events in the stream_timeouts metric, but this wasn't surfaced in the health status. ## Fix Add logic to detect stream_hijacked condition (stream_timeouts > 0) and report 'active_no_data' status instead of 'ok'. This allows: 1. Users/UI to see the device is degraded while recovering 2. Better diagnostics of transient Bluetooth issues 3. Clearer distinction in logs and monitoring The watchdog will automatically trigger a reconnect; this just makes the transient state visible. ## Verification (Tier T1) - New unit test: `audio_status_active_no_data_when_stream_timeouts_nonzero` - All existing health check tests pass - cargo test --lib -p screenpipe-engine health: 3/3 tests pass
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When a Bluetooth audio device (e.g. AirPods) is hijacked by another app or becomes silent, the zero-fill watchdog detects this and triggers an automatic reconnect after 30 seconds. However, the health endpoint still reports the device as 'ok', making it impossible for users or the UI to know there's an issue until the watchdog fires.
Root cause
The health check didn't distinguish between a device that is:
ok)active_no_data)The watchdog already tracks these hijack/silence events in the
stream_timeoutsmetric, but this wasn't surfaced in the health status.Fix
Add logic to detect
stream_hijackedcondition (stream_timeouts > 0) and reportactive_no_datastatus instead ofok. This allows:The watchdog will automatically trigger a reconnect; this just makes the transient state visible.
Changes
stream_hijackedcheck in health.rs usingstream_timeouts > 0active_no_datawhen hijack detectedConfidence: 8/10
Verification (Tier T1)
Test output:
Sources (multi-source)
Fixes #3144
auto-generated by issue-solver pipe