mirror of
https://github.com/instructkr/claude-code.git
synced 2026-06-06 04:06:45 +00:00
feat: API timeout config, Retry-After header, configurable retry, and 400 transient retry
Cherry-picked from PR #2816 onto current upstream/main, resolving conflicts from PR #3015's merge (which added retry_after to ApiError but some construction sites were missing it). Commits preserved: -ade85398: API timeout config, Retry-After header, configurable retry - TimeoutConfig in HTTP client builder (connect 30s, request 5min) - CLAW_API_CONNECT_TIMEOUT and CLAW_API_REQUEST_TIMEOUT env vars - Retry-After header parsing on 429 responses - ApiTimeoutConfig in runtime config (settings.json) -8a883430: retry 400 responses with transient gateway error bodies - Detects known gateway phrases in 400 response bodies - Marks them as retryable instead of hard-failing -ed91a61e: add 'no parseable body' to CONTEXT_WINDOW_ERROR_MARKERS - Some providers return 400 with 'no parseable body' for oversized requests instead of a proper context_length_exceeded error Commits skipped (already in upstream via PR #3015): -453ab642: optional id field (already merged) -baa8d1ba: HTML detection in streaming (already merged) -33d2f789: JSON error detection in streaming (already merged) 8 files changed, 299 insertions, 80 deletions
This commit is contained in:
@@ -1184,10 +1184,8 @@ fn parse_optional_api_timeout_config(root: &JsonValue) -> Result<ApiTimeoutConfi
|
||||
return Ok(ApiTimeoutConfig::default());
|
||||
};
|
||||
let context = "merged settings.apiTimeout";
|
||||
let connect_timeout_secs = optional_u64(obj, "connectTimeout", context)?
|
||||
.unwrap_or(30);
|
||||
let request_timeout_secs = optional_u64(obj, "requestTimeout", context)?
|
||||
.unwrap_or(300);
|
||||
let connect_timeout_secs = optional_u64(obj, "connectTimeout", context)?.unwrap_or(30);
|
||||
let request_timeout_secs = optional_u64(obj, "requestTimeout", context)?.unwrap_or(300);
|
||||
let max_retries = optional_u64(obj, "maxRetries", context)?
|
||||
.map(|v| v as u32)
|
||||
.unwrap_or(8);
|
||||
|
||||
Reference in New Issue
Block a user