-
-
Notifications
You must be signed in to change notification settings - Fork 40
add missing Kiro config synthesis #54
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
add missing Kiro config synthesis #54
Conversation
Summary of ChangesHello @StriveMario, 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 resolves a critical regression that prevented the proper loading and synthesis of Kiro (AWS CodeWhisperer) configurations from 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. 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.
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 effectively fixes a regression by re-introducing the Kiro configuration synthesis. The implementation in synthesizeKiroKeys is well-structured and correctly handles loading tokens from both files and direct configuration. I've identified a couple of minor areas for improvement to enhance code clarity and adhere to the intended design of the Auth struct. Specifically, I've suggested removing a redundant nil check and ensuring the refreshToken is stored only in Metadata as it represents mutable state. Overall, these changes are a solid contribution to restoring the Kiro integration.
| var accessToken, profileArn, refreshToken string | ||
|
|
||
| // Try to load from token file first | ||
| if kk.TokenFile != "" && kAuth != nil { |
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.
| if refreshToken != "" { | ||
| attrs["refresh_token"] = refreshToken | ||
| } |
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.
The refreshToken is being stored in the Attributes map. According to the coreauth.Auth struct's documentation, Attributes are for immutable configuration, while Metadata is for mutable runtime state. Since a refresh token can be updated during the application's lifecycle, it should only be stored in Metadata. Storing it in Attributes could lead to confusion or bugs if other parts of the code rely on Attributes being static. The token is already correctly stored in Metadata later in this function.
PR: Fix missing Kiro configuration synthesis in v6.6.29-0
Summary
Fix regression bug where Kiro (AWS CodeWhisperer) configuration from
config.yamlwas not being processed, preventingkiro-claude-xxxmodels from being registered viaaccess-tokenandrefresh-tokenconfiguration.Problem
After the refactoring in v6.6.29-0 that introduced the
synthesizerpattern for auth generation, the Kiro configuration handling was accidentally omitted during the migration.Affected versions: v6.6.29-0
Working versions: v6.6.20-0 and earlier
Symptoms
kiro_keyinconfig.yamlare not loadedaccess_token,refresh_token,profile_arnconfiguration is ignoredkiro-claude-xxxmodels available despite valid configurationRoot Cause Analysis
In v6.6.20-0,
SnapshotCoreAuths()ininternal/watcher/watcher.go(lines 1167-1248) directly processedcfg.KiroKeyto generate Kiro auth entries.In v6.6.29-0, the code was refactored to use
synthesizer.ConfigSynthesizer.Synthesize(), but the Kiro handling was not migrated:Changes
Modified File
internal/watcher/synthesizer/config.goChanges Made
Added imports (lines 7, 10):
Added Kiro synthesis call in
Synthesize()(lines 35-36):Implemented
synthesizeKiroKeys()method (lines 300-391):cfg.KiroKeyconfiguration entriesTokenFileaccess_token,refresh_token,profile_arnconfigurationregion,agent_task_type,preferred_endpointper-key settingsKiroPreferredEndpointas defaultrefresh_tokenin bothAttributesandMetadatafor token refreshFeature Parity
access_tokenconfigrefresh_tokenconfigprofile_arnconfigTokenFileloadingregionconfigagent_task_typeconfigpreferred_endpointconfigKiroPreferredEndpointTesting
go1.24.0 build ./...- PASSEDCLIProxyAPI.exe- GENERATED (45MB)Diff Summary
import ( "fmt" "strings" + kiroauth "github.com/router-for-me/CLIProxyAPI/v6/internal/auth/kiro" "github.com/router-for-me/CLIProxyAPI/v6/internal/watcher/diff" coreauth "github.com/router-for-me/CLIProxyAPI/v6/sdk/cliproxy/auth" + log "github.com/sirupsen/logrus" ) func (s *ConfigSynthesizer) Synthesize(ctx *SynthesisContext) ([]*coreauth.Auth, error) { // Gemini API Keys out = append(out, s.synthesizeGeminiKeys(ctx)...) // Claude API Keys out = append(out, s.synthesizeClaudeKeys(ctx)...) // Codex API Keys out = append(out, s.synthesizeCodexKeys(ctx)...) + // Kiro (AWS CodeWhisperer) + out = append(out, s.synthesizeKiroKeys(ctx)...) // OpenAI-compat out = append(out, s.synthesizeOpenAICompat(ctx)...) // Vertex-compat out = append(out, s.synthesizeVertexCompat(ctx)...) return out, nil } +// synthesizeKiroKeys creates Auth entries for Kiro (AWS CodeWhisperer) tokens. +func (s *ConfigSynthesizer) synthesizeKiroKeys(ctx *SynthesisContext) []*coreauth.Auth { + // ... 90 lines of implementation +}Related Issues
config.yamlChecklist