From 36e0e370866e35b19d9937bbae97a1dc82aa06ae Mon Sep 17 00:00:00 2001 From: firestar5683 <168790843+firestar5683@users.noreply.github.com> Date: Sun, 1 Nov 2026 16:54:44 -0600 Subject: [PATCH] Keep driving independent of UI restarts --- openpilot/selfdrive/selfdrived/selfdrived.py | 2 +- .../selfdrived/tests/test_process_health.py | 21 ++++++++++++++++++- prebuilt.json | 2 +- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/openpilot/selfdrive/selfdrived/selfdrived.py b/openpilot/selfdrive/selfdrived/selfdrived.py index 64ff6bd0f8..36bf943049 100755 --- a/openpilot/selfdrive/selfdrived/selfdrived.py +++ b/openpilot/selfdrive/selfdrived/selfdrived.py @@ -260,7 +260,7 @@ class SelfdriveD: self.events.add(EventName.dashcamMode, static=True) def update_process_health(self) -> bool: - not_running = driving_process_failures(self.sm['managerState'].processes) + not_running = driving_process_failures(self.sm['managerState'].processes) - {'ui'} if self.sm.recv_frame['managerState'] and not_running: if not_running != self.not_running_prev: cloudlog.event("process_not_running", not_running=not_running, error=True) diff --git a/openpilot/selfdrive/selfdrived/tests/test_process_health.py b/openpilot/selfdrive/selfdrived/tests/test_process_health.py index f4d67f2145..26a3550ca8 100644 --- a/openpilot/selfdrive/selfdrived/tests/test_process_health.py +++ b/openpilot/selfdrive/selfdrived/tests/test_process_health.py @@ -25,7 +25,7 @@ def process_health(processes): return drive -@pytest.mark.parametrize('name', ['starportd', 'galaxy_hotspot', 'jetlinkd']) +@pytest.mark.parametrize('name', ['starportd', 'galaxy_hotspot', 'jetlinkd', 'ui']) @pytest.mark.parametrize('running,requested', [(False, False), (False, True), (True, True)]) def test_optional_lifecycle_does_not_block_engagement(name, running, requested): drive = process_health([(name, running, requested)]) @@ -69,3 +69,22 @@ def test_missing_starport_service_does_not_block_engagement(): state = StateMachine() state.update(drive.events) assert state.state == log.SelfdriveState.OpenpilotState.enabled + + +@pytest.mark.parametrize('critical', ['controlsd', 'selfdrived', 'pandad', 'modeld', 'card', 'camerad', 'soundd', 'unknown_service']) +def test_ui_restart_does_not_hide_driving_failure(critical): + drive = process_health([('ui', False, True), (critical, False, True)]) + assert drive.update_process_health() + assert drive.not_running_prev == {critical} + assert drive.events.contains(ET.SOFT_DISABLE) + + +def test_ui_restart_preserves_enabled_state_without_warning(): + drive = process_health([('ui', False, True), ('controlsd', True, True), ('selfdrived', True, True)]) + assert not drive.update_process_health() + state = StateMachine() + state.state = log.SelfdriveState.OpenpilotState.enabled + state.update(drive.events) + assert state.state == log.SelfdriveState.OpenpilotState.enabled + assert not drive.events.contains(ET.SOFT_DISABLE) + assert not drive.events.contains(ET.IMMEDIATE_DISABLE) diff --git a/prebuilt.json b/prebuilt.json index d36e0c962e..bd0848bb53 100644 --- a/prebuilt.json +++ b/prebuilt.json @@ -1 +1 @@ -{"protected_inventory_sha256": "c11fbe2409cae4ba5c1fc311a5715d93588886e26625717f7bc2997a0557d680", "schema_version": 1} +{"protected_inventory_sha256": "76719de784909665231700c43e3485008e4c0e0f8361b273ffac4e9c09d262bd", "schema_version": 1}