Skip to content

Optimize agent mode instructions handling for efficiency#316152

Merged
DonJayamanne merged 2 commits into
mainfrom
don/perf-mru
May 13, 2026
Merged

Optimize agent mode instructions handling for efficiency#316152
DonJayamanne merged 2 commits into
mainfrom
don/perf-mru

Conversation

@DonJayamanne
Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings May 13, 2026 00:09
@DonJayamanne DonJayamanne self-assigned this May 13, 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 aims to optimize Copilot CLI chat history reconstruction by reducing per-turn agent mode-instructions resolution work when rebuilding stored request metadata for a session.

Changes:

  • Replaces per-request agent/mode-instructions resolution with a single defaultModeInstructions value.
  • Adds inline comments explaining the intent to avoid resolving agents for older requests.
Show a summary per file
File Description
extensions/copilot/src/extension/chatSessions/copilotcli/node/copilotcliSessionService.ts Simplifies mode-instructions selection while building the request-details lookup for history reconstruction.

Copilot's findings

Comments suppressed due to low confidence (1)

extensions/copilot/src/extension/chatSessions/copilotcli/node/copilotcliSessionService.ts:1054

  • Grammar: “Agents from older requests isn't useful” should be “aren't useful”. Also consider rewording the comment to accurately reflect the behavior (the code currently applies defaultModeInstructions, not necessarily a “custom agent from last request”).
				// Agents from older requests isn't useful, hence to save time.
				// Re-use the same custom agent from last request for all previous requests.
  • Files reviewed: 1/1 changed files
  • Comments generated: 2

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 13, 2026

Screenshot Changes

Base: 7c143e99 Current: de5b9bae

Changed (24)

agentSessionsViewer/CompletedRead/Dark
Before After
before after
agentSessionsViewer/CompletedRead/Light
Before After
before after
agentSessionsViewer/CompletedUnread/Dark
Before After
before after
agentSessionsViewer/CompletedUnread/Light
Before After
before after
agentSessionsViewer/FailedWithDuration/Dark
Before After
before after
agentSessionsViewer/FailedWithDuration/Light
Before After
before after
agentSessionsViewer/FailedWithoutDuration/Dark
Before After
before after
agentSessionsViewer/FailedWithoutDuration/Light
Before After
before after
agentSessionsViewer/WithDiffChanges/Dark
Before After
before after
agentSessionsViewer/WithDiffChanges/Light
Before After
before after
agentSessionsViewer/WithFileChangesList/Dark
Before After
before after
agentSessionsViewer/WithFileChangesList/Light
Before After
before after
agentSessionsViewer/WithBadge/Dark
Before After
before after
agentSessionsViewer/WithBadge/Light
Before After
before after
agentSessionsViewer/WithMarkdownBadge/Dark
Before After
before after
agentSessionsViewer/WithMarkdownBadge/Light
Before After
before after
agentSessionsViewer/WithBadgeAndDiff/Dark
Before After
before after
agentSessionsViewer/WithBadgeAndDiff/Light
Before After
before after
agentSessionsViewer/CloudProvider/Dark
Before After
before after
agentSessionsViewer/CloudProvider/Light
Before After
before after
agentSessionsViewer/BackgroundProvider/Dark
Before After
before after
agentSessionsViewer/BackgroundProvider/Light
Before After
before after
agentSessionsViewer/ClaudeProvider/Dark
Before After
before after
agentSessionsViewer/ClaudeProvider/Light
Before After
before after

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@DonJayamanne DonJayamanne marked this pull request as ready for review May 13, 2026 00:45
@DonJayamanne DonJayamanne enabled auto-merge (squash) May 13, 2026 00:45
@DonJayamanne DonJayamanne merged commit c302942 into main May 13, 2026
25 checks passed
@DonJayamanne DonJayamanne deleted the don/perf-mru branch May 13, 2026 00:49
@vs-code-engineering vs-code-engineering Bot added this to the 1.121.0 milestone May 13, 2026
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.

3 participants