fix(opencode): extend summary status timeout
This commit is contained in:
parent
6fbba5feb9
commit
fa36d7f3c0
2 changed files with 8 additions and 6 deletions
|
|
@ -26,6 +26,7 @@ const logger = createLogger('ClaudeMultimodelBridgeService');
|
|||
const PROVIDER_STATUS_TIMEOUT_MS = 90_000;
|
||||
const PROVIDER_STATUS_SUMMARY_TIMEOUT_MS = 30_000;
|
||||
const LEGACY_FALLBACK_PROVIDER_STATUS_SUMMARY_TIMEOUT_MS = 5_000;
|
||||
const OPENCODE_FALLBACK_PROVIDER_STATUS_SUMMARY_TIMEOUT_MS = 12_000;
|
||||
const LEGACY_PROVIDER_AUTH_TIMEOUT_MS = 15_000;
|
||||
const PROVIDER_MODELS_TIMEOUT_MS = 25_000;
|
||||
const PROVIDER_STATUS_MAX_BUFFER_BYTES = 8 * 1024 * 1024;
|
||||
|
|
@ -891,10 +892,11 @@ export class ClaudeMultimodelBridgeService {
|
|||
options: { summary?: boolean; timeoutMs?: number }
|
||||
): number {
|
||||
if (options.summary && this.shouldUseLegacyProviderTimeoutFallback(providerId)) {
|
||||
return Math.min(
|
||||
options.timeoutMs ?? PROVIDER_STATUS_SUMMARY_TIMEOUT_MS,
|
||||
LEGACY_FALLBACK_PROVIDER_STATUS_SUMMARY_TIMEOUT_MS
|
||||
);
|
||||
const fallbackTimeout =
|
||||
providerId === 'opencode'
|
||||
? OPENCODE_FALLBACK_PROVIDER_STATUS_SUMMARY_TIMEOUT_MS
|
||||
: LEGACY_FALLBACK_PROVIDER_STATUS_SUMMARY_TIMEOUT_MS;
|
||||
return Math.min(options.timeoutMs ?? PROVIDER_STATUS_SUMMARY_TIMEOUT_MS, fallbackTimeout);
|
||||
}
|
||||
return (
|
||||
options.timeoutMs ??
|
||||
|
|
|
|||
|
|
@ -467,7 +467,7 @@ describe('ClaudeMultimodelBridgeService', () => {
|
|||
'runtime status --json --provider opencode --summary',
|
||||
'model list --json --provider opencode',
|
||||
]);
|
||||
expect(execCliMock.mock.calls[0][2]?.timeout).toBe(5000);
|
||||
expect(execCliMock.mock.calls[0][2]?.timeout).toBe(12000);
|
||||
vi.mocked(console.warn).mockClear();
|
||||
});
|
||||
|
||||
|
|
@ -642,7 +642,7 @@ describe('ClaudeMultimodelBridgeService', () => {
|
|||
expect(execCliMock).toHaveBeenCalledTimes(8);
|
||||
expect(
|
||||
execCliMock.mock.calls.map((call) => call[2]?.timeout as number).sort((a, b) => a - b)
|
||||
).toEqual([5000, 5000, 5000, 15000, 15000, 25000, 25000, 25000]);
|
||||
).toEqual([5000, 5000, 12000, 15000, 15000, 25000, 25000, 25000]);
|
||||
expect(calls).toEqual(
|
||||
expect.arrayContaining([
|
||||
'runtime status --json --provider anthropic --summary',
|
||||
|
|
|
|||
Loading…
Reference in a new issue