Repository navigation
fix(client): let clients drop tool-result image payloads from the store - #59101
Conversation
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
There was a problem hiding this comment.
Looks good. When omitToolFileData is set, inline data: payloads are dropped in every path that puts tool results into the store: the live session.tool.success/session.tool.failed events and both message fetch paths (first page and older pages). The only other fetched message, the model-switched reload, has no tool content. file: URIs are left alone. I ran the new test in solid-data.test.ts together with solid-refresh.test.ts (both pass), checked that the new test fails on the base, and ran typecheck:tsc in client and tui (both pass).
Public API: adds an optional omitToolFileData option to createData in @opencode/client. It is off by default, so it is backwards compatible.
Backport of #58427 and #58560 from
beta.Problem
Tool results can carry screenshots as inline
data:files. The store kept every one as base64, so a long session with browser or computer-use tools held hundreds of MB, even in a client that never shows those images.Change
omitToolFileDataoption oncreateData: off by default. When set, inlinedata:files in tool results become an emptydata:<mime>;base64,URI, so the item still says what it was.file:and other URIs are untouched.session.tool.successandsession.tool.failedevents, and fetched message pages.mime, not sliced from the original, because a V8 sliced string keeps the whole payload alive.No client turns it on yet. The desktop sets it with the beta desktop merge; the TUI is unchanged.
Testing
typecheck:tscpasses in client, tui and app.client/test/solid-data.test.tscase: fetched and live tool results drop inlinedata:payloads and keep other files. It passes withclient/test/solid-refresh.test.ts.Added by the opencode bot (AI-generated).
Public API: adds the optional
omitToolFileDataoption tocreateDatain the client package (off by default, backwards compatible)