From 4f46433e2bc432e85eeb2bb78aaa93dfc723f885 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Sat, 22 Aug 2026 10:20:06 -0400 Subject: [PATCH] alerts: add branch metadata to chestnut offroad warning (#1936) * alerts: add branch metadata to chestnut offroad warning * all branches --- openpilot/common/version.py | 9 +++++++++ openpilot/selfdrive/selfdrived/alerts_offroad.json | 2 +- openpilot/system/hardware/hardwared.py | 8 ++++++-- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/openpilot/common/version.py b/openpilot/common/version.py index f1514aa3cd..0456782c05 100755 --- a/openpilot/common/version.py +++ b/openpilot/common/version.py @@ -16,6 +16,15 @@ MASTER_SP_BRANCHES = ['master'] RELEASE_BRANCHES = ['release-tizi-staging', 'release-mici-staging', 'release-tizi', 'release-mici', 'nightly'] TESTED_BRANCHES = RELEASE_BRANCHES + ['devel-staging', 'nightly-dev'] + RELEASE_SP_BRANCHES + TESTED_SP_BRANCHES +CHESTNUT_BRANCHES = { + "staging": "staging-chestnut", + "dev": "dev-chestnut", + "release-mici": "release-chestnut", + "release-tizi": "release-chestnut", + "release-mici-staging": "release-chestnut-staging", + "release-tizi-staging": "release-chestnut-staging", +} + SP_BRANCH_MIGRATIONS = { ("tici", "staging-c3-new"): "staging-tici", ("tici", "dev-c3-new"): "staging-tici", diff --git a/openpilot/selfdrive/selfdrived/alerts_offroad.json b/openpilot/selfdrive/selfdrived/alerts_offroad.json index 226be06683..91a7ec8ab3 100644 --- a/openpilot/selfdrive/selfdrived/alerts_offroad.json +++ b/openpilot/selfdrive/selfdrived/alerts_offroad.json @@ -18,7 +18,7 @@ "_comment": "Set extra field to the failed reason." }, "Offroad_ChestnutBranch": { - "text": "Chestnut detected! Switch to the release-chestnut branch to use chestnut-class models.", + "text": "Chestnut detected! Switch to the %1 branch to use chestnut-class models.", "severity": 0 }, "Offroad_UnregisteredHardware": { diff --git a/openpilot/system/hardware/hardwared.py b/openpilot/system/hardware/hardwared.py index 3c22f1cbd7..8aed8be5b9 100755 --- a/openpilot/system/hardware/hardwared.py +++ b/openpilot/system/hardware/hardwared.py @@ -27,7 +27,7 @@ from openpilot.common.swaglog import cloudlog from openpilot.sunnypilot.system.statsd import statlog from openpilot.system.hardware.power_monitoring import PowerMonitoring from openpilot.system.hardware.fan_controller import FanController -from openpilot.common.version import terms_version, training_version, get_build_metadata, terms_version_sp +from openpilot.common.version import terms_version, training_version, get_build_metadata, terms_version_sp, CHESTNUT_BRANCHES ThermalStatus = log.DeviceState.ThermalStatus @@ -301,7 +301,11 @@ def hardware_thread(end_event, hw_queue) -> None: set_usb_state(msg.deviceState, last_hw_state.usb_state) chestnut.update(started_ts is None, last_hw_state.usb_state) - set_offroad_alert_if_changed("Offroad_ChestnutBranch", msg.deviceState.chestnutPresent and not big_model_available) + current_channel = get_build_metadata().channel + chestnut_target = CHESTNUT_BRANCHES.get(current_channel) + chestnut_needs_switch = msg.deviceState.chestnutPresent and not big_model_available and chestnut_target is not None + set_offroad_alert_if_changed("Offroad_ChestnutBranch", chestnut_needs_switch, + extra_text=chestnut_target if chestnut_needs_switch else None) # this subset is only used for offroad temp_sources = [