Repository navigation
Preserve compaction metadata when a delta omits it - #1985
Open
sylvesterkaczmarek wants to merge 1 commit into
Open
sylvesterkaczmarek wants to merge 1 commit into
sylvesterkaczmarek wants to merge 1 commit into
Conversation
Signed-off-by: Sylvester Kaczmarek <16242628+sylvesterkaczmarek@users.noreply.github.com>
Author
|
The regression and related tests pass locally; the PR description includes the validation commands. Could a maintainer approve the pending CI workflow? |
sigley
approved these changes
Oct 7, 2026
sigley
left a comment
There was a problem hiding this comment.
Validated exact head 0a17e05 independently. The accumulator now updates encrypted_content only when the compaction delta actually supplied that field, preserving prior metadata on omission while still honoring explicit null and empty-string updates. The branch merges cleanly with current main; the stable and beta streaming suites pass 75/75, and compile/diff checks are clean. I do not see a blocking correctness issue.
Author
|
Thanks @sigley, appreciate the independent validation and approval. |
This branch has not been deployed
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.
Fixes #1984.
Update encrypted_content only when the compaction delta actually supplied the field. The existing model_fields_set compatibility property distinguishes omission from an explicit null on both Pydantic versions. Empty strings and nonempty replacements retain their current behavior.
The change affects the final accumulated block and emitted BetaCompactionEvent snapshots in synchronous and asynchronous beta streams. It leaves summary text assignment unchanged and is independent of the text-accumulation proposals in #1830 and #1665. The Go companion preserving compaction field presence and replay is anthropics/anthropic-sdk-go#467.
Validation
Eight regression cases cover sync/async omission, replacement, empty string and null. They check both event snapshots and serialized final messages. On unchanged main, the two omission cases fail and six controls pass.
The repository test script passes the related message-streaming suites on Python 3.14.7 and 3.10.16: 75 tests with Pydantic v2 on each, and 73 passed / 2 skipped with Pydantic v1 on Python 3.10. Its additional MCP v2 checks pass 39 tests on each interpreter.
Repository formatting and complete
./scripts/lintpass. Lint used the frozen all-extras environment so optional integration imports were available. No test assertions, dependency versions or workflow settings were weakened.Tested on macOS arm64 without live service calls. The complete generated API suite was not run.
Release note
Keep previously received compaction metadata when a later streaming delta omits encrypted_content, while honoring explicit null and empty updates.