From 5c9eeb707a0f34e2f64bad9ffc3b249a22eeef5c Mon Sep 17 00:00:00 2001 From: firestar5683 <168790843+firestar5683@users.noreply.github.com> Date: Thu, 5 Nov 2026 12:03:41 -0600 Subject: [PATCH] Queue model selections for the next onroad cycle --- .../starpilot/galaxy/tests/test_models.mjs | 9 +++++--- openpilot/starpilot/galaxy/web/js/models.js | 11 +++++----- openpilot/starpilot/models/manager.py | 8 ++++--- .../starpilot/models/tests/test_manager.py | 21 ++++++++++++------- openpilot/starpilot/ui/models_state.py | 9 +++++--- openpilot/starpilot/ui/tests/test_models.py | 7 +++++-- prebuilt.json | 2 +- 7 files changed, 43 insertions(+), 24 deletions(-) diff --git a/openpilot/starpilot/galaxy/tests/test_models.mjs b/openpilot/starpilot/galaxy/tests/test_models.mjs index de602dbd6f..72b0c71b57 100644 --- a/openpilot/starpilot/galaxy/tests/test_models.mjs +++ b/openpilot/starpilot/galaxy/tests/test_models.mjs @@ -142,7 +142,10 @@ assert.equal(modelActionAllowed(managerPayload, "download", missing), true) assert.equal(modelActionAllowed(managerPayload, "delete", big), false) assert.equal(modelActionAllowed({ ...managerPayload, activeBigModel: "" }, "delete", big), true) assert.equal(modelActionAllowed({ ...managerPayload, isOnroad: true }, "favorite", small), true) -assert.equal(modelActionAllowed({ ...managerPayload, isOnroad: true }, "select-small", small), false) +assert.equal(modelActionAllowed({ ...managerPayload, isOnroad: true }, "select-small", small), true) +assert.equal(modelActionAllowed({ ...managerPayload, isOnroad: true }, "select-big", big), true) +assert.equal(modelActionAllowed({ ...managerPayload, isOnroad: true, jetlinkBig: true }, "select-big", big), false) +assert.equal(modelActionAllowed({ ...managerPayload, isOnroad: true }, "download", missing), false) assert.equal(modelActionAllowed({ ...managerPayload, isOnroad: true, downloading: true }, "cancel"), true) assert.equal(modelActionAllowed({ ...managerPayload, capabilities: {} }, "favorite", small), false) assert.equal(fitsModelProfile({ ...small, profiles: ["small", "big"] }, "big"), true) @@ -239,7 +242,7 @@ await disabledRandomizer randomManagement.manager.stop() console.log('Randomizer and exclusion interactions passed') -assert.match(ModelsPage.template, /Park the vehicle before changing or downloading models/) +assert.match(ModelsPage.template, /Selections apply next onroad cycle/) assert.doesNotMatch(ModelsPage.template, /Onroad: switching/) assert.equal((ModelsPage.template.match(/class="gx-model-control"/g) || []).length, 2) assert.equal(ModelsPage.data().hardwareFilter, 'both') @@ -315,7 +318,7 @@ const refreshingCatalog = { ...managerPayload, downloading: true, refreshing: tr assert.equal(modelActionAllowed(refreshingCatalog, "select-small", small), true) assert.equal(modelActionAllowed(refreshingCatalog, "select-big", big), true) assert.equal(modelActionAllowed(refreshingCatalog, "select-big", missing), false) -assert.equal(modelActionAllowed({ ...refreshingCatalog, isOnroad: true }, "select-big", big), false) +assert.equal(modelActionAllowed({ ...refreshingCatalog, isOnroad: true }, "select-big", big), true) assert.equal(modelActionAllowed({ ...refreshingCatalog, randomizer: true }, "select-big", big), false) assert.equal(modelActionAllowed({ ...refreshingCatalog, refreshing: false }, "select-big", big), false) assert.equal(modelActionAllowed(refreshingCatalog, "delete", small), false) diff --git a/openpilot/starpilot/galaxy/web/js/models.js b/openpilot/starpilot/galaxy/web/js/models.js index a794e7bc07..b5ac4ccdc3 100644 --- a/openpilot/starpilot/galaxy/web/js/models.js +++ b/openpilot/starpilot/galaxy/web/js/models.js @@ -162,9 +162,10 @@ export function fitsModelProfile(model, profile) { export function modelActionAllowed(data, action, model = null) { if (!data || data.capabilities?.[actionCapabilities[action]] !== true) return false - if (data.isOnroad !== false && !["favorite", "unfavorite", "cancel"].includes(action)) return false + if (data.isOnroad !== false && !["favorite", "unfavorite", "cancel", "select-small", "select-big"].includes(action)) return false if (action === "jetlink") return data.jetlink !== undefined if (["select-small", "select-big"].includes(action)) { + if (action === "select-big" && data.jetlinkBig && data.isOnroad !== false) return false if (data.downloading && data.refreshing !== true || data.randomizer === true) return false if (action === "select-big" && model === null) return true // the manager marks what each Active can take: installed models, or under Jetlink a big one with an ONNX @@ -469,7 +470,7 @@ export const ModelsPage = { if (!this.disposed && result) { this.trackingProgress = ["download", "downloadAll", "refresh"].includes(action) this.message = (this.trackingProgress && this.status.progress) || result.message || - (action.startsWith("select-") ? "Selection saved for the next start." : "Saved.") + (action.startsWith("select-") ? "Selection saved for the next onroad cycle." : "Saved.") } } finally { if (!this.disposed) { this.pendingChoice = null; this.busy = "" } } }, @@ -485,7 +486,7 @@ export const ModelsPage = {
Manage models, downloads, and Jetlink connections.