From 549a28fa9fea4894e50e7f1c80317a5598d41f0b Mon Sep 17 00:00:00 2001 From: firestar5683 <168790843+firestar5683@users.noreply.github.com> Date: Sat, 21 Nov 2026 23:54:09 -0600 Subject: [PATCH] Fix AGNOS staging expectations and restore source size limits --- openpilot/selfdrive/car/card.py | 16 ++-------------- openpilot/starpilot/ui/feature_settings_owner.py | 6 ++---- .../system/updated/tests/test_retained_agnos.py | 9 ++++++--- prebuilt.json | 2 +- 4 files changed, 11 insertions(+), 22 deletions(-) diff --git a/openpilot/selfdrive/car/card.py b/openpilot/selfdrive/car/card.py index 7c1dfee29b..cb815eb9ce 100644 --- a/openpilot/selfdrive/car/card.py +++ b/openpilot/selfdrive/car/card.py @@ -186,7 +186,6 @@ class Car: self.switchback_event_sequence = 0 publish_services = ['sendcan', 'carState', 'carParams', 'carOutput', 'radarTracks', 'starpilotCarState'] self.car_gps_publisher = CarGpsPublisher() - # One existing event channel also carries source-qualified Switchback gestures. publish_services.append('slcCruiseEvent') self.wheel_publisher = WheelPublisher(self.params) self.wheel_commands = () @@ -242,7 +241,6 @@ class Car: self.pm.sock['aolIntentWire'] = messaging.pub_sock('aolIntentWire') if CI is None: - # wait for one pandaState and one CAN packet print("Waiting for CAN messages...") while True: can = messaging.recv_one_retry(self.can_sock) @@ -325,7 +323,6 @@ class Car: self.RI = interfaces[self.CI.CP.carFingerprint].RadarInterface(self.CI.CP) self.CP = self.CI.CP - # continue onto next fingerprinting step in pandad self.params.put_bool("FirmwareQueryDone", True, block=True) else: self.CI, self.CP = CI, CI.CP @@ -364,7 +361,6 @@ class Car: self.vehicle_startup.configure(self.CI) if self.CP.secOcRequired: - # Copy user key if available try: with open("/cache/params/SecOCKey") as f: user_key = f.readline().strip() @@ -457,7 +453,6 @@ class Car: if not self.ioniq6_previous_cp_saved: self.save_previous_car_params() - # Write CarParams for controls and radard self.vehicle_startup.seal_publication() cp_bytes = self.CP.to_bytes() from openpilot.starpilot.car.tesla.pedal_startup import install as install_preap_pedal @@ -532,7 +527,6 @@ class Car: can_received_ns = time.monotonic_ns() can_list = can_capnp_to_list(can_strs) - # Update carState from CAN observe_controller_can(self.CI, can_list) CS = self.CI.update(can_list) self.RI.v_ego = CS.vEgo # the Honda Bosch-A decoder bounds a reversing coast with it @@ -550,8 +544,7 @@ class Car: distance_owner = getattr(self, 'gm_distance', None) distance_observation = distance_owner.update(can_list) if distance_owner is not None else None - # Direct state_update callers retain eager radar behavior. The production - # loop consumes this exact CAN batch after carState and control publication. + # Direct callers run radar eagerly. The loop runs it after control publication. self._deferred_radar_can = can_list if defer_radar else None RD = None if defer_radar else self.radar_update(can_list) @@ -561,7 +554,6 @@ class Car: can_rcv_valid = len(can_strs) > 0 - # Check for CAN timeout if not can_rcv_valid: self.can_rcv_cum_timeout_counter += 1 @@ -1084,7 +1076,6 @@ class Car: self.pm.send('carParams', cp_send) self.car_params_published = True - # publish new carOutput co_send = messaging.new_message('carOutput') co_send.valid = self.sm.all_checks(['carControl']) co_send.carOutput.actuatorsOutput = self.last_actuators_output @@ -1415,8 +1406,7 @@ class Car: holder = getattr(self, 'vehicle_startup', None) if holder is None or holder.owner is None: return - # Python controls and receive times use MONOTONIC. Panda/CAN producers - # use BOOTTIME, which can diverge after suspend. + # MONOTONIC controls time can diverge from Panda BOOTTIME after suspend. clocks = clock_pair_ns() mono_ns, boot_ns = clocks if clocks is not None else (0, 0) sm = self.sm @@ -1819,7 +1809,6 @@ class Car: self.ioniq6_restore_callbacks = self.can_callbacks elif self.vehicle_startup.owner is None: self.CI.init(self.CP, *self.can_callbacks) - # signal pandad to switch to car safety mode self.params.put_bool("ControlsReady", True) self.ci_initialized = True @@ -1910,7 +1899,6 @@ class Car: return steering_authority = getattr(self.CI.CS, 'steering_authority', None) monitored_steering = self.CP.brand == 'gm' and steering_authority is not None and steering_authority.enabled - # send car controls over can now_nanos = (self.volt_cc_now_boot_ns if getattr(self, 'volt_cc_selected', False) else self.can_log_mono_time if REPLAY else time.clock_gettime_ns(time.CLOCK_BOOTTIME) if self.volt_startup_keepalive() or monitored_steering else diff --git a/openpilot/starpilot/ui/feature_settings_owner.py b/openpilot/starpilot/ui/feature_settings_owner.py index f15197f374..7bbefa7267 100644 --- a/openpilot/starpilot/ui/feature_settings_owner.py +++ b/openpilot/starpilot/ui/feature_settings_owner.py @@ -620,8 +620,7 @@ class FeatureSettingsOwner: return value, value is not None and 0.0 <= value <= 100.0, canonical, legacy def _read_saved(self, key: str, limit: int) -> tuple[bytes | None, bool]: - # One assembly observes one complete source per key. Actions and the next - # assembly always read the filesystem again, including unreadable sources. + # Cache source reads only within each snapshot. reads = self._snapshot_reads.get() def read(): try: @@ -1436,8 +1435,7 @@ class FeatureSettingsOwner: def apply(self, request: FeatureSettingsRequest, *, reset_default: bool = False) -> bool: if reset_default and not self.authority("parked_preferences"): return False - # A request may arrive through a callback during assembly. Its compare and - # authorization checks must still observe current sources independently. + # Recheck live sources even from snapshot callbacks. token = self._snapshot_reads.set(None) vehicle_token = self._snapshot_vehicle.set(None) try: diff --git a/openpilot/system/updated/tests/test_retained_agnos.py b/openpilot/system/updated/tests/test_retained_agnos.py index 1043442e62..aa24a10531 100644 --- a/openpilot/system/updated/tests/test_retained_agnos.py +++ b/openpilot/system/updated/tests/test_retained_agnos.py @@ -195,7 +195,10 @@ class TestRetainedAgnos(unittest.TestCase): def test_legacy_staging_defers_to_the_new_hardware_aware_launcher(self): source = (ROOT / 'launch_env.sh').read_text() - for version in ('19.8.1', '19.8.2', '20.2.1', '20.5.2', '20.5.3'): + match = re.search(r'^ export AGNOS_VERSION="([^"]+)"$', source, re.MULTILINE) + assert match is not None + target = match[1] + for version in dict.fromkeys(('19.8.1', '19.8.2', '20.2.1', '20.5.2', '20.5.3', target)): with self.subTest(version=version): installed = self.root / 'VERSION' installed.write_text(version + '\n') @@ -205,8 +208,8 @@ class TestRetainedAgnos(unittest.TestCase): f'source {shlex.quote(str(environment))}\n' + \ 'printf "%s\\n%s\\n%s\\n" "$AGNOS_VERSION" "$AGNOS_ACCEPTED_VERSIONS" "$AGNOS_UPDATE_POLICY"' required, accepted, policy = subprocess.check_output(['bash', '-c', script], text=True).splitlines() - self.assertIn(version, accepted.split()) - self.assertEqual(required, '20.5.3') + self.assertEqual(accepted.split(), [target, version]) + self.assertEqual(required, target) self.assertEqual(policy, 'auto') def test_runtime_still_requires_upgrade_when_legacy_staging_accepts_old_os(self): diff --git a/prebuilt.json b/prebuilt.json index 216c3c871e..c868607b3b 100644 --- a/prebuilt.json +++ b/prebuilt.json @@ -1 +1 @@ -{"protected_inventory_sha256": "c454452ab3886acf6be36a19dee5d8fa00c870d7ba56568c0f1db8fbb77a3bb9", "schema_version": 1} +{"protected_inventory_sha256": "de920ac446bf22ba7a0c487adfe7dab309c5cf86450f8bb3f2464b241411a196", "schema_version": 1}