Skip to content

Copilot CLI in chat panel should handle /compact gracefully #311805

Merged
anthonykim1 merged 4 commits intomainfrom
anthonykim1/fixCompactHandle
Apr 22, 2026
Merged

Copilot CLI in chat panel should handle /compact gracefully #311805
anthonykim1 merged 4 commits intomainfrom
anthonykim1/fixCompactHandle

Conversation

@anthonykim1
Copy link
Copy Markdown
Contributor

@anthonykim1 anthonykim1 commented Apr 21, 2026

Resolves: #311422
/cc @DonJayamanne

After PR:

beautifulCompactHandling

anthonykim1 and others added 2 commits April 21, 2026 16:13
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
@anthonykim1 anthonykim1 self-assigned this Apr 21, 2026
Copilot AI review requested due to automatic review settings April 21, 2026 23:16
@anthonykim1 anthonykim1 added this to the 1.118.0 milestone Apr 21, 2026
Copy link
Copy Markdown
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 fixes Copilot CLI chat panel /compact so running it multiple times doesn’t surface an SDK error, addressing issue #311422.

Changes:

  • Add a pre-check in CopilotCLISession to detect an already-compacted conversation before calling the SDK’s compactHistory().
  • Extend the Copilot CLI session unit test mock to support getChatMessages().
  • Add a regression test covering the “already compacted” scenario.
Show a summary per file
File Description
extensions/copilot/src/extension/chatSessions/copilotcli/node/copilotcliSession.ts Adds a guard before invoking SDK compaction to avoid throwing on repeated /compact.
extensions/copilot/src/extension/chatSessions/copilotcli/node/test/copilotcliSession.spec.ts Updates SDK session mock + adds a test for repeated /compact behavior.

Copilot's findings

  • Files reviewed: 2/2 changed files
  • Comments generated: 2

@anthonykim1 anthonykim1 marked this pull request as ready for review April 22, 2026 01:49
@github-actions
Copy link
Copy Markdown
Contributor

Screenshot Changes

Base: 6994450c Current: d6bbf8a2

Changed (1)

editor/inlineCompletions/other/JumpToHint/Dark
Before After
before after

@anthonykim1 anthonykim1 merged commit 214df4b into main Apr 22, 2026
26 checks passed
@anthonykim1 anthonykim1 deleted the anthonykim1/fixCompactHandle branch April 22, 2026 02:13
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.

Using compaction twice in a row in Copilot CLI results in error

3 participants