fix(ai): delegate lazy stream watchdogs to transports - #3708
Conversation
Yeachan-Heo
left a comment
There was a problem hiding this comment.
REQUEST_CHANGES
Reviewed exact head 7ce66811479d6fc860065a0085b5ea508bc492f9 against current origin/dev c1bf3be50e2cf0dfdf51b57eb43f7a99521c94b8.
This PR is stale and must be rebased onto current dev before it can be merge-ready. The PR base is 2c99a7f226635e812bc8fe8669787242029ce662, not the requested current baseline. I inspected the watchdog handoff in packages/ai/src/providers/register-builtins.ts:235-261,436-232 and the transport-level signal/progress handling. The reviewed change preserves provider-owned raw watchdogs for OpenAI-family/Azure/Anthropic transports, keeps caller abort signals wired through those transports, and retains control-plane progress filtering; I found no additional security, credential-routing, fallback, or cancellation blocker in this exact diff.
Focused verification at the exact head passed: bun test packages/ai/test/openai-first-event-timeout.test.ts packages/ai/test/register-builtins.test.ts (27 pass). Rebase onto c1bf3be50e2cf0dfdf51b57eb43f7a99521c94b8, rerun the timeout/concurrency coverage, and do not merge this stale head.
—
[repo owner's gaebal-gajae (clawdbot) 🦞]
7ce6681 to
905aa90
Compare
|
Requested changes are addressed on head
Please re-review the updated head. |
905aa90 to
741beb3
Compare
The lazy provider wrapper watched normalized assistant events while several providers already watched richer raw transport events. That second clock could expire after transport-only progress, replace a live response with a blank generic stall error, and race provider-specific failure handling. Providers with raw watchdogs now own timeout decisions; the shared wrapper remains for providers that need it. OpenAI Completions now honors caller idle overrides internally, Azure shares the semantic Responses progress filter, and provider-owned paths preserve caller cancellation. Lore-id: e4a32f9c Constraint: providers without raw transport watchdogs retain the shared lazy watchdog Rejected: raise the global timeout | masks watchdog ownership and delays genuine stalls Confidence: high Scope-risk: medium Reversibility: code-only Tested: packages/ai check; 2153 package tests and 10224 assertions; 115 timeout and concurrency tests Not-tested: live provider outage recovery
741beb3 to
4702d26
Compare
|
Rebased and force-pushed the addressed head onto current
Please re-review this exact head. |
|
Signed: GJC / bounded AI transport owner review VERDICT: REQUEST_CHANGES Reviewed exact head Blocking timeout-parity regression: Keep the raw-event idle delegation, but preserve a setup/first-event bound until each marked provider has actually armed its transport watchdog, or pass and normalize the explicit first-event timeout through the Responses/Azure SDK request setup as Completions already does. Add lazy-path regression coverage for a fetch that never resolves before headers, including caller cancellation and provider-specific |
|
Could not reopen this PR after the force-push that addressed REQUEST_CHANGES (GitHub: state cannot be changed; branch was force-pushed or recreated). Replacement PR with the same branch/intent and the setup/first-event parity fix: #3829
|
Problem
The lazy provider wrapper measured idle time from normalized assistant events while OpenAI-family providers already watched richer raw transport events. Real transport progress such as
response.createdcould refresh only the provider watchdog, causing the outer wrapper to abort an active stream first.Changes
toolChoiceIncapabilityinside the first-event window.Rebase and delivery metadata
devf9dffed426a433bf4948bdeb8fb2fe76f25ef5ca4702d265e5d23744721fa5cd53498757604787a1upstream/dev.Verification on exact head
bun --cwd=packages/ai run check— passedbun test --timeout 20000 packages/ai— 2,153 passed, 337 skipped, 0 failed, 10,230 assertionsbun --cwd=packages/natives run build— passed (required by native-backed test loading)git diff --check upstream/dev...HEAD— passedThe focused suite includes first-event timeout, provider registration, abort-source, idle iterator, and caller-abort regression coverage. Live provider outage recovery was not tested; this change does not add retries or recovery for genuine outages.
Rollback
Revert the single PR commit
4702d265e5d23744721fa5cd53498757604787a1. No schema or data migration is involved.