sessions: scope last-turn changes pill to the viewed chat#324788
sessions: scope last-turn changes pill to the viewed chat#324788benibenj wants to merge 2 commits into
Conversation
Move `lastTurnChanges` from the session concept to the chat concept so a session with multiple chats tracks last-turn changes per chat. The changes pill above the chat input now reflects the viewed chat's last-turn changes and gates on that chat's status. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: @sandy081Matched files:
@lszomoruMatched files:
|
There was a problem hiding this comment.
Pull request overview
This PR scopes the "last turn changes" pill (shown above the chat input) from the session to the specific chat being viewed. Previously lastTurnChanges lived on ISession and always resolved the session's most recently modified chat, so the pill above one chat's input could reflect a different chat's turn. The concept is moved onto IChat, and the agent-host provider now derives per-chat last-turn changes keyed by each chat's URI.
Changes:
- Moved
lastTurnChangesfromISessionto an optional property onIChat(session.ts), and removed the now-obsolete session-level delegation getters (visibleSessions.ts). - Replaced
ISessionOutputObs.lastTurnChanges(most-recent-chat selection) with a per-chatgetLastTurnChanges(chatUri)lookup (agentHostSessionFiles.ts), and wired the default chat (buildDefaultChatUri) and each peer chat (ChatSummary.resource) to their own observable (baseAgentHostSessionsProvider.ts). - Updated the pill widget (
sessionChatInputToolbar.ts) to track anIChat, readchat.lastTurnChanges, and gate visibility on the chat's status; updatedchatView.tsand the fixture accordingly.
Show a summary per file
| File | Description |
|---|---|
src/vs/sessions/services/sessions/common/session.ts |
Moves lastTurnChanges from ISession to optional IChat property. |
src/vs/sessions/services/sessions/browser/visibleSessions.ts |
Drops the now-removed session-level lastTurnChanges delegation getters. |
src/vs/sessions/contrib/providers/agentHost/browser/agentHostSessionFiles.ts |
Replaces session-level observable with per-chat getLastTurnChanges(chatUri); drops most-recent-chat selection. |
src/vs/sessions/contrib/providers/agentHost/browser/baseAgentHostSessionsProvider.ts |
Stores session output and wires default/peer chats to their own last-turn changes. |
src/vs/sessions/contrib/chat/browser/sessionChatInputToolbar.ts |
Tracks an IChat, reads chat.lastTurnChanges, gates on chat status; setChat/setSession take IChat. |
src/vs/sessions/contrib/chat/browser/chatView.ts |
Passes the IChat into the toolbar instead of the chat resource URI. |
src/vs/workbench/test/browser/componentFixtures/sessions/sessionChatInputToolbar.fixture.ts |
Mock now provides an IChat (status + lastTurnChanges) alongside the session. |
Notes from verification: the peer-chat key (summary.resource) and default-chat key (buildDefaultChatUri(sessionUri)) both match the keys used in chatUrisObs/editsPerChatObs; _sessionOutput is assigned in the constructor before any _createAdditionalChat call; selectMostRecentChatUri remains used by the "Last Turn Changes" changeset; and no remaining references to session.lastTurnChanges exist.
Review details
- Files reviewed: 7/7 changed files
- Comments generated: 0
- Review effort level: Medium
What
Moves the "last turn changes" concept from the session to the chat. The changes pill shown above the chat input now reflects the last-turn changes of the specific chat being viewed. In a session with multiple chats, each chat tracks its own last-turn changes.
Why
Previously
lastTurnChangeslived onISessionand picked the session's "most recent chat", so the pill above one chat's input could reflect a different chat's turn. This scopes it correctly to the chat the user is looking at.Changes
session.ts): removedlastTurnChangesfromISession; added optionallastTurnChangestoIChat.agentHostSessionFiles.ts): replaced the session-levellastTurnChanges(which selected the most-recent chat) with a per-chatgetLastTurnChanges(chatUri)lookup that reduces that chat's last-turn edits. Reuses the already-parsed per-chat edits; dropped the now-unused most-recent-chat selection.baseAgentHostSessionsProvider.ts): stores the session output and wires the main chat and each peer chat to their own last-turn changes.visibleSessions.ts): dropped the session-levellastTurnChangesgetters.sessionChatInputToolbar.ts): now tracks anIChat, readschat.lastTurnChanges, and gates visibility on the chat's status (InProgress). Still resolves the owning session for the agent-host provider gate and the open-changes action.setChattakes anIChat;setSession(session, chat)is the explicit fixture override.chatView.ts): passes theIChatinto the toolbar.sessionChatInputToolbar.fixture.ts): mock now provides anIChat(status +lastTurnChanges) plus a session.Notes for reviewers
typecheck-clientand ESLint on the changed files.