From 008432a687265cb7f1b989f74f26b0074d01f3b1 Mon Sep 17 00:00:00 2001 From: Roo Code Date: Tue, 28 Oct 2025 07:34:54 +0000 Subject: [PATCH] fix: migrate deprecated code-supernova model ID to code-supernova-1-million - Add model ID migration logic in RooHandler.getModel() to automatically convert the deprecated 'roo/code-supernova' model ID to 'roo/code-supernova-1-million' - Add comprehensive test coverage for the migration logic - Fixes #8880 where users get 404 errors when using the old model ID --- src/api/providers/__tests__/roo.spec.ts | 27 +++++++++++++++++++++++++ src/api/providers/roo.ts | 12 ++++++++++- 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/src/api/providers/__tests__/roo.spec.ts b/src/api/providers/__tests__/roo.spec.ts index cd1ab33301..dd4eb32fc1 100644 --- a/src/api/providers/__tests__/roo.spec.ts +++ b/src/api/providers/__tests__/roo.spec.ts @@ -368,6 +368,33 @@ describe("RooHandler", () => { expect(modelInfo.info.contextWindow).toBeDefined() } }) + + it("should migrate deprecated code-supernova model ID to code-supernova-1-million", () => { + const handlerWithDeprecatedModel = new RooHandler({ + apiModelId: "roo/code-supernova", + }) + const modelInfo = handlerWithDeprecatedModel.getModel() + // Should return the migrated model ID + expect(modelInfo.id).toBe("roo/code-supernova-1-million") + expect(modelInfo.info).toBeDefined() + }) + + it("should not migrate non-deprecated model IDs", () => { + const testCases = [ + "roo/code-supernova-1-million", // Already migrated + "xai/grok-code-fast-1", // Different model + "roo/sonic", // Different model + "unknown-model", // Unknown model + ] + + for (const modelId of testCases) { + const handlerWithModel = new RooHandler({ apiModelId: modelId }) + const modelInfo = handlerWithModel.getModel() + // Should return the same model ID without migration + expect(modelInfo.id).toBe(modelId) + expect(modelInfo.info).toBeDefined() + } + }) }) describe("temperature and model configuration", () => { diff --git a/src/api/providers/roo.ts b/src/api/providers/roo.ts index 3bd1bb65dc..68a84edea3 100644 --- a/src/api/providers/roo.ts +++ b/src/api/providers/roo.ts @@ -210,7 +210,17 @@ export class RooHandler extends BaseOpenAiCompatibleProvider { } override getModel() { - const modelId = this.options.apiModelId || rooDefaultModelId + let modelId = this.options.apiModelId || rooDefaultModelId + + // Migrate deprecated model IDs to their new versions + const modelMigrations: Record = { + "roo/code-supernova": "roo/code-supernova-1-million", + } + + // Apply migration if needed + if (modelMigrations[modelId]) { + modelId = modelMigrations[modelId] + } // Get models from shared cache const models = getModelsFromCache("roo") || {}