Skip to content

Commit abbf467

Browse files
authored
fix: use dynamic timeout value in key_validation_timeout log messages
Agent-Logs-Url: https://github.com/github/gh-aw-firewall/sessions/7ec635c1-158c-4da1-b031-1cb92243b56d
1 parent 1ee5791 commit abbf467

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

containers/api-proxy/server.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,7 @@ async function validateApiKeys(overrides = {}) {
444444
const geminiTarget = overrides.geminiTarget !== undefined ? overrides.geminiTarget : GEMINI_API_TARGET;
445445
const geminiBasePath = overrides.geminiBasePath !== undefined ? overrides.geminiBasePath : GEMINI_API_BASE_PATH;
446446
const probeOpts = overrides.timeoutMs !== undefined ? { timeoutMs: overrides.timeoutMs } : {};
447+
const timeoutSecs = Math.round((probeOpts.timeoutMs || 10000) / 1000);
447448

448449
const tasks = [];
449450

@@ -464,7 +465,7 @@ async function validateApiKeys(overrides = {}) {
464465
} else if (r.result === 'failed') {
465466
logRequest('error', 'key_validation_failed', { provider: 'openai', status: r.status, message: 'OpenAI API key is invalid or expired. Requests to this provider will fail.' });
466467
} else if (r.result === 'timeout') {
467-
logRequest('warn', 'key_validation_timeout', { provider: 'openai', message: 'Key validation timed out after 10s — network may not be ready' });
468+
logRequest('warn', 'key_validation_timeout', { provider: 'openai', message: `Key validation timed out after ${timeoutSecs}s — network may not be ready` });
468469
} else {
469470
logRequest('warn', 'key_validation_error', { provider: 'openai', message: `Key validation probe failed unexpectedly (status: ${r.status}, error: ${r.error || 'unknown'})` });
470471
}
@@ -497,7 +498,7 @@ async function validateApiKeys(overrides = {}) {
497498
} else if (r.result === 'failed') {
498499
logRequest('error', 'key_validation_failed', { provider: 'anthropic', status: r.status, message: 'Anthropic API key is invalid or expired. Requests to this provider will fail.' });
499500
} else if (r.result === 'timeout') {
500-
logRequest('warn', 'key_validation_timeout', { provider: 'anthropic', message: 'Key validation timed out after 10s — network may not be ready' });
501+
logRequest('warn', 'key_validation_timeout', { provider: 'anthropic', message: `Key validation timed out after ${timeoutSecs}s — network may not be ready` });
501502
} else {
502503
logRequest('warn', 'key_validation_error', { provider: 'anthropic', message: `Key validation probe failed unexpectedly (status: ${r.status}, error: ${r.error || 'unknown'})` });
503504
}
@@ -525,7 +526,7 @@ async function validateApiKeys(overrides = {}) {
525526
} else if (r.result === 'failed') {
526527
logRequest('error', 'key_validation_failed', { provider: 'copilot', status: r.status, message: 'Copilot GitHub token is invalid or expired. Requests to this provider will fail.' });
527528
} else if (r.result === 'timeout') {
528-
logRequest('warn', 'key_validation_timeout', { provider: 'copilot', message: 'Key validation timed out after 10s — network may not be ready' });
529+
logRequest('warn', 'key_validation_timeout', { provider: 'copilot', message: `Key validation timed out after ${timeoutSecs}s — network may not be ready` });
529530
} else {
530531
logRequest('warn', 'key_validation_error', { provider: 'copilot', message: `Key validation probe failed unexpectedly (status: ${r.status}, error: ${r.error || 'unknown'})` });
531532
}
@@ -558,7 +559,7 @@ async function validateApiKeys(overrides = {}) {
558559
} else if (r.result === 'failed') {
559560
logRequest('error', 'key_validation_failed', { provider: 'gemini', status: r.status, message: 'Gemini API key is invalid or expired. Requests to this provider will fail.' });
560561
} else if (r.result === 'timeout') {
561-
logRequest('warn', 'key_validation_timeout', { provider: 'gemini', message: 'Key validation timed out after 10s — network may not be ready' });
562+
logRequest('warn', 'key_validation_timeout', { provider: 'gemini', message: `Key validation timed out after ${timeoutSecs}s — network may not be ready` });
562563
} else {
563564
logRequest('warn', 'key_validation_error', { provider: 'gemini', message: `Key validation probe failed unexpectedly (status: ${r.status}, error: ${r.error || 'unknown'})` });
564565
}

0 commit comments

Comments
 (0)