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 centrally when WebGPU removal leaves active unusable
Barack Sokullua54103d61e84
diff --git a/src/chrome/src/providers/manager.js b/src/chrome/src/providers/manager.jsindex a330307cf..7f3a60eb0 100644--- a/src/chrome/src/providers/manager.js+++ b/src/chrome/src/providers/manager.js@@ -1794,7 +1794,26 @@ export class ProviderManager {}async stopWebgpuDownload(msg) {- return this._webgpuProvider().stopDownload(msg);+ const result = await this._webgpuProvider().stopDownload(msg);+ // Removing the model (from Settings, Apocalypse Mode, or any other+ // surface) while WebGPU is selected would leave chats failing readiness.+ // Fall back centrally so the active selection stays usable without each+ // UI having to change the global provider (Apocalypse must not do so).+ if (this.activeProviderId === 'webgpu') {+ try {+ const currentModel = this.providers.get('webgpu')?.config?.model;+ const status = await this._webgpuProvider().downloadStatus({ model: currentModel }).catch(() => null);+ if (status && status.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;+ await this.save();+ }+ } catch {+ // Keep the selection; chat will report the missing download.+ }+ }+ return result;}/**diff --git a/test/run.js b/test/run.jsindex 505ff720e..cbd9a38bf 100644--- a/test/run.js+++ b/test/run.js@@ -62540,6 +62540,13 @@ test('Chrome exposes separate endpoint-free WebGPU text and vision providers', aawait 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;+ manager.activeProviderId = 'webgpu';+ textModelReady = false;+ const stopProbeBase = sentMessages.length;+ await manager.stopWebgpuDownload({ model: WEBGPU_COMPASS_TINY_V2_MODEL_ID });+ assert.equal(manager.activeProviderId, 'webbrain_cloud', 'removing the active WebGPU model must fall back centrally so Apocalypse removal stays usable');+ sentMessages.length = stopProbeBase;+ textModelReady = true;const provider = await manager.getLocalVisionFallbackProvider();assert.ok(provider instanceof WebGPUVisionProvider);