Skip to content

agentHost: Prefer stored Copilot restore metadata - #332984

Merged
roblourens merged 3 commits into
mainfrom
roblou/agents/vscode-issue-332885-workaround-1eeaf422
Aug 27, 2026
Merged

roblourens merged 3 commits into
mainfrom
roblou/agents/vscode-issue-332885-workaround-1eeaf422

Conversation

@roblourens

Copy link
Copy Markdown
Member

Fixes #332885

What changed

  • Pass stable registry timestamps to provider metadata reads during explicit session restore.
  • Restore registered Copilot sessions from VS Code-persisted working-directory and project metadata when available.
  • Skip the redundant SDK metadata lookup before resume when VS Code already has the working directory.
  • Preserve SDK metadata lookups for external and legacy sessions.

Why

A Copilot SDK session.getMetadata request can remain pending for an affected persisted session, preventing Agent Host state hydration. Registered Agent Host sessions already retain the metadata needed to begin restore, so the restore path can avoid depending on that request when the stored metadata is complete.

Validation

  • npm run compile
  • npm run hygiene
  • npm run typecheck-client
  • Targeted Agent Host tests for restore activation, SDK lookup preservation, stored metadata restore, and resume fallback

(Written by Copilot)

roblourens and others added 2 commits August 27, 2026 09:22
Use Agent Host's persisted working directory and registry timestamps when restoring registered Copilot sessions, avoiding unnecessary SDK metadata requests that can block hydration. Preserve SDK lookups for external and legacy sessions. Fixes #332885. (Written by Copilot)

Co-authored-by: Copilot <[email protected]>
Copilot AI balanced review requested due to automatic review settings August 27, 2026 17:04

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

Improves Copilot session restoration by preferring persisted Agent Host metadata over potentially stalled SDK metadata requests.

Changes:

  • Pass registry timestamps during explicit restoration.
  • Restore working-directory and project metadata from persisted state.
  • Skip redundant SDK metadata calls and add targeted tests.
Show a summary per file
File Description
agentService.ts Supplies registry metadata during restoration.
copilotAgent.ts Adds persisted-metadata restore path.
agentService.test.ts Verifies registry fallback propagation.
copilotAgent.test.ts Covers SDK lookup avoidance.

Review details

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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

Use the first persisted working directory when the legacy singular metadata key is absent, so list-only session metadata also avoids the SDK lookup. (Written by Copilot)

Co-authored-by: Copilot <[email protected]>
@roblourens
roblourens marked this pull request as ready for review August 27, 2026 17:36
@roblourens
roblourens enabled auto-merge (squash) August 27, 2026 18:18
@roblourens
roblourens merged commit 3327a40 into main Aug 27, 2026
54 of 55 checks passed
@roblourens
roblourens deleted the roblou/agents/vscode-issue-332885-workaround-1eeaf422 branch August 27, 2026 18:33
@vs-code-engineering vs-code-engineering Bot added this to the 1.136.0 milestone Aug 27, 2026
roblourens added a commit that referenced this pull request Aug 28, 2026
Revert "agentHost: Prefer stored Copilot restore metadata (#332984)"

The workaround is no longer needed. This reverts commit 3327a40. (Written by Copilot)

Co-authored-by: Copilot <[email protected]>
@vs-code-engineering vs-code-engineering Bot locked and limited conversation to collaborators Oct 11, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Agent Host session restore hangs after Copilot SDK/runtime bump

3 participants