Repository navigation
Show managed plugin install progress and failures in Agent Host chat - #340117
Draft
Anthony Kim (anthonykim1) wants to merge 5 commits into
Draft
Anthony Kim (anthonykim1) wants to merge 5 commits into
Anthony Kim (anthonykim1) wants to merge 5 commits into
Conversation
The Copilot runtime prepares plugins required by the organization before it admits a message, and reports progress and failures as session.info and session.warning events of type managed_plugins. Agent Host only logged them, so chat showed a generic "Working" and failures never reached the user. - Show the progress message as the waiting turn's activity, cleared when the runtime admits the message or the turn ends. - Add a failure as a warning that stays visible in the turn; the runtime continues without the plugins it could not prepare. - Only log events that arrive outside a waiting turn, such as preparation started by custom agent selection.
Describe plugin preparation through the session events Agent Host receives.
GFM still turns bare URLs, www. addresses and email addresses into links after markdown escaping. Escape the characters that start them so host text in the managed plugin and BYOK warnings renders as plain text, including in the accessible view.
The waiting request's progress row reads the chat's activity, but plugin preparation progress was published as session activity, which never reaches it. In a live run the progress event arrived while the turn was waiting, and the row still showed a generic "Thinking". Publish the progress as chat activity instead, like worktree creation progress. Intent, Fusion, and command activity are unchanged.
…xt turn Plugin preparation for the organization can fail while no message is waiting, for example after a background policy refresh. Agent Host only logged those failures, so with retries limited to once an hour the user would not see the failure until the next retry. Keep the latest such failure and show it in the next sent turn. Drop it when a managed_plugins_complete info reports the plugins are ready.
Contributor
This branch has not been deployed
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.
Part of: https://github.com/microsoft/vscode-internalbacklog/issues/8906
TL;DR: Before a message starts, a Copilot session can install or update plugins required by the organization. It reports progress as
session.infoand failures assession.warning, both with typemanaged_plugins. Agent Host only logs these events, so chat sits on a generic "Working" and failures never reach the user. This PR shows the progress text in the waiting turn's status line and the failure as a warning in that turn. No SDK or protocol change.Current flow
New flow
user.messageecho, rootassistant.turn_start, a failure, or the end of the turn clears it.ManagedPluginPreparationFailuresystem notification in the waiting turn. Chat renders it as a warning that stays visible when the response collapses, with the message text escaped like the BYOK tool-limit notice.managed_plugins_completeinfo arrives first. Other AHP clients get plain activity text and a plain-text notification.Screenshots (live in Code OSS with this PR, against a Copilot session that reports
managed_pluginsevents, a test org policy that requires plugins, and a local plugin marketplace; click to expand)Install: the waiting turn says why it is waiting
Here a chat's second message waits while a plugin that failed earlier installs. The Sessions list shows the same text as the chat's description:
That turn's answer lists the new plugin's skill (
release-checklist-run):Update: the same status line with the update text
Failure: a warning in the turn, and the answer continues
The warning text is the event's message as received.
Strict mode's "Initializing chat…" uses the same status line; it was not captured live.
Why the status line instead of the original spinner row (design mockup)
The spinner row needs a new protocol field so the client can tell this activity apart from others. The status line reuses existing activity plumbing; text and timing are the same.
Not in this PR
_emitAction). Only plugin preparation moves to chat activity here.Risk to flag: Selecting a custom agent can also wait for plugin preparation, and
setAgentgivesrpc.agent.selecta 30s control-plane timeout. A long install during agent selection can time out and mark the session for resync. Not changed here.How to test
./scripts/test.sh --run src/vs/platform/agentHost/test/node/copilotAgentSession.test.ts --run src/vs/workbench/contrib/chat/test/browser/agentSessions/stateToProgressAdapter.test.ts: 1100 passing. The 8 new host tests fail againstmain'scopilotAgentSession.ts.npm run typecheck-client: the same 385 errors asmainin my environment (stale local node_modules); none new.npx eslinton the changed files: clean.Inspirations from:
ChatActivityChanged, like the worktree creation progress in_resolveWorktreeBeforeSend. The state manager mirrors chat activity onto the session summary.reportByokToolsCapped.keepVisibleWhenCollapsed) and host-text escaping come from theByokToolLimitExceededcase andwithConfigureToolsLink; the escaping is now the sharedescapeHostText.turn.isPending, which ends at the rootuser.messageecho inonUserMessage.progressMessagepath inagentHostSessionHandler, which reads the chat state'sactivity.