fix(core): avoid duplicate image bytes in tool events#36524
Conversation
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
|
The required issue is #36343, and it is cross-linked from the issue timeline. The |
df0fad9 to
50c74ce
Compare
|
Rebased this patch onto the current |
50c74ce to
8739d55
Compare
Fixes anomalyco#36343 Co-Authored-By: Aiden <aiden@weco.ai>
8739d55 to
bc10c77
Compare
Issue for this PR
Closes #36343
Type of change
What does this PR do?
Production-shaped image tool output can store the same base64 bytes in both
structured.contentand a model-visiblecontent[].uri. This change omitsstructured.contentonly when the value is non-empty canonical base64, both MIME types match a supported image type, and a file item contains the exact matching data URI.Mismatched, unsupported, empty, invalid, non-media, and provider-executed compatibility data remain intact.
On the incident-shaped PNG fixture, the durable event fell from
2,007,411to1,003,986bytes (49.986%), base64 occurrences fell from two to one, and chunked SSE remained parseable. This addresses local duplicate media bytes; the broader bounded-projection design remains tracked in #36444.Supplementary autoresearch: public trajectory
How did you verify your code works?
git diff --checkpassedScreenshots / recordings
Not applicable; this changes a durable event projection with no UI changes.
Checklist