mirror of
https://github.com/tiennm99/ccs.git
synced 2026-09-03 14:18:12 +00:00
test(cliproxy): add thinking suffix test and document exit 0 behavior
- Add test case for comma-separated thinking params (32768,extended) - Add clarifying comment to isProviderError() about exit 0 handling
This commit is contained in:
@@ -125,6 +125,8 @@ export function detectFailedTier(
|
|||||||
|
|
||||||
/** Check if Claude exit indicates provider error (vs normal user exit) */
|
/** Check if Claude exit indicates provider error (vs normal user exit) */
|
||||||
export function isProviderError(exitCode: number, stderr: string): boolean {
|
export function isProviderError(exitCode: number, stderr: string): boolean {
|
||||||
|
// Exit code 0 means success, even if stderr has error-like output
|
||||||
|
// (could be warnings, debug info, etc.)
|
||||||
if (exitCode === 0) return false;
|
if (exitCode === 0) return false;
|
||||||
return PROVIDER_ERROR_PATTERNS.some((p) => p.test(stderr));
|
return PROVIDER_ERROR_PATTERNS.some((p) => p.test(stderr));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -147,6 +147,20 @@ describe('detectFailedTier', () => {
|
|||||||
// Should still match because model name is substring
|
// Should still match because model name is substring
|
||||||
expect(result).toBe('opus');
|
expect(result).toBe('opus');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should strip complex thinking suffix with comma-separated params', () => {
|
||||||
|
const tiersWithComplexBudget: typeof tiers = {
|
||||||
|
opus: { provider: 'agy', model: 'claude-opus-4-6-thinking(32768,extended)' },
|
||||||
|
sonnet: { provider: 'agy', model: 'claude-sonnet-4-5-thinking(high)' },
|
||||||
|
haiku: { provider: 'agy', model: 'claude-3-5-haiku' },
|
||||||
|
};
|
||||||
|
|
||||||
|
// Stderr contains base model name without suffix
|
||||||
|
const stderr = 'Error: claude-opus-4-6-thinking overloaded';
|
||||||
|
const result = detectFailedTier(stderr, tiersWithComplexBudget);
|
||||||
|
// Should match because regex strips (32768,extended) to get base name
|
||||||
|
expect(result).toBe('opus');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// ========================================
|
// ========================================
|
||||||
|
|||||||
Reference in New Issue
Block a user