sessions: fix archive and retention of stopped temp sessions#308629
Merged
sessions: fix archive and retention of stopped temp sessions#308629
Conversation
When a copilot-cli session is stopped before the first turn commits, the session remained in a temp/untitled state. Archiving such a session previously fell through to cleanup logic that deleted and disposed it instead of archiving in-place. - Add setArchived() to CopilotCLISession and RemoteNewSession so temp sessions can be archived/unarchived without deletion - Handle CancellationError in _sendFirstChat by marking the session as Completed so it stays visible in the session list - Add tests for deleting and archiving uncommitted temp sessions Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes Copilot Chat Sessions (Agents window) behavior for uncommitted temp sessions (copilotcli:/untitled-…) so that archiving no longer deletes session content and stopped-before-commit sessions remain visible.
Changes:
- Add in-place archive state tracking to temp session implementations (
CopilotCLISession,RemoteNewSession) via a private_isArchivedobservable andsetArchived(). - Update
archiveSession()/unarchiveSession()to toggle archive state for uncommitted temp sessions instead of cleaning them up. - Update/extend tests to validate archiving behavior for in-flight and stopped-before-commit temp sessions.
Show a summary per file
| File | Description |
|---|---|
| src/vs/sessions/contrib/copilotChatSessions/browser/copilotChatSessionsProvider.ts | Adds temp-session archive toggling support and uses it from archive/unarchive flows. |
| src/vs/sessions/contrib/copilotChatSessions/test/browser/copilotChatSessionsProvider.test.ts | Updates archive test expectations and adds coverage for archiving a stopped-before-commit temp session. |
Copilot's findings
- Files reviewed: 2/2 changed files
- Comments generated: 1
src/vs/sessions/contrib/copilotChatSessions/test/browser/copilotChatSessionsProvider.test.ts
Show resolved
Hide resolved
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
jruales
approved these changes
Apr 8, 2026
joshspicer
pushed a commit
that referenced
this pull request
Apr 9, 2026
* sessions: fix archive and retention of stopped temp sessions When a copilot-cli session is stopped before the first turn commits, the session remained in a temp/untitled state. Archiving such a session previously fell through to cleanup logic that deleted and disposed it instead of archiving in-place. - Add setArchived() to CopilotCLISession and RemoteNewSession so temp sessions can be archived/unarchived without deletion - Handle CancellationError in _sendFirstChat by marking the session as Completed so it stays visible in the session list - Add tests for deleting and archiving uncommitted temp sessions Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * test: assert doesNotReject instead of swallowing sendPromise errors Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
Problem
Fixes: #306956
Ref: #307664
When a copilot-cli session is stopped before the first turn commits (i.e. the session resource is still
copilotcli:/untitled-…), two bugs occur:archiveSession()couldn't find the temp session in the agent model, so it fell through to_cleanupTempSession()which deleted and disposed the session instead of archiving it.CancellationErrorhandler in_sendFirstChat()didn't mark the session as completed, so it could vanish from the session list.Fix
setArchived()on temp sessions — AddedsetArchived()to bothCopilotCLISessionandRemoteNewSessionwith a private_isArchivedobservable, soarchiveSession()/unarchiveSession()can toggle archive state in-place without deleting.CancellationErrorpath in_sendFirstChat()now setsSessionStatus.Completedand fires achangedevent so the session stays visible.Testing
isArchived === true