mirror of
https://github.com/tiennm99/ccs.git
synced 2026-07-17 04:17:11 +00:00
fix(cliproxy): improve multi-provider auth with continue-on-error pattern
- Continue to remaining providers on auth failure instead of throwing - Aggregate failures and show summary of succeeded/failed providers - Improves UX when one provider fails in composite variant
This commit is contained in:
@@ -497,6 +497,7 @@ export async function execClaudeWithCLIProxy(
|
||||
// Handle forceAuth for composite providers
|
||||
if (forceAuth) {
|
||||
const { triggerOAuth } = await import('../auth-handler');
|
||||
const failures: string[] = [];
|
||||
for (const p of compositeProviders) {
|
||||
const authSuccess = await triggerOAuth(p, {
|
||||
verbose,
|
||||
@@ -508,10 +509,17 @@ export async function execClaudeWithCLIProxy(
|
||||
...(portForward ? { portForward: true } : {}),
|
||||
});
|
||||
if (!authSuccess) {
|
||||
const pConfig = getProviderConfig(p as CLIProxyProvider);
|
||||
throw new Error(`Authentication failed for ${pConfig.displayName}`);
|
||||
failures.push(p);
|
||||
}
|
||||
}
|
||||
if (failures.length > 0) {
|
||||
const succeeded = compositeProviders.filter((p) => !failures.includes(p));
|
||||
console.error(fail(`Auth failed for: ${failures.join(', ')}`));
|
||||
if (succeeded.length > 0) {
|
||||
console.error(info(`Succeeded: ${succeeded.join(', ')}`));
|
||||
}
|
||||
process.exit(1);
|
||||
}
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user