Skip to content

chat: Cache generated built-in agent files - #329689

Draft
roblourens (roblourens) wants to merge 2 commits into
microsoft:mainfrom
roblourens:roblou/cache-generated-built-in-agent-files
Draft

chat: Cache generated built-in agent files#329689
roblourens (roblourens) wants to merge 2 commits into
microsoft:mainfrom
roblourens:roblou/cache-generated-built-in-agent-files

Conversation

@roblourens

Copy link
Copy Markdown
Member

What changed

  • add a shared content-keyed writer for generated built-in agent files
  • reuse concurrent and completed writes when generated content is unchanged
  • clear failed writes so later provider calls can retry
  • use the writer for the Plan, Ask, and Explore agent providers

Why

Custom-agent discovery can run repeatedly as workspace/session context changes. These providers regenerated identical content but rewrote their cache files on every call. In the Agents window, repeated session switching could therefore enqueue many identical writes and retain their buffers behind the serialized file-write queue.

This keeps provider discovery dynamic while making the generated-file I/O idempotent.

Validation

  • Copilot extension type-check
  • Copilot extension compile
  • 55 focused provider/writer tests
  • full repository hygiene

(Written by Copilot)

Coalesce identical Plan, Ask, and Explore agent file writes so repeated provider refreshes cannot backlog large buffers. (Written by Copilot)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings August 7, 2026 20:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds idempotent caching for generated built-in agent files to avoid redundant writes.

Changes:

  • Introduces a shared content-keyed file writer.
  • Migrates Plan, Ask, and Explore providers.
  • Adds deduplication coverage; failure-retry coverage remains needed.
Show a summary per file
File Description
cachedAgentFileWriter.ts Implements cached writes and failure eviction.
cachedAgentFileWriter.spec.ts Tests successful write deduplication.
planAgentProvider.ts Uses the cached writer for Plan.
askAgentProvider.ts Uses the cached writer for Ask.
exploreAgentProvider.ts Uses the cached writer for Explore.

Review details

  • Files reviewed: 5/5 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

2 participants