From 34f4aadca5491ffb9396061cf6e1152ec48bc046 Mon Sep 17 00:00:00 2001 From: James Vecellio-Grant <159560811+Discountchubbs@users.noreply.github.com> Date: Fri, 15 Aug 2025 07:42:56 -0700 Subject: [PATCH] ci: enforce runner cutoff above 9.0V threshold (#1156) * ci: github runner auto off when voltage is above 9.0v . This ensures that a runner in vehicle doesn't accidentally break everything lol. * suggestion for clarity. * refactor: rename and update handling of `GithubRunnerVoltage` parameter - Improve clarity by renaming to `GithubRunnerSufficientVoltage`. - Changed attribute to `CLEAR_ON_MANAGER_START` for improved runtime state management. - No need for this value to be backed up! * refactor: streamline voltage check for GithubRunnerSufficientVoltage --------- Co-authored-by: DevTekVE --- common/params_keys.h | 1 + system/hardware/hardwared.py | 5 +++++ system/manager/process_config.py | 3 ++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/common/params_keys.h b/common/params_keys.h index 08f79bf5a..1822ebabb 100644 --- a/common/params_keys.h +++ b/common/params_keys.h @@ -147,6 +147,7 @@ inline static std::unordered_map keys = { {"CustomAccShortPressIncrement", {PERSISTENT | BACKUP, INT, "1"}}, {"DeviceBootMode", {PERSISTENT | BACKUP, INT, "0"}}, {"EnableGithubRunner", {PERSISTENT | BACKUP, BOOL}}, + {"GithubRunnerSufficientVoltage", {CLEAR_ON_MANAGER_START , BOOL}}, {"InteractivityTimeout", {PERSISTENT | BACKUP, INT, "0"}}, {"IsDevelopmentBranch", {CLEAR_ON_MANAGER_START, BOOL}}, {"MaxTimeOffroad", {PERSISTENT | BACKUP, INT, "1800"}}, diff --git a/system/hardware/hardwared.py b/system/hardware/hardwared.py index 8cde33592..d702334fa 100755 --- a/system/hardware/hardwared.py +++ b/system/hardware/hardwared.py @@ -382,6 +382,11 @@ def hardware_thread(end_event, hw_queue) -> None: # Offroad power monitoring voltage = None if peripheralState.pandaType == log.PandaState.PandaType.unknown else peripheralState.voltage + + # GitHub runner auto off: 9V is used as the threshold because most desktop runners + # will rarely exceed 5V so 9V is set as our buffer between desk use and car use. + params.put_bool_nonblocking("GithubRunnerSufficientVoltage", ((voltage or 0) and voltage > 9000)) + power_monitor.calculate(voltage, onroad_conditions["ignition"]) msg.deviceState.offroadPowerUsageUwh = power_monitor.get_power_used() msg.deviceState.carBatteryCapacityUwh = max(0, power_monitor.get_car_battery_capacity()) diff --git a/system/manager/process_config.py b/system/manager/process_config.py index a9579546b..67a77caa2 100644 --- a/system/manager/process_config.py +++ b/system/manager/process_config.py @@ -62,7 +62,8 @@ def only_offroad(started: bool, params: Params, CP: car.CarParams) -> bool: return not started def use_github_runner(started, params, CP: car.CarParams) -> bool: - return not PC and params.get_bool("EnableGithubRunner") and not params.get_bool("NetworkMetered") + return not PC and params.get_bool("EnableGithubRunner") and ( + not params.get_bool("NetworkMetered") and not params.get_bool("GithubRunnerSufficientVoltage")) def sunnylink_ready_shim(started, params, CP: car.CarParams) -> bool: """Shim for sunnylink_ready to match the process manager signature."""