-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
fix(gemini-cli): use backend project ID from onboarding response #2416
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
base: main
Are you sure you want to change the base?
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 |
|---|---|---|
|
|
@@ -49,3 +49,4 @@ _bmad-output/* | |
| # macOS | ||
| .DS_Store | ||
| ._* | ||
| .gocache/ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -333,42 +333,10 @@ func performGeminiCLISetup(ctx context.Context, httpClient *http.Client, storage | |
| finalProjectID := projectID | ||
| if responseProjectID != "" { | ||
| if explicitProject && !strings.EqualFold(responseProjectID, projectID) { | ||
| // Check if this is a free user (gen-lang-client projects or free/legacy tier) | ||
| isFreeUser := strings.HasPrefix(projectID, "gen-lang-client-") || | ||
| strings.EqualFold(tierID, "FREE") || | ||
| strings.EqualFold(tierID, "LEGACY") | ||
|
|
||
| if isFreeUser { | ||
| // Interactive prompt for free users | ||
| fmt.Printf("\nGoogle returned a different project ID:\n") | ||
| fmt.Printf(" Requested (frontend): %s\n", projectID) | ||
| fmt.Printf(" Returned (backend): %s\n\n", responseProjectID) | ||
| fmt.Printf(" Backend project IDs have access to preview models (gemini-3-*).\n") | ||
| fmt.Printf(" This is normal for free tier users.\n\n") | ||
| fmt.Printf("Which project ID would you like to use?\n") | ||
| fmt.Printf(" [1] Backend (recommended): %s\n", responseProjectID) | ||
| fmt.Printf(" [2] Frontend: %s\n\n", projectID) | ||
| fmt.Printf("Enter choice [1]: ") | ||
|
|
||
| reader := bufio.NewReader(os.Stdin) | ||
| choice, _ := reader.ReadString('\n') | ||
| choice = strings.TrimSpace(choice) | ||
|
|
||
| if choice == "2" { | ||
| log.Infof("Using frontend project ID: %s", projectID) | ||
| fmt.Println(". Warning: Frontend project IDs may not have access to preview models.") | ||
| finalProjectID = projectID | ||
| } else { | ||
| log.Infof("Using backend project ID: %s (recommended)", responseProjectID) | ||
| finalProjectID = responseProjectID | ||
| } | ||
| } else { | ||
| // Pro users: keep requested project ID (original behavior) | ||
| log.Warnf("Gemini onboarding returned project %s instead of requested %s; keeping requested project ID.", responseProjectID, projectID) | ||
| } | ||
| } else { | ||
| finalProjectID = responseProjectID | ||
| log.Infof("Gemini onboarding: requested project %s maps to backend project %s", projectID, responseProjectID) | ||
| log.Infof("Using backend project ID: %s", responseProjectID) | ||
| } | ||
|
Comment on lines
335
to
338
Contributor
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. This logic is also present in With the changes in this PR, the logic has become identical. To improve maintainability and avoid having to apply the same changes in multiple places, this function should be extracted to a shared package (e.g., within |
||
| finalProjectID = responseProjectID | ||
| } | ||
|
|
||
| storage.ProjectID = strings.TrimSpace(finalProjectID) | ||
|
|
||
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.
This
if/elseblock can be simplified. Both branches assignresponseProjectIDtofinalProjectID. You can move the assignment out of the conditional block to make the code more concise, while keeping the logging inside theif.