feat(config): add default Kiro model aliases for standard Claude model names#209
Conversation
…l names Kiro models are exposed with kiro- prefix (e.g., kiro-claude-sonnet-4-5), which prevents clients like Claude Code from using standard model names (e.g., claude-sonnet-4-20250514). This change injects default oauth-model-alias entries for the kiro channel when no user-configured aliases exist, following the same pattern as the existing Antigravity defaults. The aliases map standard Claude model names (both with and without date suffixes) to their kiro-prefixed counterparts. Default aliases added: - claude-sonnet-4-5-20250929 / claude-sonnet-4-5 → kiro-claude-sonnet-4-5 - claude-sonnet-4-20250514 / claude-sonnet-4 → kiro-claude-sonnet-4 - claude-opus-4-6 → kiro-claude-opus-4-6 - claude-opus-4-5-20251101 / claude-opus-4-5 → kiro-claude-opus-4-5 - claude-haiku-4-5-20251001 / claude-haiku-4-5 → kiro-claude-haiku-4-5 All aliases use fork: true to preserve the original kiro-* names. User-configured kiro aliases are respected and not overridden. Closes #208
Summary of ChangesHello @Buywatermelon, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces automatic injection of default model aliases for the Kiro channel, enabling users to utilize standard Claude model names without requiring manual configuration. This enhances usability for clients by mapping Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a helpful feature by adding default model aliases for the Kiro channel, improving the out-of-the-box experience for users. The implementation is solid and well-tested. I've included a few suggestions to enhance code clarity, maintainability, and performance.
| if _, hasKiro := cfg.OAuthModelAlias["kiro"]; !hasKiro { | ||
| // Check case-insensitive too | ||
| found := false | ||
| for k := range cfg.OAuthModelAlias { | ||
| if strings.EqualFold(strings.TrimSpace(k), "kiro") { | ||
| found = true | ||
| break | ||
| } | ||
| } | ||
| if !found { | ||
| cfg.OAuthModelAlias["kiro"] = defaultKiroAliases() | ||
| } | ||
| } |
There was a problem hiding this comment.
The logic to check for existing user-configured Kiro aliases can be simplified. The current implementation uses a fast-path check for the lowercase "kiro" key, then falls back to a case-insensitive loop. This can be simplified into a single, more readable loop without a significant performance impact, especially given the small size of this configuration map.
hasUserKiro := false
for k := range cfg.OAuthModelAlias {
if strings.EqualFold(strings.TrimSpace(k), "kiro") {
hasUserKiro = true
break
}
}
if !hasUserKiro {
cfg.OAuthModelAlias["kiro"] = defaultKiroAliases()
}| func defaultKiroAliases() []OAuthModelAlias { | ||
| return []OAuthModelAlias{ | ||
| // Sonnet 4.5 | ||
| {Name: "kiro-claude-sonnet-4-5", Alias: "claude-sonnet-4-5-20250929", Fork: true}, | ||
| {Name: "kiro-claude-sonnet-4-5", Alias: "claude-sonnet-4-5", Fork: true}, | ||
| // Sonnet 4 | ||
| {Name: "kiro-claude-sonnet-4", Alias: "claude-sonnet-4-20250514", Fork: true}, | ||
| {Name: "kiro-claude-sonnet-4", Alias: "claude-sonnet-4", Fork: true}, | ||
| // Opus 4.6 | ||
| {Name: "kiro-claude-opus-4-6", Alias: "claude-opus-4-6", Fork: true}, | ||
| // Opus 4.5 | ||
| {Name: "kiro-claude-opus-4-5", Alias: "claude-opus-4-5-20251101", Fork: true}, | ||
| {Name: "kiro-claude-opus-4-5", Alias: "claude-opus-4-5", Fork: true}, | ||
| // Haiku 4.5 | ||
| {Name: "kiro-claude-haiku-4-5", Alias: "claude-haiku-4-5-20251001", Fork: true}, | ||
| {Name: "kiro-claude-haiku-4-5", Alias: "claude-haiku-4-5", Fork: true}, | ||
| } | ||
| } |
There was a problem hiding this comment.
The defaultKiroAliases function creates a new slice on every call. Since this data is constant, you can define it as a package-level variable to avoid repeated allocations. This is a minor performance optimization but good practice.
| func defaultKiroAliases() []OAuthModelAlias { | |
| return []OAuthModelAlias{ | |
| // Sonnet 4.5 | |
| {Name: "kiro-claude-sonnet-4-5", Alias: "claude-sonnet-4-5-20250929", Fork: true}, | |
| {Name: "kiro-claude-sonnet-4-5", Alias: "claude-sonnet-4-5", Fork: true}, | |
| // Sonnet 4 | |
| {Name: "kiro-claude-sonnet-4", Alias: "claude-sonnet-4-20250514", Fork: true}, | |
| {Name: "kiro-claude-sonnet-4", Alias: "claude-sonnet-4", Fork: true}, | |
| // Opus 4.6 | |
| {Name: "kiro-claude-opus-4-6", Alias: "claude-opus-4-6", Fork: true}, | |
| // Opus 4.5 | |
| {Name: "kiro-claude-opus-4-5", Alias: "claude-opus-4-5-20251101", Fork: true}, | |
| {Name: "kiro-claude-opus-4-5", Alias: "claude-opus-4-5", Fork: true}, | |
| // Haiku 4.5 | |
| {Name: "kiro-claude-haiku-4-5", Alias: "claude-haiku-4-5-20251001", Fork: true}, | |
| {Name: "kiro-claude-haiku-4-5", Alias: "claude-haiku-4-5", Fork: true}, | |
| } | |
| } | |
| var defaultKiroAliasesCache = []OAuthModelAlias{ | |
| // Sonnet 4.5 | |
| {Name: "kiro-claude-sonnet-4-5", Alias: "claude-sonnet-4-5-20250929", Fork: true}, | |
| {Name: "kiro-claude-sonnet-4-5", Alias: "claude-sonnet-4-5", Fork: true}, | |
| // Sonnet 4 | |
| {Name: "kiro-claude-sonnet-4", Alias: "claude-sonnet-4-20250514", Fork: true}, | |
| {Name: "kiro-claude-sonnet-4", Alias: "claude-sonnet-4", Fork: true}, | |
| // Opus 4.6 | |
| {Name: "kiro-claude-opus-4-6", Alias: "claude-opus-4-6", Fork: true}, | |
| // Opus 4.5 | |
| {Name: "kiro-claude-opus-4-5", Alias: "claude-opus-4-5-20251101", Fork: true}, | |
| {Name: "kiro-claude-opus-4-5", Alias: "claude-opus-4-5", Fork: true}, | |
| // Haiku 4.5 | |
| {Name: "kiro-claude-haiku-4-5", Alias: "claude-haiku-4-5-20251001", Fork: true}, | |
| {Name: "kiro-claude-haiku-4-5", Alias: "claude-haiku-4-5", Fork: true}, | |
| } | |
| func defaultKiroAliases() []OAuthModelAlias { | |
| return defaultKiroAliasesCache | |
| } |
| expectedAliases := []string{ | ||
| "claude-sonnet-4-5-20250929", | ||
| "claude-sonnet-4-5", | ||
| "claude-sonnet-4-20250514", | ||
| "claude-sonnet-4", | ||
| "claude-opus-4-6", | ||
| "claude-opus-4-5-20251101", | ||
| "claude-opus-4-5", | ||
| "claude-haiku-4-5-20251001", | ||
| "claude-haiku-4-5", | ||
| } | ||
| for _, expected := range expectedAliases { | ||
| if !aliasSet[expected] { | ||
| t.Fatalf("expected default kiro alias %q to be present", expected) | ||
| } | ||
| } |
There was a problem hiding this comment.
The list of expectedAliases is a hardcoded duplicate of the aliases defined in defaultKiroAliases. This makes the test brittle, as any change to the default aliases requires a manual update here. To improve maintainability, you can derive the expected aliases directly from the defaultKiroAliases() function.
expectedDefaultAliases := defaultKiroAliases()
if len(kiroAliases) != len(expectedDefaultAliases) {
t.Fatalf("expected %d default kiro aliases, got %d", len(expectedDefaultAliases), len(kiroAliases))
}
for _, expected := range expectedDefaultAliases {
if !aliasSet[expected.Alias] {
t.Fatalf("expected default kiro alias %q to be present", expected.Alias)
}
}There was a problem hiding this comment.
Pull request overview
Adds built-in oauth-model-alias defaults for the Kiro OAuth channel so clients can use standard Claude model names without manual alias configuration, mirroring the existing “default aliases” pattern used elsewhere (e.g., Antigravity).
Changes:
- Introduces a
defaultKiroAliases()list mapping standard Claude model IDs tokiro-*model IDs (withfork: true). - Updates
Config.SanitizeOAuthModelAlias()to inject Kiro defaults when no Kiro aliases are configured. - Adds tests covering default injection and non-overriding behavior.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| internal/config/config.go | Injects default Kiro aliases during OAuth model-alias sanitization. |
| internal/config/oauth_model_alias_migration.go | Adds defaultKiroAliases() providing the built-in alias set for Kiro. |
| internal/config/oauth_model_alias_test.go | Adds tests for Kiro default alias injection and preservation of user aliases. |
Comments suppressed due to low confidence (1)
internal/config/config.go:772
- The default-injection check only looks for presence of a "kiro" key, not whether the user actually configured any Kiro aliases. If config contains an explicit but empty entry like
oauth-model-alias: { kiro: [] }, this block will skip injection, and the later loop will drop the empty channel—leaving no Kiro defaults and breaking the intended out-of-box behavior. Treat a present-but-empty (or whitespace/case-variant) Kiro entry as “no user-configured aliases” for purposes of injecting defaults, or otherwise define and enforce an explicit opt-out mechanism.
if _, hasKiro := cfg.OAuthModelAlias["kiro"]; !hasKiro {
// Check case-insensitive too
found := false
for k := range cfg.OAuthModelAlias {
if strings.EqualFold(strings.TrimSpace(k), "kiro") {
found = true
break
}
}
if !found {
cfg.OAuthModelAlias["kiro"] = defaultKiroAliases()
}
}
if len(cfg.OAuthModelAlias) == 0 {
return
}
out := make(map[string][]OAuthModelAlias, len(cfg.OAuthModelAlias))
for rawChannel, aliases := range cfg.OAuthModelAlias {
channel := strings.ToLower(strings.TrimSpace(rawChannel))
if channel == "" || len(aliases) == 0 {
continue
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Inject default Kiro aliases if no user-configured kiro aliases exist | ||
| if cfg.OAuthModelAlias == nil { | ||
| cfg.OAuthModelAlias = make(map[string][]OAuthModelAlias) | ||
| } | ||
| if _, hasKiro := cfg.OAuthModelAlias["kiro"]; !hasKiro { | ||
| // Check case-insensitive too | ||
| found := false | ||
| for k := range cfg.OAuthModelAlias { | ||
| if strings.EqualFold(strings.TrimSpace(k), "kiro") { | ||
| found = true | ||
| break | ||
| } | ||
| } | ||
| if !found { | ||
| cfg.OAuthModelAlias["kiro"] = defaultKiroAliases() |
There was a problem hiding this comment.
Injecting default Kiro aliases inside SanitizeOAuthModelAlias means any code path that calls this sanitizer before persisting config (e.g., the management API helper that sanitizes oauth-model-alias payloads) will end up writing these defaults to config.yaml, even though the PR description says defaults are injected in-memory (runtime) rather than via file migration. Consider splitting this into (1) a pure sanitizer that only normalizes/dedupes user-provided aliases and (2) a separate step that overlays built-in defaults at runtime (e.g., only for model listing/routing, or only during config load but excluded from persistence).
| func TestSanitizeOAuthModelAlias_DoesNotOverrideUserKiroAliases(t *testing.T) { | ||
| // When user has configured kiro aliases, defaults should NOT be injected | ||
| cfg := &Config{ | ||
| OAuthModelAlias: map[string][]OAuthModelAlias{ | ||
| "kiro": { | ||
| {Name: "kiro-claude-sonnet-4", Alias: "my-custom-sonnet", Fork: true}, | ||
| }, | ||
| }, | ||
| } | ||
|
|
||
| cfg.SanitizeOAuthModelAlias() | ||
|
|
||
| kiroAliases := cfg.OAuthModelAlias["kiro"] | ||
| if len(kiroAliases) != 1 { | ||
| t.Fatalf("expected 1 user-configured kiro alias, got %d", len(kiroAliases)) | ||
| } | ||
| if kiroAliases[0].Alias != "my-custom-sonnet" { | ||
| t.Fatalf("expected user alias to be preserved, got %q", kiroAliases[0].Alias) | ||
| } | ||
| } | ||
|
|
||
| func TestSanitizeOAuthModelAlias_InjectsDefaultKiroWhenEmpty(t *testing.T) { | ||
| // When OAuthModelAlias is nil, kiro defaults should still be injected | ||
| cfg := &Config{} | ||
|
|
||
| cfg.SanitizeOAuthModelAlias() | ||
|
|
||
| kiroAliases := cfg.OAuthModelAlias["kiro"] | ||
| if len(kiroAliases) == 0 { | ||
| t.Fatal("expected default kiro aliases to be injected when OAuthModelAlias is nil") | ||
| } | ||
| } |
There was a problem hiding this comment.
New tests cover the nil-map and “no kiro key” cases, but there’s no test for the edge case where the user/config file explicitly contains an empty Kiro alias list (e.g., OAuthModelAlias: map[string][]OAuthModelAlias{"kiro": {}}). Given the current injection logic, this case behaves differently and can result in no defaults after sanitization. Adding a test for this will prevent regressions and clarify the intended semantics (inject vs. opt-out).
Summary
Add default
oauth-model-aliasentries for the Kiro channel, so standard Claude model names work out of the box without manual configuration.Closes #208
Problem
Kiro models are exposed with
kiro-prefix (e.g.,kiro-claude-sonnet-4-5), which prevents clients like Claude Code from using standard model names (e.g.,claude-sonnet-4-20250514). Users must manually configureoauth-model-aliasfor every Kiro model.Solution
Inject default Kiro aliases in
SanitizeOAuthModelAlias()when no user-configured Kiro aliases exist, following the same pattern as the existing Antigravity defaults.Default aliases added:
claude-sonnet-4-5-20250929/claude-sonnet-4-5kiro-claude-sonnet-4-5claude-sonnet-4-20250514/claude-sonnet-4kiro-claude-sonnet-4claude-opus-4-6kiro-claude-opus-4-6claude-opus-4-5-20251101/claude-opus-4-5kiro-claude-opus-4-5claude-haiku-4-5-20251001/claude-haiku-4-5kiro-claude-haiku-4-5All aliases use
fork: trueto preserve the originalkiro-*model names.Key Design Decisions
SanitizeOAuthModelAlias()(in-memory), not viaMigrateOAuthModelAlias()(which is disabled to avoid config.yaml mutations at startup)Changes
internal/config/oauth_model_alias_migration.go: AddeddefaultKiroAliases()functioninternal/config/config.go: UpdatedSanitizeOAuthModelAlias()to inject Kiro defaultsinternal/config/oauth_model_alias_test.go: Added 3 test casesTesting
All existing + new tests pass: