Repository navigation
fix(agents): refresh provider stream timeouts on chunks - #76633
Conversation
|
Codex review: needs maintainer review before merge. Summary Reproducibility: yes. source-level reproduction is high confidence: current main uses a one-shot guarded fetch timer with no chunk refresh, and #76307 includes matching cross-channel timeout logs. I did not run the reporter's live OpenAI prompt in this read-only review. Next step before merge Security Review detailsBest possible solution: Land the narrow timeout-refresh patch once exact-head checks are green, preserving the linked issue closure on merge. Do we have a high-confidence way to reproduce the issue? Yes, source-level reproduction is high confidence: current main uses a one-shot guarded fetch timer with no chunk refresh, and #76307 includes matching cross-channel timeout logs. I did not run the reporter's live OpenAI prompt in this read-only review. Is this the best way to solve the issue? Yes. Refreshing the guarded timeout at the raw provider response wrapper is the narrow shared fix, and the explicit timeout payload path prevents partial assistant fragments from being finalized as successful replies. What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 0f66ad4243c0. |
|
Merged via rebase at 4fff254. Validation:
Thanks @MKDev11. |
Summary
Describe the problem and fix in 2-5 bullets:
Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
Root Cause (if applicable)
For bug fixes or regressions, explain why this happened, not just what changed. Otherwise write
N/A. If the cause is unclear, writeUnknown.buildTimeoutAbortSignalused a one-shot timeout around provider fetches, so an active long-running stream could be aborted after the original deadline even when chunks were still arriving.Regression Test Plan (if applicable)
For bug fixes or regressions, name the smallest reliable test coverage that should catch this. Otherwise write
N/A.src/utils/fetch-timeout.test.tssrc/agents/provider-transport-fetch.test.tssrc/agents/pi-embedded-runner/run.overflow-compaction.loop.test.tsUser-visible / Behavior Changes
Long streamed assistant replies should no longer truncate solely because the original provider fetch timeout elapsed while chunks were still arriving. If a prompt stream truly times out, users should see an explicit timeout error instead of a short partial assistant fragment.
Diagram (if applicable)
Security Impact (required)
Yes/No) NoYes/No) NoYes/No) NoYes/No) NoYes/No) NoYes, explain risk + mitigation: N/ARepro + Verification
Environment
api: openai-completionswithgpt-5.5Steps
Expected
Actual
Evidence
Regression evidence:
refreshTimeoutwas called0times instead of2.pnpm test src/utils/fetch-timeout.test.ts src/agents/provider-transport-fetch.test.ts src/agents/pi-embedded-runner/run.overflow-compaction.loop.test.tspnpm test src/agents/pi-embedded-runner/run.timeout-triggered-compaction.test.ts src/agents/provider-transport-fetch.test.tspnpm test src/utils/fetch-timeout.test.ts src/agents/provider-transport-fetch.test.ts src/agents/pi-embedded-runner/run.overflow-compaction.loop.test.ts src/agents/pi-embedded-runner/run.timeout-triggered-compaction.test.tspnpm check:changedpnpm test src/agents/openai-transport-stream.test.tsHuman Verification (required)
What you personally verified (not just CI), and how:
AI Assistance
Review Conversations
If a bot review conversation is addressed by this PR, resolve that conversation yourself. Do not leave bot review conversation cleanup for maintainers.
Compatibility / Migration
Yes/No) YesYes/No) NoYes/No) NoRisks and Mitigations