fix(providers): name the header phase on streaming OpenAI requests - #6288
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryLow Risk Overview The fix introduces a shared A transport test runs with Reviewed by Cursor Bugbot for commit 0343bb9. Configure here. |
Greptile SummaryThe PR moves response-header transport-failure annotation into the shared outbound request helper so streaming and non-streaming OpenAI Responses requests receive consistent diagnostics.
Confidence Score: 5/5The PR appears safe to merge, with the shared helper consistently annotating streaming and non-streaming header failures. The refactor preserves fetch arguments, retry timing, and abort recognition while extending the existing transport diagnostics to streaming paths, and no actionable regression remains.
|
| Filename | Overview |
|---|---|
| apps/sim/providers/openai/core.ts | Centralizes outbound fetch execution and response-header failure annotation without changing request arguments, fallback behavior, or abort classification. |
| apps/sim/providers/openai/core.transport-phase.test.ts | Adds focused regression coverage confirming streaming header timeouts include phase and elapsed-time diagnostics. |
Sequence Diagram
sequenceDiagram
participant Caller as Streaming or non-streaming caller
participant Fetcher as fetchResponsesWithSummaryFallback
participant Post as postOnce
participant OpenAI as OpenAI endpoint
Caller->>Fetcher: payload, startedAt, abortSignal
Fetcher->>Post: initial request
Post->>OpenAI: POST Responses request
alt Fetch rejects before headers
Post-->>Caller: annotated transport failure
else Reasoning summaries rejected
Fetcher->>Post: retry without summary
Post->>OpenAI: POST fallback request
Post-->>Caller: response or annotated failure
else Request succeeds
OpenAI-->>Caller: response
end
Reviews (1): Last reviewed commit: "fix(providers): name the header phase on..." | Re-trigger Greptile
Summary
fetchResponsesWithSummaryFallbackdirectly and never reachpostResponses, which is where fix(providers): name the failing phase of a stalled OpenAI call, and reject a failed generation #6283 put the header-phase annotation — so a chat or SSE run that stalled waiting for headers still surfaced the bare runtimeTimeoutError: The operation timed out.with no phase, elapsed time, or request idfetchImplblocks collapse into a singlepostOncehelper, andpostResponsesloses its now-redundant try/catchCaught by Greptile on #6283. Non-streaming was already covered (webhook, scheduled, async, and sync-API runs are all non-streaming), so this closes the gap for chat, SSE, and streaming-mode API calls.
Type of Change
Testing
Added a test that a streaming request whose fetch rejects with a
TimeoutErrorcarriesphase=awaiting-response-headersandelapsedMs. Verified it fails without the fix (along with the existing non-streaming header test), then passes with it.Providers + agent-handler suites: 109 files / 1416 tests passing. Typecheck, lint, and
check:api-validationclean.Checklist