Open-source AI browser agent for Chrome and Firefox (monorepo) ðŸ§
JavaScript ai-agentai-agentsai-toolsbrowser-aibrowser-automationbrowser-extensionchrome-aichrome-devtoolschrome-extensionchrome-extensionsfirefox-addonfirefox-addonsfirefox-extensionfirefox-extensionsgemmagemma4minimaxoffline-aioffline-llmqwen
fix: fall back from active WebGPU when model edits leave it undownloaded
Barack Sokullu464027722d12
diff --git a/src/chrome/src/providers/manager.js b/src/chrome/src/providers/manager.jsindex 756390f9f..a330307cf 100644--- a/src/chrome/src/providers/manager.js+++ b/src/chrome/src/providers/manager.js@@ -1893,6 +1893,21 @@ export class ProviderManager {}}this.providers.set(id, this._createProvider(id, merged));+ // Editing the model of the active WebGPU provider to an undownloaded+ // target would leave every chat failing readiness (setActive() guards+ // selection but not edits). Fall back so the active selection stays usable.+ if (id === 'webgpu' && this.activeProviderId === 'webgpu' && Object.hasOwn(updates, 'model')) {+ try {+ const download = await this.providers.get('webgpu')?.downloadStatus?.();+ if (download && download.ready !== true) {+ this.activeProviderId = this.providers.has(WEBBRAIN_CLOUD_PROVIDER_ID)+ ? WEBBRAIN_CLOUD_PROVIDER_ID+ : [...this.providers.keys()].find((candidate) => candidate !== 'webgpu') || WEBBRAIN_CLOUD_PROVIDER_ID;+ }+ } catch {+ // Probe failures must not block saving; chat will report the missing download.+ }+ }await this.save();}diff --git a/test/run.js b/test/run.jsindex a48f1299f..9fa98daca 100644--- a/test/run.js+++ b/test/run.js@@ -62530,6 +62530,16 @@ test('Chrome exposes separate endpoint-free WebGPU text and vision providers', aassert.equal(manager.getAll().webgpu.dtype, WEBGPU_DTYPE, 'switching from Bonsai to a custom ONNX model must reset the stale q1 dtype');await manager.updateProvider('webgpu', { model: WEBGPU_COMPASS_TINY_V2_MODEL_ID });assert.equal(manager.getAll().webgpu.dtype, WEBGPU_DTYPE, 'switching to the Compass preset must restore q4f16');+ manager.activeProviderId = 'webgpu';+ textModelReady = false;+ const fallbackProbeBase = sentMessages.length;+ await manager.updateProvider('webgpu', { model: 'custom-owner/undownloaded-model' });+ assert.equal(manager.activeProviderId, 'webbrain_cloud', 'editing the active WebGPU model to an undownloaded target must fall back to a usable provider');+ textModelReady = true;+ manager.activeProviderId = 'webgpu';+ await manager.updateProvider('webgpu', { model: WEBGPU_COMPASS_TINY_V2_MODEL_ID });+ assert.equal(manager.activeProviderId, 'webgpu', 'editing the active WebGPU model to a ready target must keep the selection');+ sentMessages.length = fallbackProbeBase;const provider = await manager.getLocalVisionFallbackProvider();assert.ok(provider instanceof WebGPUVisionProvider);