Update Cloudflare Deployment guide#3
Closed
nicosuave wants to merge 1 commit into
Closed
Conversation
I work with Cloudflare infrastructure a decent amount and Cloudflare Containers are definitely what you want here!
rustyconover
added a commit
that referenced
this pull request
Apr 28, 2026
Three related cleanups, finishing the symmetry between init and exchange paths and between producer and exchange shapes. #1: producer continuations now populate the access log's response_state. ``_run_http_producer_turn`` is refactored to take an ``outcome: _DispatchOutcome`` parameter and mutate it directly (matching ``_run_http_exchange_turn``'s pattern), instead of returning a ``(buf, error_type, error_message)`` tuple that the caller bridged into outcome by hand. When the loop mints a continuation token it now sets ``outcome.response_state_bytes = state_bytes`` — closing a real telemetry gap where producer-continuation access-log records were missing the issued state's bytes. #3: drop the auth/transport_metadata contextvar fallback inside ``_run_http_producer_turn``. Both call sites now pass them explicitly; the helper signature requires ``auth: AuthContext`` and ``transport_metadata: Mapping[str, Any]`` (no defaults, no fallback). Removes one redundant ``_get_auth_and_metadata()`` call per producer continuation and matches the explicit-parameter pattern we already established for ``stream_id``. #2: split the init dispatcher's producer/exchange branches into ``_run_http_producer_init`` and ``_run_http_exchange_init``, mirroring ``_run_http_producer_turn`` / ``_run_http_exchange_turn`` on the exchange-sync side. ``_run_stream_init_sync`` is now a thin router: _run_stream_init_sync ├─ result.input_schema == _EMPTY_SCHEMA → _run_http_producer_init └─ else → _run_http_exchange_init Each helper owns its own header-write + body-shape logic; the dispatcher is just request validation, ctx injection, stream_id generation, and the telemetry shell wrapping the impl call. Verification: * ruff format / ruff check / mypy / ty: clean. * HTTP conformance against regular worker: 97 pass / 4 skip. * HTTP conformance against strict-cap worker: 99 pass / 2 skip. * Full pytest: 2986 passed. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I work with Cloudflare infrastructure a decent amount and Cloudflare Containers are definitely what you want here!