[codex] Stream native providers for first-token deadlines#63
Conversation
|
Warning Review limit reached
Next review available in: 36 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (8)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
a9ec9a1 to
c3b3d0d
Compare
…test dispatcher wiring stream_anthropic and stream_google repeated the whole httpx-SSE scaffolding (open under the first-token deadline, non-2xx classification, the data:/[DONE]/ json line loop, the stream_interrupted/network exception mapping, the empty-content guard) around a small per-provider event parse. Extract that skeleton once as common.drive_http_sse(...) driving a StreamAcc the provider's on_event folds into; each adapter keeps only its wire-event parse and its token-key finalize. Two real consumers, so this is minimality, not speculation (Axis 1/3). Bedrock is NOT a consumer: its transport is the boto3 event stream, not httpx SSE — forcing it under the same driver would be mechanism for a shape it does not share. Also: extract the identical no-op emit used to drive a stream as a non-stream call into common.ignore_delta (was inlined in anthropic/google/bedrock call()), and add the missing coverage for the serve.py wiring — native api_kinds must reach their real stream backend, not stream_unsupported (test_providers). Behaviour-preserving: full suite 456 passed / 2 skipped against compose Postgres (454 before + the 2 new dispatcher tests), identical pass set otherwise.
c3b3d0d to
4e32cb2
Compare
Summary
streamGenerateContent, and BedrockConverseStream.first_token_timeout_msis present, so native providers can satisfy the same first-output deadline contract as OpenAI-compatible routes.serve.pyinstead of returningstreaming unsupportedfor native api kinds.Notes
This is stacked on #62 (
codex/first-token-wall-clock). #62 defines the wall-clock first-token contract; this PR extends that contract to native Anthropic, Gemini, and Bedrock paths.For native streams, the timeout stops once the provider produces text or tool-call output. Text deltas are emitted immediately; tool-only starts are aggregated and returned for pseudo-streaming/final response handling if no text delta was emitted.
Validation
.venv/bin/python -m pytest tests/test_native_providers.py tests/test_providers.py tests/test_streaming.py tests/test_codex.py tests/test_antseed_concurrency.py::test_first_token_timeout_uses_internal_streaming_for_json_calls -q(54 passed; pytest cache warning only because checkout is outside writable sandbox root).venv/bin/python -m pytest tests/test_live_wiring.py -q(11 passed).venv/bin/python -m pytest tests/test_native_providers.py tests/test_providers.py -q(19 passed; after cleanup)git diff --checkPYTHONPYCACHEPREFIX=/private/tmp/unhardcoded-pycache .venv/bin/python -m py_compile provider_adapters/common.py provider_adapters/anthropic.py provider_adapters/google.py provider_adapters/bedrock.py providers.py serve.py tests/test_native_providers.py tests/test_providers.py