Fix Gemini OAuth onboarding failure (#8905)

Signed-off-by: Angie Jones <jones.angie@gmail.com>
This commit is contained in:
Angie Jones
2026-04-29 22:45:17 -06:00
committed by GitHub
parent 66692e9517
commit 6cdd2473ee
2 changed files with 21 additions and 2 deletions
+13 -1
View File
@@ -303,11 +303,15 @@ struct LoadCodeAssistResponse {
cloudaicompanion_project: Option<String>,
current_tier: Option<TierInfo>,
onboard_tiers: Option<Vec<TierInfo>>,
allowed_tiers: Option<Vec<TierInfo>>,
}
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
struct TierInfo {
id: Option<String>,
#[serde(default)]
is_default: Option<bool>,
}
#[derive(Debug, Deserialize)]
@@ -424,7 +428,15 @@ async fn setup_code_assist(access_token: &str) -> Result<String> {
.as_ref()
.and_then(|tiers| tiers.first())
.and_then(|t| t.id.clone())
.unwrap_or_else(|| "FREE".to_string());
.or_else(|| {
load_resp
.allowed_tiers
.as_ref()
.and_then(|tiers| tiers.iter().find(|t| t.is_default.unwrap_or(false)))
.or_else(|| load_resp.allowed_tiers.as_ref().and_then(|t| t.first()))
.and_then(|t| t.id.clone())
})
.unwrap_or_else(|| "free-tier".to_string());
tracing::info!("Onboarding user with tier: {}", tier_id);
@@ -213,9 +213,16 @@ export default function ProviderConfigurationModal({
}
}
}
await configureProviderOauth({
const oauthResult = await configureProviderOauth({
path: { name: provider.name },
});
if (oauthResult.error) {
const err = oauthResult.error as Record<string, unknown>;
const errDetail = typeof oauthResult.error === 'string'
? oauthResult.error
: (err?.message as string) ?? (err?.detail as string) ?? JSON.stringify(oauthResult.error);
throw new Error(errDetail);
}
if (onConfigured) {
onConfigured(provider);
} else {