fix: add default 120s request timeout when provider timeoutSeconds is not configured#79770
fix: add default 120s request timeout when provider timeoutSeconds is not configured#79770Andrew199012 wants to merge 1 commit into
Conversation
… not configured
When models.providers.<id>.timeoutSeconds is not set in config.yaml,
resolveProviderRequestTimeoutMs() returns undefined, which cascades
through buildTimeoutAbortSignal({timeoutMs: undefined}) → no AbortSignal
→ fetch() hangs indefinitely on TCP connections.
This is a P0 defect causing session stalls when upstream API (e.g.
DeepSeek) takes long to respond, leading to event loop congestion and
system unresponsiveness.
Fix: return DEFAULT_REQUEST_TIMEOUT_MS (120s) as fallback instead of
undefined, matching the common expectation that all HTTP requests
should have a bounded timeout.
|
Codex review: needs real behavior proof before merge. Summary Reproducibility: yes. for the PR-introduced regression: source inspection shows the new fallback would set Real behavior proof Next step before merge Security Review findings
Review detailsBest possible solution: Bound slow cloud/provider HTTP requests without assigning implicit Do we have a high-confidence way to reproduce the issue? Yes for the PR-introduced regression: source inspection shows the new fallback would set Is this the best way to solve the issue? No. A global fallback inside Full review comments:
Overall correctness: patch is incorrect Acceptance criteria:
What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 862be9fb3d6c. |
|
Closing this as superseded by #83979 and not the right fix shape for the current timeout contract. Current The landed path in #83979 keeps the safer split:
Closing this PR rather than carrying a stale competing timeout implementation. |
Problem
When
models.providers.<id>.timeoutSecondsis not configured,resolveProviderRequestTimeoutMs()returnsundefined. This cascades through the entire timeout chain:buildTimeoutAbortSignal({timeoutMs: undefined})returns{signal: undefined}fetch()called without any abort signalThis is a P0 defect: a slow API response blocks the session forever, causing event loop congestion (CPU 68%+) and system unresponsiveness until Gateway restart.
Fix
Return
DEFAULT_REQUEST_TIMEOUT_MS(120 seconds) whentimeoutSecondsis not configured/invalid, instead ofundefined.The code already has full timeout infrastructure (
buildTimeoutAbortSignal,AbortController,fetchWithSsrFGuard), it just lacked a safe default fallback.Testing
npx tsc --noEmitpassesresolveProviderRequestTimeoutMsRelated
Fixes a P0 production incident where slow DeepSeek API responses caused session-level deadlock in OpenClaw Gateway (see investigation report).