Repository navigation
Conversation
This was referenced Oct 19, 2026
Open
gouveags
marked this pull request as ready for review
October 19, 2026 00:23
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.
Issue #, if available:
Related issue: #854.
Description of changes:
Generated clients currently send uncompressed requests even when an operation advertises the
requestCompressiontrait. This PR adds the shared runtime behavior, configuration, and protocol integration to compress eligible requests.smithy-httpimplements the shared compression policy.smithy-coreexposes the typed trait, andsmithy-aws-coreresolves configuration and applies the policy across AWS protocols. Generated AWS clients inherit the controls.The automatic mode uses the configured threshold. An explicit
request_compression_encoding="gzip"choice bypasses that threshold while still requiring operation support; unsupported choices and conflicting disable settings fail before sending. Compression is applied to the serialized body before SigV4 signing, updates the wire headers, and preserves identical compressed bytes for buffered-request retries. Streaming input follows modeled restrictions; this does not add streaming-input retry support. The implementation supports gzip under the current Smithy contract. Zstd needs separate contract and service agreement.We use AWS-hosted models for conversation-heavy agents. Request compression is useful here because uploading accumulated conversation and tool results contributes to the wait before the first token. Anthropic announced gzip in Claude Code, documented in its changelog, and OpenAI documents zstd on Responses. Those endpoint capabilities motivate the feature; their published material isn't a benchmark of this patch.
I'd appreciate feedback on the runtime boundary and configuration choices in this implementation. The companion AWS SDK contribution adopts the shared behavior; the botocore contribution adds a matching explicit choice to its existing implementation.
Modeled Bedrock Runtime operations still need service acceptance and updated upstream metadata. Mantle's provider-compatible APIs require separate API/client coordination. This contribution leaves unsupported operations' compression metadata unchanged.
Related contributions: botocore: PR; aws-sdk-python: PR.
Verification
Reviewed implementation commit:
ae0e7da0fdac9d8fc49884e539b7cf71eacb041b.The new HTTP request test failed before implementation because the request had no compression header. Additional regression tests caught conflicting shared configuration, the immutable trait values emitted by generated models, and missing async-generator cleanup after a partial gzip read. Real signer and transport regressions also caught eager stream buffering, excessive pre-upload reads, and corrupted buffered iterable rewinds. These cases now pass.
Validated with Python 3.12, Java 17, and the repository CI's Pandoc 3.8.2:
make test-py: 2,744 passed, 10 skipped, 93% aggregate coverage.make generate-protocol-tests: committed snapshots match regenerated output. Final runtime checks used.venv/bin/python -m pytest codegen-output: 785 passed, 32 expected failures across eight generated clients. All 12 request-compression protocol cases are enabled and pass.make build-javaandmake check-java: passed, including 61 Java tests.make lint-pyandmake check-py: passed; strict Pyright reported no errors.Coverage includes:
Generated snapshots were refreshed through the normal generator. These checks do not demonstrate endpoint acceptance or an end-to-end latency improvement.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.