fix(daemon): don't persist browser previews to the transcript#167
Merged
Conversation
Browser preview events (`SessionEvent::BrowserPreview`) carry a full-size Chrome screenshot as a base64 PNG. They were falling through to `append_event`, writing each screenshot as a line in transcript.jsonl — bloating the file and slowing every load (`read_transcript` reads and JSON-parses every line, and `session.transcript` ships the lot over the wire). Since previews are ephemeral, live-only UI that clients now render only from the live broadcast (never from transcript replay), the persisted images had no consumer; they also leaked into model context via `agentd_get_transcript`. Skip persistence and broadcast to live clients only — the same treatment `AgentStatus` already gets. The live overlay + matrix-rain wallpaper are unaffected (both fed by the broadcast). Existing transcripts are left as-is.
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.
Browser preview events (
SessionEvent::BrowserPreview) carry a full-size Chrome screenshot as a base64 PNG. They were falling through toappend_event, so each screenshot was written as a line intranscript.jsonl.Why this is a problem
adapter-zarvis/.../tools/browser.rs— no shrink before emit; base64 adds ~33%). Everybrowser_open/browser_screenshotpreview added a 50 KB–500 KB+ line.read_transcriptreads and JSON-parses every line, andsession.transcriptships the whole result over the wire — so each client load (TUI hydration / webuiloadTranscript) paid for all those big lines.BrowserPreviewduring transcript replay. The persisted images were pure dead weight.agentd_get_transcript(MCP) returns the raw transcript JSON to the model, so persisted previews could dump full base64 screenshots into model context — exactly whatBrowserPreview's doc says not to do.Fix
Skip persistence for
BrowserPreviewand broadcast to live clients only — the same treatmentAgentStatus(also ephemeral live UI state) already gets. Returns beforeappend_event.The live overlay + matrix-rain wallpaper are unaffected (both fed by the broadcast, not the transcript). Existing
transcript.jsonlfiles are left as-is (not retroactively cleaned).Tests
browser_preview_is_not_persisted_to_transcript: emits aBrowserPreview+ a controlMessageviahandle_event, then asserts the transcript contains theMessagebut not theBrowserPreview.🤖 Generated with Claude Code