mirror of
https://github.com/tiennm99/ccs.git
synced 2026-09-02 14:19:56 +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
|
// Handle forceAuth for composite providers
|
||||||
if (forceAuth) {
|
if (forceAuth) {
|
||||||
const { triggerOAuth } = await import('../auth-handler');
|
const { triggerOAuth } = await import('../auth-handler');
|
||||||
|
const failures: string[] = [];
|
||||||
for (const p of compositeProviders) {
|
for (const p of compositeProviders) {
|
||||||
const authSuccess = await triggerOAuth(p, {
|
const authSuccess = await triggerOAuth(p, {
|
||||||
verbose,
|
verbose,
|
||||||
@@ -508,10 +509,17 @@ export async function execClaudeWithCLIProxy(
|
|||||||
...(portForward ? { portForward: true } : {}),
|
...(portForward ? { portForward: true } : {}),
|
||||||
});
|
});
|
||||||
if (!authSuccess) {
|
if (!authSuccess) {
|
||||||
const pConfig = getProviderConfig(p as CLIProxyProvider);
|
failures.push(p);
|
||||||
throw new Error(`Authentication failed for ${pConfig.displayName}`);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
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);
|
process.exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user