You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE]: Store per-message diffs separately and lazy-load them #16741
I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
Describe the enhancement you want to request
OpenCode currently stores per-message file diffs inline on user messages via message.summary.diffs, where each diff item includes full before and after file contents.
This has a major downside for long-lived coding sessions: message rows can become extremely large, especially when a turn touches generated files, large source maps, workflow files, or other bulky assets. Since session open/switch flows still load message rows from the session database, this can noticeably slow down the desktop app when switching between sessions.
I’d like to request a change to make per-message diffs lazy-loaded instead of embedding the full diff payload in MessageTable.data.
Proposed direction
Keep lightweight per-message summary metadata inline on the message row (for example: title/body/files/additions/deletions)
Move the full per-message diff payload (before / after content) into separate storage, ideally a dedicated table keyed by message_id
Reuse or extend the existing diff API path so full per-message diffs are only fetched when the user actually opens turn-level review
Leave session-level review diffs as a separate/lazy path as well
Why this would help
Prevent very large message rows in SQLite
Improve session switching/opening performance in the desktop app
Reduce the cost of session prefetching
Keep the review UX intact while moving heavy payloads off the hot path
Why I think this is worth doing
From local investigation, the main database growth came from oversized message rows containing summary.diffs[].after content. The hot path cost came from deserializing large message JSON blobs during normal session loading.
Minimal implementation shape
A low-risk version of this could be:
add a message_diff table (or equivalent separate storage)
stop persisting full summary.diffs inline on user messages
keep only lightweight summary counts inline
make the existing diff fetch path support messageID-scoped lazy loading
update the turn review UI to fetch full per-message diffs only when needed
Activity
ualtinok commentedon Mar 12, 2026
Tagging also: #14543
github-actions commentedon Jul 4, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.