Skip to content

fix(session): restore session summary from per-turn diffs (#30877)#33444

Open
aic0d3r wants to merge 2 commits into
anomalyco:devfrom
aic0d3r:fix/session-summary-aggregate-from-turn-diffs
Open

fix(session): restore session summary from per-turn diffs (#30877)#33444
aic0d3r wants to merge 2 commits into
anomalyco:devfrom
aic0d3r:fix/session-summary-aggregate-from-turn-diffs

Conversation

@aic0d3r

@aic0d3r aic0d3r commented Jun 22, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #30877

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

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.summary from the per-message turn diffs that #30127 preserved. After the existing per-turn computeDiff runs and stores its result on the message, we sum all messages' info.summary.diffs into 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, the summarize function.

How did you verify your code works?

  • bun typecheck from packages/opencode — clean, no errors in summary.ts
  • Built a standalone binary from this branch and ran it in a test repo:
    • Edited a file, then inspected the session DB
    • Before patch: summary_files=0, summary_diffs=(empty)
    • After patch: summary_files=1, summary_additions=1, summary_deletions=1, summary_diffs=[{file:"sample.txt",...}]
  • A second user confirmed the fix works by running the built binary against their TUI — "Modified Files" sidebar populated correctly after edits.

Screenshots / recordings

Restores existing sidebar behavior, no visual design change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

aic0d3r added 2 commits June 22, 2026 19:45
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] v1.16.0: TUI sidebar "Modified Files" section completely hidden after path truncation fix

1 participant