fix(tui): restore modified files sidebar#37613
Conversation
|
The following comment was made by an LLM, it may be inaccurate: Based on the search results, I found two potentially related PRs that address similar issues:
Both PRs appear to be addressing the same root problem of restoring diff and summary functionality after #30127 removed eager session-level diff generation. The current PR (37613) specifically focuses on the TUI sidebar restoration with per-file baseline tracking, while #37542 and #33444 address related session-level diff restoration work. |
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
Issue for this PR
Closes #30877
Type of change
What does this PR do?
The TUI Modified Files section has been empty since session-level diffs were disabled in #30127. The sidebar still requests a session diff without a message ID, but that request currently returns an empty list.
This change tracks the files changed by
write,edit, andapply_patch. Before the first edit, the original file state is saved in private session storage. The session diff endpoint compares only those tracked files with their current contents, so generated build output and unrelated working-tree changes are not shown. Files restored to their original state, including files created and later deleted, disappear from the list.The TUI refreshes this lazy diff after an assistant turn completes. Existing sessions continue to use snapshot diffs or legacy tool metadata when private baselines are unavailable.
Baseline contents are removed from tool metadata before tool parts are persisted or emitted, because tool metadata is exposed by session APIs and sharing.
How did you verify your code works?
bun typecheckfrompackages/opencodeandpackages/tui..gitignore, generated build files, relative paths, and create-then-delete behavior.Screenshots / recordings
No visual styling changed. The existing Modified Files section is populated again after agent edits.
Checklist