Skip to content

Commit 8a7d90e

Browse files
authored
Upgrade Supernova (#8330)
1 parent 5e218fe commit 8a7d90e

File tree

22 files changed

+195
-24
lines changed

22 files changed

+195
-24
lines changed

packages/types/src/providers/roo.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { ModelInfo } from "../model.js"
22

33
export type RooModelId =
44
| "xai/grok-code-fast-1"
5-
| "roo/code-supernova"
5+
| "roo/code-supernova-1-million"
66
| "xai/grok-4-fast"
77
| "deepseek/deepseek-chat-v3.1"
88

@@ -19,15 +19,15 @@ export const rooModels = {
1919
description:
2020
"A reasoning model that is blazing fast and excels at agentic coding, accessible for free through Roo Code Cloud for a limited time. (Note: the free prompts and completions are logged by xAI and used to improve the model.)",
2121
},
22-
"roo/code-supernova": {
23-
maxTokens: 16_384,
24-
contextWindow: 200_000,
22+
"roo/code-supernova-1-million": {
23+
maxTokens: 30_000,
24+
contextWindow: 1_000_000,
2525
supportsImages: true,
2626
supportsPromptCache: true,
2727
inputPrice: 0,
2828
outputPrice: 0,
2929
description:
30-
"A versatile agentic coding stealth model that supports image inputs, accessible for free through Roo Code Cloud for a limited time. (Note: the free prompts and completions are logged by the model provider and used to improve the model.)",
30+
"A versatile agentic coding stealth model with a 1M token context window that supports image inputs, accessible for free through Roo Code Cloud for a limited time. (Note: the free prompts and completions are logged by the model provider and used to improve the model.)",
3131
},
3232
"xai/grok-4-fast": {
3333
maxTokens: 30_000,

src/core/config/ProviderSettingsManager.ts

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,24 @@ import {
1010
ProviderSettingsEntry,
1111
DEFAULT_CONSECUTIVE_MISTAKE_LIMIT,
1212
getModelId,
13+
type ProviderName,
14+
type RooModelId,
1315
} from "@roo-code/types"
1416
import { TelemetryService } from "@roo-code/telemetry"
1517

1618
import { Mode, modes } from "../../shared/modes"
1719

20+
// Type-safe model migrations mapping
21+
type ModelMigrations = {
22+
[K in ProviderName]?: Record<string, string>
23+
}
24+
25+
const MODEL_MIGRATIONS: ModelMigrations = {
26+
roo: {
27+
"roo/code-supernova": "roo/code-supernova-1-million" as RooModelId,
28+
},
29+
} as const satisfies ModelMigrations
30+
1831
export interface SyncCloudProfilesResult {
1932
hasChanges: boolean
2033
activeProfileChanged: boolean
@@ -108,6 +121,11 @@ export class ProviderSettingsManager {
108121
isDirty = true
109122
}
110123

124+
// Apply model migrations for all providers
125+
if (this.applyModelMigrations(providerProfiles)) {
126+
isDirty = true
127+
}
128+
111129
// Ensure all configs have IDs.
112130
for (const [_name, apiConfig] of Object.entries(providerProfiles.apiConfigs)) {
113131
if (!apiConfig.id) {
@@ -275,6 +293,44 @@ export class ProviderSettingsManager {
275293
}
276294
}
277295

296+
/**
297+
* Apply model migrations for all providers
298+
* Returns true if any migrations were applied
299+
*/
300+
private applyModelMigrations(providerProfiles: ProviderProfiles): boolean {
301+
let migrated = false
302+
303+
try {
304+
for (const [_name, apiConfig] of Object.entries(providerProfiles.apiConfigs)) {
305+
// Skip configs without provider or model ID
306+
if (!apiConfig.apiProvider || !apiConfig.apiModelId) {
307+
continue
308+
}
309+
310+
// Check if this provider has migrations (with type safety)
311+
const provider = apiConfig.apiProvider as ProviderName
312+
const providerMigrations = MODEL_MIGRATIONS[provider]
313+
if (!providerMigrations) {
314+
continue
315+
}
316+
317+
// Check if the current model ID needs migration
318+
const newModelId = providerMigrations[apiConfig.apiModelId]
319+
if (newModelId && newModelId !== apiConfig.apiModelId) {
320+
console.log(
321+
`[ModelMigration] Migrating ${apiConfig.apiProvider} model from ${apiConfig.apiModelId} to ${newModelId}`,
322+
)
323+
apiConfig.apiModelId = newModelId
324+
migrated = true
325+
}
326+
}
327+
} catch (error) {
328+
console.error(`[ModelMigration] Failed to apply model migrations:`, error)
329+
}
330+
331+
return migrated
332+
}
333+
278334
/**
279335
* Clean model ID by removing prefix before "/"
280336
*/

src/core/config/__tests__/ProviderSettingsManager.spec.ts

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,121 @@ describe("ProviderSettingsManager", () => {
229229
expect(storedConfig.migrations.todoListEnabledMigrated).toEqual(true)
230230
})
231231

232+
it("should apply model migrations for all providers", async () => {
233+
mockSecrets.get.mockResolvedValue(
234+
JSON.stringify({
235+
currentApiConfigName: "default",
236+
apiConfigs: {
237+
default: {
238+
config: {},
239+
id: "default",
240+
apiProvider: "roo",
241+
apiModelId: "roo/code-supernova", // Old model ID
242+
},
243+
test: {
244+
apiProvider: "roo",
245+
apiModelId: "roo/code-supernova", // Old model ID
246+
},
247+
existing: {
248+
apiProvider: "roo",
249+
apiModelId: "roo/code-supernova-1-million", // Already migrated
250+
},
251+
otherProvider: {
252+
apiProvider: "anthropic",
253+
apiModelId: "roo/code-supernova", // Should not be migrated (different provider)
254+
},
255+
noProvider: {
256+
id: "no-provider",
257+
apiModelId: "roo/code-supernova", // Should not be migrated (no provider)
258+
},
259+
},
260+
migrations: {
261+
rateLimitSecondsMigrated: true,
262+
diffSettingsMigrated: true,
263+
openAiHeadersMigrated: true,
264+
consecutiveMistakeLimitMigrated: true,
265+
todoListEnabledMigrated: true,
266+
},
267+
}),
268+
)
269+
270+
await providerSettingsManager.initialize()
271+
272+
// Get the last call to store, which should contain the migrated config
273+
const calls = mockSecrets.store.mock.calls
274+
const storedConfig = JSON.parse(calls[calls.length - 1][1])
275+
276+
// Roo provider configs should be migrated
277+
expect(storedConfig.apiConfigs.default.apiModelId).toEqual("roo/code-supernova-1-million")
278+
expect(storedConfig.apiConfigs.test.apiModelId).toEqual("roo/code-supernova-1-million")
279+
expect(storedConfig.apiConfigs.existing.apiModelId).toEqual("roo/code-supernova-1-million")
280+
281+
// Non-roo provider configs should not be migrated
282+
expect(storedConfig.apiConfigs.otherProvider.apiModelId).toEqual("roo/code-supernova")
283+
expect(storedConfig.apiConfigs.noProvider.apiModelId).toEqual("roo/code-supernova")
284+
})
285+
286+
it("should apply model migrations every time, not just once", async () => {
287+
// First load with old model
288+
mockSecrets.get.mockResolvedValue(
289+
JSON.stringify({
290+
currentApiConfigName: "default",
291+
apiConfigs: {
292+
default: {
293+
apiProvider: "roo",
294+
apiModelId: "roo/code-supernova",
295+
id: "default",
296+
},
297+
},
298+
migrations: {
299+
rateLimitSecondsMigrated: true,
300+
diffSettingsMigrated: true,
301+
openAiHeadersMigrated: true,
302+
consecutiveMistakeLimitMigrated: true,
303+
todoListEnabledMigrated: true,
304+
},
305+
}),
306+
)
307+
308+
await providerSettingsManager.initialize()
309+
310+
// Verify migration happened
311+
let calls = mockSecrets.store.mock.calls
312+
let storedConfig = JSON.parse(calls[calls.length - 1][1])
313+
expect(storedConfig.apiConfigs.default.apiModelId).toEqual("roo/code-supernova-1-million")
314+
315+
// Create a new instance to simulate another load
316+
const newManager = new ProviderSettingsManager(mockContext)
317+
318+
// Somehow the model got reverted (e.g., manual edit, sync issue)
319+
mockSecrets.get.mockResolvedValue(
320+
JSON.stringify({
321+
currentApiConfigName: "default",
322+
apiConfigs: {
323+
default: {
324+
apiProvider: "roo",
325+
apiModelId: "roo/code-supernova", // Old model again
326+
id: "default",
327+
},
328+
},
329+
migrations: {
330+
rateLimitSecondsMigrated: true,
331+
diffSettingsMigrated: true,
332+
openAiHeadersMigrated: true,
333+
consecutiveMistakeLimitMigrated: true,
334+
todoListEnabledMigrated: true,
335+
},
336+
}),
337+
)
338+
339+
await newManager.initialize()
340+
341+
// Verify migration happened again
342+
calls = mockSecrets.store.mock.calls
343+
storedConfig = JSON.parse(calls[calls.length - 1][1])
344+
expect(storedConfig.apiConfigs.default.apiModelId).toEqual("roo/code-supernova-1-million")
345+
})
346+
232347
it("should throw error if secrets storage fails", async () => {
233348
mockSecrets.get.mockRejectedValue(new Error("Storage failed"))
234349

src/core/webview/ClineProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ export class ClineProvider
144144

145145
public isViewLaunched = false
146146
public settingsImportedAt?: number
147-
public readonly latestAnnouncementId = "sep-2025-code-supernova" // Code Supernova stealth model announcement
147+
public readonly latestAnnouncementId = "sep-2025-code-supernova-1m" // Code Supernova 1M context window announcement
148148
public readonly providerSettingsManager: ProviderSettingsManager
149149
public readonly customModesManager: CustomModesManager
150150

webview-ui/src/i18n/locales/ca/chat.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

webview-ui/src/i18n/locales/de/chat.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

webview-ui/src/i18n/locales/en/chat.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@
295295
"announcement": {
296296
"title": "🎉 Roo Code {{version}} Released",
297297
"stealthModel": {
298-
"feature": "<bold>Limited-time FREE stealth model</bold> - Code Supernova: A versatile agentic coding model that supports image inputs, accessible through Roo Code Cloud.",
298+
"feature": "<bold>Limited-time FREE stealth model</bold> - Code Supernova: Now upgraded with a <bold>1M token context window</bold>! A versatile agentic coding model that supports image inputs, accessible through Roo Code Cloud.",
299299
"note": "(Note: prompts and completions are logged by the model creator and used to improve the model)",
300300
"connectButton": "Connect to Roo Code Cloud",
301301
"selectModel": "Select <code>roo/code-supernova</code> from the Roo Code Cloud provider in Settings to get started.",

webview-ui/src/i18n/locales/es/chat.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

webview-ui/src/i18n/locales/fr/chat.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

webview-ui/src/i18n/locales/hi/chat.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)