fix(session): restore session summary from per-turn diffs (#30877)#33444
Open
aic0d3r wants to merge 2 commits into
Open
fix(session): restore session summary from per-turn diffs (#30877)#33444aic0d3r wants to merge 2 commits into
aic0d3r wants to merge 2 commits into
Conversation
anomalyco#30127 zeroed the session-level summary (files/additions/deletions) for performance and kept only message-scoped turn diffs. The TUI sidebar "Modified Files" section reads the session-level aggregate, so it has been empty since v1.16.0 (anomalyco#30877, anomalyco#32852). Re-aggregate session.summary from the cheap per-message turn diffs that anomalyco#30127 preserved. Each turn already computes and stores its diff on the message; summing those into the session summary avoids the expensive full-session snapshot recompute that anomalyco#30127 removed. Each touched file appears once (last turn wins), matching the pre-anomalyco#30127 sidebar behavior.
Assistant messages have summary: boolean, not the structured Summary with diffs. Only user messages carry per-turn diffs.
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.
Issue for this PR
Closes #30877
Type of change
What does this PR do?
#30127 zeroed
session.summary(files: 0, additions: 0, deletions: 0, empty diff event) to fix a performance issue with full-session snapshot diffs. Per-message turn diffs (session.diff({ messageID })) were kept, but the TUI sidebar reads the session-level aggregate — which is now always empty. This is why "Modified Files" has been blank since v1.16.0.This PR re-aggregates
session.summaryfrom the per-message turn diffs that #30127 preserved. After the existing per-turncomputeDiffruns and stores its result on the message, we sum all messages'info.summary.diffsinto the session-level summary. Each touched file appears once (last turn wins).This does not reintroduce the expensive full-session snapshot diff — it only reads already-computed per-message metadata.
One file changed:
packages/opencode/src/session/summary.ts, thesummarizefunction.How did you verify your code works?
bun typecheckfrompackages/opencode— clean, no errors insummary.tssummary_files=0, summary_diffs=(empty)summary_files=1, summary_additions=1, summary_deletions=1, summary_diffs=[{file:"sample.txt",...}]Screenshots / recordings
Restores existing sidebar behavior, no visual design change.
Checklist