Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 21, 2026

The /clear command now archives the current session before creating a new one, distinguishing explicit clearing from passive session switching (plus button).

Changes

Modified the /clear slash command handler in chat.contribution.ts:

  • Injected IAgentSessionsService to access session state
  • Updated callback to receive sessionResource parameter and archive session via setArchived(true) before executing ACTION_ID_NEW_CHAT
  • Added null check and archive state guard
}, async (_prompt, _progress, _history, _location, sessionResource) => {
    const currentSession = agentSessionsService.getSession(sessionResource);
    if (currentSession && !currentSession.isArchived()) {
        currentSession.setArchived(true);
    }
    commandService.executeCommand(ACTION_ID_NEW_CHAT);
}));
Original prompt

This section details on the original issue you should resolve

<issue_title>/clear should archive current session and start a new one</issue_title>
<issue_description>

Does this issue occur when all extensions are disabled?: Yes/No

Currently the plus button creates a new session and keeps the current one running in the background. But /clear is an explicit action to clear content, so it should archive the current session rather than just pushing it to the background IMHO.
</issue_description>

Comments on the Issue (you are @copilot in this section)

@roblourens We wanted to rename this to `/new` for a long time except that it conflicted with `@workspace /new`

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: bpasero <900690+bpasero@users.noreply.github.com>
Copilot AI changed the title [WIP] Implement clear command to archive current session Archive session on /clear instead of backgrounding Jan 21, 2026
Copilot AI requested a review from bpasero January 21, 2026 07:53
@bpasero bpasero marked this pull request as ready for review January 21, 2026 09:44
Copilot AI review requested due to automatic review settings January 21, 2026 09:44
@bpasero bpasero enabled auto-merge (squash) January 21, 2026 09:44
@bpasero bpasero added this to the January 2026 milestone Jan 21, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR modifies the /clear slash command behavior to archive the current chat session before creating a new one, distinguishing it from passive session switching via the plus button.

Changes:

  • The /clear command now archives the current session by calling setArchived(true) before executing ACTION_ID_NEW_CHAT
  • Updated the command description from "Start a new chat" to "Start a new chat and archive the current one" to reflect the new behavior
  • Injected IAgentSessionsService dependency to access session management functionality

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.

/clear should archive current session and start a new one

2 participants