Repository navigation
agentHost: surface SDK inventory refusals and recover once on list - #342471
Merged
Vritant Bhardwaj (vritant24) merged 1 commit intoOct 19, 2026
Merged
Vritant Bhardwaj (vritant24) merged 1 commit into
Vritant Bhardwaj (vritant24) merged 1 commit into
Conversation
Copilot SDK customization inventory refusals (`refused` with a reason code, or `recovery-required`) carry no top-level message, so the workbench only logged the generic "The SDK could not list installed MCP servers." fallback and dropped the cause. - Append the outcome kind and reason to SDK result errors, e.g. "The SDK could not list installed MCP servers. (refused: lifecycle-unavailable)". Reason codes stay non-localized identifiers. - When skills or MCP inventory reports `recovery-required`, call the matching `installations.recover` once and use the recovered inventory. A repeated `recovery-required` surfaces as an error instead of looping. Co-authored-by: Copilot <[email protected]>
Justin Chen (justschen)
approved these changes
Oct 19, 2026
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The changes are narrowly scoped, recovery is bounded, and no blocking defects were identified.
No open issues 🎉
What changed in this PR
Improves diagnostics and recovery for SDK-owned customization inventory in Agent Host, following #339896.
Changes:
- Includes SDK outcome kinds and refusal reasons in errors.
- Attempts recovery once per affected inventory kind in
list(session), leaving uninstall behavior unchanged. - Adds tests for refusals, successful recovery, and repeated recovery requirements.
| File | Description |
|---|---|
| src/vs/platform/agentHost/test/node/copilotCustomizationInstallations.test.ts | Tests MCP inventory diagnostics and bounded recovery. |
| src/vs/platform/agentHost/node/copilot/customizations/copilotCustomizationInstallations.ts | Adds outcome details and one-time inventory recovery. |
Review effort: Balanced
Vritant Bhardwaj (vritant24)
enabled auto-merge
October 19, 2026 04:16
Vritant Bhardwaj (vritant24)
deleted the
agents/fix-copilot-sdk-inventory-error-handling
branch
October 19, 2026 04:23
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #339896.
Problem
The workbench logged this, with no indication of why it failed:
The Copilot runtime's
mcp.installations.list/skills.installations.listreports refusals as{ kind: 'outcome', outcome: { kind: 'refused', reason: '<code>' } }or{ kind: 'outcome', outcome: { kind: 'recovery-required' } }, without a top-levelmessage.resultErroronly usedresult.message ?? fallback, so the reason was always lost. Also,list(session)never calledinstallations.recover, so arecovery-requiredinventory could never resolve on its own.Changes
In
copilotCustomizationInstallations.ts:resultErrornow adds the outcome kind and reason after the existing message, using the localized pattern"{0} ({1})". Example:The SDK could not list installed MCP servers. (refused: lifecycle-unavailable). Reason codes are left as non-localized SDK identifiers. Other callers (plan, prepare, uninstall) only reachresultErrorwhen something has already failed, so the only change for them is the added detail.list(session): if skills or MCP inventory returnsrecovery-required, it callsinstallations.recoveronce for that kind only and uses the recovered inventory. If recovery returnsrecovery-requiredagain, it throws(recovery-required)instead of retrying, so it can't loop.For reviewers: the private
listWithClientused by the uninstall flow still does not recover. That's deliberate, to keep this change scoped tolist(session).Testing
copilotCustomizationInstallations.test.tsgets a newinventory failuressuite with three tests:recovery-requiredcalls recover once and returns the recovered installations.recovery-requiredafter recovery produces an error and no second retry.Commands run:
./scripts/test.sh --run src/vs/platform/agentHost/test/node/copilotCustomizationInstallations.test.ts: passed (15 passing)npm run eslint -- <changed files>: passednpm run typecheck-client: passed