Skip to content

fix(streaming): retain encrypted_content metadata when omitted from compaction_delta (#1984) - #1999

Open
iosayin wants to merge 1 commit into
anthropics:mainfrom
iosayin:fix/1984-compaction-delta-encrypted-content
Open

iosayin wants to merge 1 commit into
anthropics:mainfrom
iosayin:fix/1984-compaction-delta-encrypted-content

Conversation

@iosayin

@iosayin iosayin commented Oct 7, 2026

Copy link
Copy Markdown

Summary

Retains previously accumulated encrypted_content metadata on a compaction block when a subsequent compaction_delta does not include the encrypted_content field.

Previously, accumulate_event unconditionally assigned content.encrypted_content = event.delta.encrypted_content for every compaction_delta. Because BetaCompactionContentBlockDelta.encrypted_content defaults to None when omitted from the payload, a content-only update (e.g. {"type": "compaction_delta", "content": "Updated summary."}) cleared the previously accumulated metadata.

With this change, encrypted_content is only updated when explicitly provided in the delta payload ("encrypted_content" in model_fields_set(event.delta)), preserving previous metadata on content-only updates while still allowing explicit nulls to clear it.

Closes #1984

@iosayin
iosayin requested a review from a team as a code owner October 7, 2026 00:39

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A compaction delta without encrypted_content clears the accumulated metadata

1 participant