Fix hang in AH evals - #325169
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a hang in Agent Host (AH) evals (microsoft/vscode-copilot-evaluation#5242). The root cause: two hydration-await sites in AgentHostSessionHandler waited on a subscription using an onDidChange-only Promise. When a subscribe fails, BaseAgentSubscription.setError fires onDidError but not onDidChange, so those awaits never woke and the turn parked for the full harness timeout. The fix routes both sites through the pre-existing _whenSubscriptionHydrated helper (already used at 4 other call sites), which settles on snapshot, error, or cancellation.
Changes:
- Replaced the inline
onDidChange-only await in_readEagerlyCreatedSessionState(~line 1258) with_whenSubscriptionHydrated. - Replaced the inline
onDidChange-only await in the create-and-subscribe path (~line 3543) with_whenSubscriptionHydrated. - Added a regression test plus a
MockAgentHostService"pending→error" subscription helper that reproduces thesetErrorsemantics (firesonDidError, neveronDidChange).
Show a summary per file
| File | Description |
|---|---|
| src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionHandler.ts | Routes two remaining inline hydration awaits through _whenSubscriptionHydrated so a failed subscribe (onDidError) no longer hangs the turn. |
| src/vs/workbench/contrib/chat/test/browser/agentSessions/agentHostChatContribution.test.ts | Adds a pending→error subscription mock and a regression test verifying the handler recovers instead of hanging (repro for #5242). |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Medium
Zhichao Li (zhichli)
approved these changes
Jul 9, 2026
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.
Fix microsoft/vscode-copilot-evaluation#5242