Skip to content

[cherry-pick] agentHost: Fix sessions stuck in progress - #334876

Closed
Benjamin Christopher Simmonds (benibenj) wants to merge 2 commits into
release/1.137from
benibenj/agents/cherry-pick-pr-334781-to-release-1137
Closed

[cherry-pick] agentHost: Fix sessions stuck in progress#334876
Benjamin Christopher Simmonds (benibenj) wants to merge 2 commits into
release/1.137from
benibenj/agents/cherry-pick-pr-334781-to-release-1137

Conversation

@benibenj

Copy link
Copy Markdown
Contributor

Summary

Cherry-picks #334781 to release/1.137.

  • Correlate subagentStop hook start and end events by invocation ID when the SDK omits the subagent ID from the end event.
  • Reuse the existing subagent completion path so resumed follow-up turns no longer leave sessions in progress.
  • Validate hook input before reading agentId and cover overlapping and duplicate completion events.

Validation

  • npm run transpile-client
  • .\scripts\test.bat --run src\vs\platform\agentHost\test\node\copilotAgentSession.test.ts (432 passing)
  • npm run eslint -- src\vs\platform\agentHost\node\copilot\copilotAgentSession.ts src\vs\platform\agentHost\test\node\copilotAgentSession.test.ts
  • git diff --check origin/release/1.137..HEAD

Match subagent stop hooks by invocation ID when the SDK provides the agent identity only in the start event input. Reuse the existing completion path so finished follow-up turns do not keep the session in progress.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Fix the Compile & Hygiene failure by checking that SDK hook input is a non-null, non-array object before reading agentId. Cover missing, primitive, array, and non-string inputs.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings September 7, 2026 09:32

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.

Copilot review overview

🟢 Approval recommended

The reviewed fix has no unresolved approval-blocking issues.

Review tier: Balanced
Findings: None

What changed in this PR

Cherry-picks a fix preventing resumed subagent sessions from remaining in progress.

Changes:

  • Correlates stop-hook events by invocation ID.
  • Validates hook input and reuses existing completion handling.
  • Adds regression tests for malformed, overlapping, and duplicate events.
File Description
src/​vs/​platform/​agentHost/​test/​node/​copilotAgentSession.test.ts Adds regression coverage for correlation, malformed input, and duplicate completion.
src/​vs/​platform/​agentHost/​node/​copilot/​copilotAgentSession.ts Correlates subagent stop hooks and completes resumed turns.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants