From de97a6eff336a472357660cfb91ea0fb877ff28c Mon Sep 17 00:00:00 2001 From: firestar5683 <168790843+firestar5683@users.noreply.github.com> Date: Sun, 25 Oct 2026 15:09:51 -0500 Subject: [PATCH] Resume Auto Learn discovery when the road regime changes --- openpilot/starpilot/flm/live_tracking.py | 5 +++- .../flm/tests/test_tracking_source_context.py | 30 +++++++++++++++++++ prebuilt.json | 2 +- 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/openpilot/starpilot/flm/live_tracking.py b/openpilot/starpilot/flm/live_tracking.py index bc1539bf76..41e59d87e8 100644 --- a/openpilot/starpilot/flm/live_tracking.py +++ b/openpilot/starpilot/flm/live_tracking.py @@ -738,9 +738,12 @@ class LiveTrackingOptimizer: # that maneuver ends. Three unmatched whole windows release it by # source time alone, without inspecting any tracking outcomes. No # incomplete comparison can confirm or persist a target. + # Before launch, source-only discovery follows the current input regime. + # Waiting three unmatched windows also suppresses native discovery + # throughout a new short curve. No live trial or scored row is accepted. last_match = self.comparison[-1].end_ns if self.comparison else self.discovery['selected_end_ns'] if (not _matches(self.discovery['anchor'], episode) - and episode.end_ns - last_match >= 3 * (episode.end_ns - episode.start_ns)): + and (self.rmse is None or episode.end_ns - last_match >= 3 * (episode.end_ns - episode.start_ns))): self._discard_selector() if self.discovery is not None: discovery = self.discovery diff --git a/openpilot/starpilot/flm/tests/test_tracking_source_context.py b/openpilot/starpilot/flm/tests/test_tracking_source_context.py index e44c58cdba..4d2deeadb9 100644 --- a/openpilot/starpilot/flm/tests/test_tracking_source_context.py +++ b/openpilot/starpilot/flm/tests/test_tracking_source_context.py @@ -444,3 +444,33 @@ def test_fitted_plant_does_not_reverse_identified_direction_at_boundary(): fitted_refresh(o, e.end_ns) o.observe_episode(e, now_ns=e.end_ns) assert o.discovery is None and o.offer_state is None + + +@pytest.mark.parametrize('source_only', [False, True]) +def test_new_input_regime_retires_only_source_discovery_before_launch(source_only): + from openpilot.starpilot.flm.tests.test_live_tracking import optimizer, refresh as fitted_refresh + + o = owner() if source_only else optimizer() + update = refresh if source_only else fitted_refresh + for i in range(40): + e = episode(o, i, 'center_taper_max', kind='subtle') + if source_only: + e = replace(e, normalization_accel=max(0.1, e.goal_rms)) + update(o, e.end_ns) + o.observe_episode(e, now_ns=e.end_ns) + if o.discovery is not None: + break + previous = o.discovery + assert previous is not None and o.offer_state is None + changed = episode(o, i + 1, 'center_taper_max', kind='large') + if source_only: + changed = replace(changed, normalization_accel=max(0.1, changed.goal_rms)) + update(o, changed.end_ns) + o.observe_episode(changed, now_ns=changed.end_ns) + assert (o.discovery is None) is source_only + if source_only: + assert o.selector_hint is None and not o.comparison + assert o.baseline[-1].episode_id == changed.episode_id + else: + assert o.discovery == previous + assert o.offer_state is None and not any(o.accepted.values()) diff --git a/prebuilt.json b/prebuilt.json index daa13ae6cb..0fd10ea9c8 100644 --- a/prebuilt.json +++ b/prebuilt.json @@ -1 +1 @@ -{"protected_inventory_sha256": "da94b10aa940d202e229d8fb1e36321191a7aa2de68541fd8b2f19c6816bd876", "schema_version": 1} +{"protected_inventory_sha256": "65c1ade33b6f8f0712469790e4a2a6dc87f09c55a3253c1ee581bf9dba11d884", "schema_version": 1}