Bound SDK event logs while preserving screenshot evidence - #2899
Open
miguelg719 wants to merge 12 commits into
Open
Bound SDK event logs while preserving screenshot evidence#2899miguelg719 wants to merge 12 commits into
miguelg719 wants to merge 12 commits into
Conversation
|
…lidation-09-event-retention
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 21 files
Architecture diagram
sequenceDiagram
participant SDK as SDK Agent
participant Session as Session Runner
participant Classifier as harnessEventLogLevel
participant Logger as Harness Logger
participant Pi as Pi Session Compactor
participant Adapter as Pi Adapter
Note over SDK,Adapter: Event ingestion and logging classification
SDK->>Session: Emit raw event
Session->>Classifier: Classify event type
alt Stream delta or bare lifecycle
Classifier-->>Session: undefined (drop)
Session->>Logger: Skip logging
else Error event
Classifier-->>Session: level 1
Session->>Logger: Log with level 1
else Content event
Classifier-->>Session: level 2
Session->>Logger: Log with level 2
end
Note over Session,Adapter: Pi screenshot evidence pipeline
SDK->>Session: tool_execution_end with base64 image
Session->>Pi: compactPiEvent(event)
Pi->>Pi: Decode image block to Buffer
Pi-->>Session: Compacted event with bytes
Session->>Adapter: Pass compacted trajectory events
alt Buffer image block
Adapter->>Adapter: Use bytes directly
Adapter-->>Session: Image modality with Buffer
else Legacy base64 block
Adapter->>Adapter: Decode base64 to Buffer
Adapter-->>Session: Image modality with Buffer
end
Note over Session,Logger: Log sanitization
Session->>Session: withoutImageData(event)
Session->>Logger: Log with [image N bytes] placeholder
Logger-->>Session: Sanitized log entry
Note over Session,Adapter: Mastra event compaction
Session->>Session: compactMastraEvent(event)
alt Retained event type
Session-->>Session: Keep full event
else step-finish/finish
Session->>Session: Strip request/response bodies
Session-->>Session: Keep only stepResult and usage
end
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
…lidation-09-event-retention
…lidation-09-event-retention
…lidation-09-event-retention
…lidation-09-event-retention
…lidation-09-event-retention
akeimach
approved these changes
Sep 9, 2026
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.
Bounds retained SDK event logs while keeping actionable diagnostics and trajectory evidence. Pi screenshot compaction and its Buffer-aware trajectory consumer land together, preventing intermediate screenshot loss.
Validation: 118 SDK/event tests, five Pi adapter/pipeline tests, 12 build tasks, and SDK/core/eval typechecks passed. The pipeline test imports the actual built Pi compactor and checks retained image bytes for compacted Buffer and historical base64 events.
Stack position: 9/17. Base:
evals/consolidation-08-native-routing. Each PR contains the change relative to its immediate predecessor.Reviewer entry points:
packages/integrations/core/src/harness/eventLog.tspackages/integrations/pi-sdk/src/session.tspackages/evals/framework/harnesses/piAdapter.tsReadiness: local validation is described above; GitHub CI and automated review feedback are pending. This PR is open as non-draft so automated reviewers can run.
Summary by cubic
SDK event logs previously kept stream and lifecycle noise at visible level and retained repeated payloads; they now drop non-content fragments, keep completed events at debug level, and keep failures at level 1 across Claude, Codex, DeepAgents, Eve, Fx, Mastra, and Pi. This bounds diagnostics without changing model-facing results or trajectory evidence.
harnessEventLogLevelclassification with SDK-specific handling for nested tool failures, command failures, provider errors, and failed results.Buffervalues, removes duplicate base64 payloads from logs and non-assistant messages, and emits omission markers above the 8 MiB per-image or 64 MiB per-run limits.step-finishandfinishevents to remove repeated request bodies while preserving usage and trajectory data; log details are clipped after credential redaction.Written for commit 15fe01c. Summary will update on new commits.