fix(api): enforce API_TIMEOUT_MS for OpenAI-compatible headers (#1940)

* fix(api): enforce API_TIMEOUT_MS for OpenAI-compatible headers

* test(api): cover Copilot responses fallback deadlines

* fix(api): redact secrets in timeout URL paths

* fix(api): harden Copilot response deadlines

* fix(api): prevent header-timeout request replay

* fix(api): harden timeout cleanup and redaction

* fix(api): redact encoded transport credentials

* fix(api): harden deadline retries and URL redaction

* fix(api): preserve aborted fetch reasons

* fix(api): preserve caller abort reasons

* test(api): clear caller abort timer

* docs(api): clarify API_TIMEOUT_MS transport scope

* docs(api): explain timeout env loading

* fix(api): reset deadline for proxy retries

* fix(api): type deadline fetch adapter

* fix(api): honor abort cleanup and request signals

* fix(api): do not block proxy retries on body cancellation

---------

Co-authored-by: jatmn <the@jat.mn>
This commit is contained in:
Bogdan
2026-07-19 09:21:14 +08:00
committed by GitHub
co-authored by jatmn
parent eb72c770c4
commit 3808d19da4
11 changed files with 1611 additions and 78 deletions
+9 -2
View File
@@ -439,8 +439,15 @@ ANTHROPIC_API_KEY=sk-ant-your-key-here
# Turn on whichever audience you're debugging; both can run together.
# OPENCLAUDE_LOG_TOKEN_USAGE=verbose
# Custom timeout for API requests in milliseconds (default: varies)
# API_TIMEOUT_MS=60000
# Time-to-response-headers deadline for OpenAI-compatible API requests
# in milliseconds (default: 600000, or 10 minutes). Use a safe positive
# integer; invalid values use the default and values above 2147483647 are capped.
# This runtime setting must be exported from your shell or launcher; the
# provider env-file loader intentionally ignores runtime/debug knobs.
# This covers generic OpenAI-compatible requests, direct GitHub Copilot
# Responses, and Copilot chat-to-Responses fallback requests. First-party
# Codex OAuth Responses and the Anthropic SDK retain their existing handling.
# API_TIMEOUT_MS=600000
# Enable debug logging
# CLAUDE_DEBUG=1