Skip to content

feat(config): add default Kiro model aliases for standard Claude model names#209

Merged
luispater merged 1 commit intorouter-for-me:mainfrom
Buywatermelon:feature/default-kiro-aliases
Feb 11, 2026
Merged

feat(config): add default Kiro model aliases for standard Claude model names#209
luispater merged 1 commit intorouter-for-me:mainfrom
Buywatermelon:feature/default-kiro-aliases

Conversation

@Buywatermelon
Copy link

Summary

Add default oauth-model-alias entries 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 configure oauth-model-alias for 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:

Standard Name Maps To
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-* model names.

Key Design Decisions

  • Runtime injection, not file migration: Defaults are injected in SanitizeOAuthModelAlias() (in-memory), not via MigrateOAuthModelAlias() (which is disabled to avoid config.yaml mutations at startup)
  • User aliases take priority: If user has configured any Kiro aliases, defaults are NOT injected
  • Non-breaking: Existing configurations are unaffected

Changes

  • internal/config/oauth_model_alias_migration.go: Added defaultKiroAliases() function
  • internal/config/config.go: Updated SanitizeOAuthModelAlias() to inject Kiro defaults
  • internal/config/oauth_model_alias_test.go: Added 3 test cases

Testing

All existing + new tests pass:

=== RUN   TestSanitizeOAuthModelAlias_InjectsDefaultKiroAliases
--- PASS
=== RUN   TestSanitizeOAuthModelAlias_DoesNotOverrideUserKiroAliases
--- PASS
=== RUN   TestSanitizeOAuthModelAlias_InjectsDefaultKiroWhenEmpty
--- PASS

…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
Copilot AI review requested due to automatic review settings February 10, 2026 11:02
@gemini-code-assist
Copy link

Summary of Changes

Hello @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 kiro- prefixed model names to their standard counterparts, streamlining model access.

Highlights

  • Default Kiro Aliases: Default oauth-model-alias entries are now automatically injected for the Kiro channel.
  • Standard Model Names: Users can now use standard Claude model names (e.g., claude-sonnet-4) directly with Kiro models, eliminating the need for manual alias configuration.
  • Runtime Injection: The default aliases are injected at runtime within the SanitizeOAuthModelAlias() function, avoiding direct modification of config.yaml.
  • User Priority: Any user-configured Kiro aliases will take precedence, and default aliases will not be injected if user-defined ones exist for the Kiro channel.
  • Non-Breaking Change: The implementation ensures that existing configurations remain unaffected.

🧠 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
  • internal/config/config.go
    • Modified SanitizeOAuthModelAlias to include logic for injecting default Kiro aliases if none are user-configured.
  • internal/config/oauth_model_alias_migration.go
    • Added a new function defaultKiroAliases() which returns a slice of OAuthModelAlias structs for standard Claude models mapped to their Kiro equivalents.
  • internal/config/oauth_model_alias_test.go
    • Added TestSanitizeOAuthModelAlias_InjectsDefaultKiroAliases to verify default alias injection.
    • Added TestSanitizeOAuthModelAlias_DoesNotOverrideUserKiroAliases to confirm user aliases are respected.
    • Added TestSanitizeOAuthModelAlias_InjectsDefaultKiroWhenEmpty to test injection when OAuthModelAlias is initially nil.
Activity
  • All existing and newly added tests have passed successfully.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +750 to +762
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()
}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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()
}

Comment on lines +26 to +43
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},
}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
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
}

Comment on lines +80 to +95
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)
}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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)
		}
	}

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 to kiro-* model IDs (with fork: 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.

Comment on lines +746 to +760
// 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()
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copilot uses AI. Check for mistakes.
Comment on lines +110 to +141
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")
}
}
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Add default oauth-model-alias for Kiro channel (like Antigravity)

3 participants