[cherry-pick] agentHost: Fix sessions stuck in progress after subagent completion - #334787
Open
vs-code-engineering[bot] wants to merge 1 commit into
Open
[cherry-pick] agentHost: Fix sessions stuck in progress after subagent completion#334787vs-code-engineering[bot] wants to merge 1 commit into
vs-code-engineering[bot] wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The focused fix is correctly guarded against duplicate completion and has comprehensive regression coverage.
Pull request overview
Fixes Agent Host sessions remaining in progress after subagent follow-up completion.
Changes:
- Correlates subagent stop-hook starts and ends by invocation ID.
- Adds regression coverage for missing IDs, overlapping hooks, and duplicate completions.
File summaries
| File | Description |
|---|---|
copilotAgentSession.ts |
Completes correlated subagent stop hooks. |
copilotAgentSession.test.ts |
Tests completion and correlation edge cases. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
roblourens
approved these changes
Sep 6, 2026
Dmitriy Vasyura (dmitrivMS)
approved these changes
Sep 6, 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.
Cherry-pick of #334781 from
main.Summary
Fix completed Copilot Agent Host sessions remaining In Progress in the Agents window after a subagent follow-up finishes.
The observed SDK sequence supplies the subagent ID in
hook.start.data.input.agentIdfor asubagentStophook, but omits it from thehook.endenvelope. Our handler only completed subagents fromagentStopevents with an envelope agent ID, leaving the follow-up turn active. #333999 made that stale child status visible on the parent session row.Fix
hookInvocationIduntil the matching stop hook ends.Validation
copilotAgentSession.test.tspassed afterward.npm run transpile-clientnpm run precommit)git diff --checkRelease cherry-pick requested via
~release-cherry-pick.