fix(event-buffer): re-compact the event with preserveUserFileBase64: false#4579
Conversation
…d, re-compact the event with preserveUserFileBase64: false
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview Adds a warning log when this fallback triggers, and still throws if the event remains too large after the second compaction. Reviewed by Cursor Bugbot for commit f0d2431. Configure here. |
Greptile SummaryThis PR adds a two-pass compaction fallback in
Confidence Score: 5/5Safe to merge — the fallback path is well-scoped, correctly avoids duplicate storage writes, and preserves the hard-failure contract for payloads that remain oversized after base64 stripping. The change is a focused, defensive fallback that only activates when No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[compactEventForBuffer] --> B{event has data?}
B -- No --> C[return event unchanged]
B -- Yes --> D[compactExecutionPayload\npass 1: preserveUserFileBase64=ctx.value]
D --> E[trimFinalBlockLogsForEventData]
E --> F[getJsonSize]
F --> G{preserveUserFileBase64 &&\nsize > THRESHOLD?}
G -- No --> H{size > THRESHOLD?}
G -- Yes --> I[compactExecutionPayload\npass 2: preserveUserFileBase64=false\nInput: already-compacted data]
I --> J[trimFinalBlockLogsForEventData]
J --> K[getJsonSize]
K --> L[logger.warn with byte counts]
L --> H
H -- No --> M[return event with compacted data]
H -- Yes --> N[throw Error: still too large]
Reviews (2): Last reviewed commit: "address comments" | Re-trigger Greptile |
|
@greptile |
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit f0d2431. Configure here.
Summary
When preserveUserFileBase64 is on and the event still exceeds the threshold, re-compact the event with preserveUserFileBase64: false. This drops inline base64 (clients can lazily fetch it via sim.files.readBase64) while keeping file metadata and the rest of the event intact, so the stream keeps flowing.
Type of Change
Testing
Tested manually
Checklist