From 1e79d379190036ba70c85213582a706012e65662 Mon Sep 17 00:00:00 2001 From: firestar5683 <168790843+firestar5683@users.noreply.github.com> Date: Wed, 1 Apr 2026 10:01:04 -0500 Subject: [PATCH] disable human likes --- common/params_keys.h | 2 +- system/manager/manager.py | 26 ++++++++++++++++++++++++++ system/manager/test/test_manager.py | 20 ++++++++++++++++++++ 3 files changed, 47 insertions(+), 1 deletion(-) diff --git a/common/params_keys.h b/common/params_keys.h index dc9aeae0..b8d289d1 100644 --- a/common/params_keys.h +++ b/common/params_keys.h @@ -282,7 +282,7 @@ inline static std::unordered_map keys = { {"HolidayThemes", {PERSISTENT, BOOL, "1", "0", 0}}, {"HumanAcceleration", {PERSISTENT, BOOL, "0", "0", 2}}, {"HumanFollowing", {PERSISTENT, BOOL, "0", "0", 2}}, - {"HumanLaneChanges", {PERSISTENT, BOOL, "1", "0", 2}}, + {"HumanLaneChanges", {PERSISTENT, BOOL, "0", "0", 2}}, {"IconPack", {PERSISTENT, STRING, "frog-animated", "stock", 0}}, {"IconToDownload", {CLEAR_ON_MANAGER_START, STRING, "", ""}}, {"IncreasedStoppedDistance", {PERSISTENT, FLOAT, "0.0", "0.0", 1}}, diff --git a/system/manager/manager.py b/system/manager/manager.py index 4ff71f49..e4001534 100755 --- a/system/manager/manager.py +++ b/system/manager/manager.py @@ -34,6 +34,7 @@ from openpilot.starpilot.common.starpilot_variables import ( LEGACY_BOLT_FP_MIGRATION_FLAG = Path("/data") / "legacy_bolt_fp_migration_v1" STARPILOT_DEFAULTS_PARITY_MIGRATION_FLAG = Path("/data") / "starpilot_defaults_parity_v1" +STARPILOT_HUMANLIKE_DISABLE_MIGRATION_FLAG = Path("/data") / "starpilot_humanlike_disable_v1" STARPILOT_PARAM_RENAME_MIGRATION_FLAG = Path("/data") / "starpilot_param_rename_v1" STARPILOT_PARAM_CANONICALIZATION_MIGRATION_FLAG = Path("/data") / "starpilot_param_canonicalization_v1" STARPILOT_PC_ROOT_MIGRATION_FLAG = Path("/data") / "starpilot_pc_root_v1" @@ -376,6 +377,30 @@ def migrate_starpilot_default_parity(params: Params, params_cache: Params) -> No cloudlog.exception(f"Failed to write migration flag: {STARPILOT_DEFAULTS_PARITY_MIGRATION_FLAG}") +def migrate_disable_humanlike_defaults(params: Params, params_cache: Params) -> None: + if STARPILOT_HUMANLIKE_DISABLE_MIGRATION_FLAG.exists(): + return + + disabled_keys: list[str] = [] + + for key in ("HumanAcceleration", "HumanFollowing", "HumanLaneChanges"): + if not (params.get_bool(key) or params_cache.get_bool(key)): + continue + + params.put_bool(key, False) + params_cache.put_bool(key, False) + disabled_keys.append(key) + + if disabled_keys: + cloudlog.warning(f"Applied one-time human-like toggle disable migration for {disabled_keys}") + + try: + STARPILOT_HUMANLIKE_DISABLE_MIGRATION_FLAG.parent.mkdir(parents=True, exist_ok=True) + STARPILOT_HUMANLIKE_DISABLE_MIGRATION_FLAG.write_text(f"{datetime.datetime.now(datetime.UTC).isoformat()}\n") + except Exception: + cloudlog.exception(f"Failed to write migration flag: {STARPILOT_HUMANLIKE_DISABLE_MIGRATION_FLAG}") + + def _read_raw_param_bytes(params: Params, key: str | bytes): try: path = params.get_param_path(key) @@ -542,6 +567,7 @@ def manager_init() -> None: # before bulk reads below to avoid repeated cast warnings and UI-side churn. migrate_param_type_canonicalization(params) migrate_starpilot_default_parity(params, params_cache) + migrate_disable_humanlike_defaults(params, params_cache) # set unset params to their default value for k in params.all_keys(): diff --git a/system/manager/test/test_manager.py b/system/manager/test/test_manager.py index 78796a4c..681ea578 100644 --- a/system/manager/test/test_manager.py +++ b/system/manager/test/test_manager.py @@ -164,6 +164,26 @@ class TestManager: assert Path(params.get_param_path("HumanFollowing")).is_file() assert not params.get_bool("HumanFollowing") + def test_migrate_disable_humanlike_defaults(self, tmp_path, monkeypatch): + monkeypatch.setattr(manager, "STARPILOT_HUMANLIKE_DISABLE_MIGRATION_FLAG", tmp_path / "starpilot_humanlike_disable_v1") + + params = FileBackedFakeParams(tmp_path / "params", { + "HumanAcceleration": True, + "HumanFollowing": True, + }) + params_cache = FileBackedFakeParams(tmp_path / "cache", { + "HumanLaneChanges": True, + }) + + manager.migrate_disable_humanlike_defaults(params, params_cache) + + assert not params.get_bool("HumanAcceleration") + assert not params.get_bool("HumanFollowing") + assert not params.get_bool("HumanLaneChanges") + assert not params_cache.get_bool("HumanAcceleration") + assert not params_cache.get_bool("HumanFollowing") + assert not params_cache.get_bool("HumanLaneChanges") + @pytest.mark.skip("this test is flaky the way it's currently written, should be moved to test_onroad") def test_clean_exit(self, subtests): """