fix(opencode): extend summary status timeout

This commit is contained in:
infiniti 2026-05-28 00:39:53 +03:00 committed by GitHub
parent 6fbba5feb9
commit fa36d7f3c0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 6 deletions

View file

@ -26,6 +26,7 @@ const logger = createLogger('ClaudeMultimodelBridgeService');
const PROVIDER_STATUS_TIMEOUT_MS = 90_000; const PROVIDER_STATUS_TIMEOUT_MS = 90_000;
const PROVIDER_STATUS_SUMMARY_TIMEOUT_MS = 30_000; const PROVIDER_STATUS_SUMMARY_TIMEOUT_MS = 30_000;
const LEGACY_FALLBACK_PROVIDER_STATUS_SUMMARY_TIMEOUT_MS = 5_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 LEGACY_PROVIDER_AUTH_TIMEOUT_MS = 15_000;
const PROVIDER_MODELS_TIMEOUT_MS = 25_000; const PROVIDER_MODELS_TIMEOUT_MS = 25_000;
const PROVIDER_STATUS_MAX_BUFFER_BYTES = 8 * 1024 * 1024; const PROVIDER_STATUS_MAX_BUFFER_BYTES = 8 * 1024 * 1024;
@ -891,10 +892,11 @@ export class ClaudeMultimodelBridgeService {
options: { summary?: boolean; timeoutMs?: number } options: { summary?: boolean; timeoutMs?: number }
): number { ): number {
if (options.summary && this.shouldUseLegacyProviderTimeoutFallback(providerId)) { if (options.summary && this.shouldUseLegacyProviderTimeoutFallback(providerId)) {
return Math.min( const fallbackTimeout =
options.timeoutMs ?? PROVIDER_STATUS_SUMMARY_TIMEOUT_MS, providerId === 'opencode'
LEGACY_FALLBACK_PROVIDER_STATUS_SUMMARY_TIMEOUT_MS ? 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 ( return (
options.timeoutMs ?? options.timeoutMs ??

View file

@ -467,7 +467,7 @@ describe('ClaudeMultimodelBridgeService', () => {
'runtime status --json --provider opencode --summary', 'runtime status --json --provider opencode --summary',
'model list --json --provider opencode', '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(); vi.mocked(console.warn).mockClear();
}); });
@ -642,7 +642,7 @@ describe('ClaudeMultimodelBridgeService', () => {
expect(execCliMock).toHaveBeenCalledTimes(8); expect(execCliMock).toHaveBeenCalledTimes(8);
expect( expect(
execCliMock.mock.calls.map((call) => call[2]?.timeout as number).sort((a, b) => a - b) 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(calls).toEqual(
expect.arrayContaining([ expect.arrayContaining([
'runtime status --json --provider anthropic --summary', 'runtime status --json --provider anthropic --summary',