-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Upgrade Supernova #8330
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade Supernova #8330
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -10,11 +10,24 @@ import { | |||||||||||||||||||||
| ProviderSettingsEntry, | ||||||||||||||||||||||
| DEFAULT_CONSECUTIVE_MISTAKE_LIMIT, | ||||||||||||||||||||||
| getModelId, | ||||||||||||||||||||||
| type ProviderName, | ||||||||||||||||||||||
| type RooModelId, | ||||||||||||||||||||||
| } from "@roo-code/types" | ||||||||||||||||||||||
| import { TelemetryService } from "@roo-code/telemetry" | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| import { Mode, modes } from "../../shared/modes" | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| // Type-safe model migrations mapping | ||||||||||||||||||||||
| type ModelMigrations = { | ||||||||||||||||||||||
| [K in ProviderName]?: Record<string, string> | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| const MODEL_MIGRATIONS: ModelMigrations = { | ||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: The migration map is typed as Record<string, string>. Narrow to RooModelId keys/values to catch typos at compile time.
Suggested change
|
||||||||||||||||||||||
| roo: { | ||||||||||||||||||||||
| "roo/code-supernova": "roo/code-supernova-1-million" as RooModelId, | ||||||||||||||||||||||
| }, | ||||||||||||||||||||||
| } as const satisfies ModelMigrations | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| export interface SyncCloudProfilesResult { | ||||||||||||||||||||||
| hasChanges: boolean | ||||||||||||||||||||||
| activeProfileChanged: boolean | ||||||||||||||||||||||
|
|
@@ -108,6 +121,11 @@ export class ProviderSettingsManager { | |||||||||||||||||||||
| isDirty = true | ||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P3: Migrations run on initialize(). Consider applying the same normalization step wherever providerProfiles are mutated (e.g., save/import) to keep configs normalized after startup. |
||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| // Apply model migrations for all providers | ||||||||||||||||||||||
| if (this.applyModelMigrations(providerProfiles)) { | ||||||||||||||||||||||
| isDirty = true | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| // Ensure all configs have IDs. | ||||||||||||||||||||||
| for (const [_name, apiConfig] of Object.entries(providerProfiles.apiConfigs)) { | ||||||||||||||||||||||
| if (!apiConfig.id) { | ||||||||||||||||||||||
|
|
@@ -275,6 +293,44 @@ export class ProviderSettingsManager { | |||||||||||||||||||||
| } | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| /** | ||||||||||||||||||||||
| * Apply model migrations for all providers | ||||||||||||||||||||||
| * Returns true if any migrations were applied | ||||||||||||||||||||||
| */ | ||||||||||||||||||||||
| private applyModelMigrations(providerProfiles: ProviderProfiles): boolean { | ||||||||||||||||||||||
| let migrated = false | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| try { | ||||||||||||||||||||||
| for (const [_name, apiConfig] of Object.entries(providerProfiles.apiConfigs)) { | ||||||||||||||||||||||
| // Skip configs without provider or model ID | ||||||||||||||||||||||
| if (!apiConfig.apiProvider || !apiConfig.apiModelId) { | ||||||||||||||||||||||
| continue | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| // Check if this provider has migrations (with type safety) | ||||||||||||||||||||||
| const provider = apiConfig.apiProvider as ProviderName | ||||||||||||||||||||||
| const providerMigrations = MODEL_MIGRATIONS[provider] | ||||||||||||||||||||||
| if (!providerMigrations) { | ||||||||||||||||||||||
| continue | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| // Check if the current model ID needs migration | ||||||||||||||||||||||
| const newModelId = providerMigrations[apiConfig.apiModelId] | ||||||||||||||||||||||
| if (newModelId && newModelId !== apiConfig.apiModelId) { | ||||||||||||||||||||||
| console.log( | ||||||||||||||||||||||
| `[ModelMigration] Migrating ${apiConfig.apiProvider} model from ${apiConfig.apiModelId} to ${newModelId}`, | ||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: Prefer project logger/telemetry over console.log/console.error to reduce noise and centralize diagnostics. Consider emitting a dedicated event for model migrations. |
||||||||||||||||||||||
| ) | ||||||||||||||||||||||
| apiConfig.apiModelId = newModelId | ||||||||||||||||||||||
| migrated = true | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
| } catch (error) { | ||||||||||||||||||||||
| console.error(`[ModelMigration] Failed to apply model migrations:`, error) | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| return migrated | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| /** | ||||||||||||||||||||||
| * Clean model ID by removing prefix before "/" | ||||||||||||||||||||||
| */ | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P3: New ID and limits look good. Ensure any user-facing docs/help listing model IDs are updated to 'roo/code-supernova-1-million' to avoid confusion.