Skip to content

agentHost: allow sequential Copilot steering - #345885

Closed
I.Rezantsev (unclearriw) wants to merge 1 commit into
microsoft:mainfrom
unclearriw:fix/copilot-sequential-steering
Closed

I.Rezantsev (unclearriw) wants to merge 1 commit into
microsoft:mainfrom
unclearriw:fix/copilot-sequential-steering

Conversation

@unclearriw

Copy link
Copy Markdown

Fixes #345884

Summary

  • A steering echo promotes a new host turn while the same SDK execution continues. The promoted turn is running but has not itself invoked a normal SDK send, so the existing readiness gate rejects later steering.
  • Track that the turn was promoted from SDK-dispatched steering separately from sdkSendInvoked, preserving normal send timing and readiness checks. The state belongs to the turn and is cleared by normal turn replacement, completion, and abort.
  • Add a provider regression test for three sequential immediate steering deliveries with SDK echoes and continued assistant output, plus readiness coverage for idle-before-echo, idle, abort, and the next pending turn.

The cause was noted in the #340432 review. #340669 addresses multiple pending messages; the readiness guard predates it, and this PR does not assert that #340669 caused the issue.

Validation

  • Before the fix, the regression test failed with admissions [true, false, false] and only the first steering message sent to the SDK; after the fix it passed.
  • pnpm run test-node --run src/vs/platform/agentHost/test/node/copilotAgent.test.ts --run src/vs/platform/agentHost/test/node/copilotAgentSession.test.ts --run src/vs/platform/agentHost/test/node/chatContributions.test.ts --reporter dot: 2635 passing, 1 pending.
  • pnpm run typecheck-client: passed.
  • pnpm run eslint src/vs/platform/agentHost/node/copilot/copilotAgentSession.ts src/vs/platform/agentHost/test/node/copilotAgent.test.ts src/vs/platform/agentHost/test/node/copilotAgentSession.test.ts: passed.

Checks ran in an isolated Linux Docker checkout using the repository-pinned toolchain, before two unrelated Agents window commits advanced upstream main. The branch is based on the newer tip. The SDK was mocked; live SDK/UI and Windows validation were not performed.

For manual verification, start a long-running Copilot Agent Host task, send and wait for one steering message to be consumed, then send additional steering messages while work continues. Check that each is acted upon once without waiting for completion, ordinary queued messages still wait, and Stop clears pending steering.

This change was investigated and implemented with GitHub Copilot assistance.

Copilot AI balanced review requested due to automatic review settings November 3, 2026 18:39
@unclearriw

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

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.

🟢 Approval recommended

No active review issues remain for the change enabling sequential steering messages during ongoing SDK execution.

No open issues 🎉

What changed in this PR

Fixes #345884 by allowing sequential Copilot Agent Host steering messages during an ongoing SDK execution. Promoted steering turns remain eligible for further steering without changing normal send readiness or timing.

Changes:

  • Track steering-promoted turns separately from turns that invoked a normal SDK send.
  • Add a regression test covering three sequential steering messages, SDK echoes, and continued assistant output.
  • Extend readiness coverage for idle-before-echo, completion, abort, and the next pending turn.

No actionable findings remain. Reported validation uses a mocked SDK; live SDK/UI and Windows behavior were not verified.

File Description
src/​vs/​platform/​agentHost/​test/​node/​copilotAgentSession.test.ts Verifies promoted-turn readiness and its reset across turn lifecycle transitions.
src/​vs/​platform/​agentHost/​test/​node/​copilotAgent.test.ts Tests sequential immediate steering delivery and response attribution.
src/​vs/​platform/​agentHost/​node/​copilot/​copilotAgentSession.ts Marks steering-promoted turns and includes them in the running-turn readiness check.

Review effort: Balanced

@unclearriw
I.Rezantsev (unclearriw) marked this pull request as ready for review November 3, 2026 18:48
Joaquín Ruales (jruales) added a commit that referenced this pull request Nov 6, 2026
Verify immediate send payloads, response attribution and readiness across sequential steering, idle-before-echo promotion, completion, abort and next-turn reset. Adapt complementary public regression coverage from #345885 while retaining provider admission before the late echo.

Co-authored-by: I.Rezantsev <[email protected]>

Co-authored-by: Copilot App <[email protected]>
Joaquín Ruales (jruales) added a commit that referenced this pull request Nov 6, 2026
* agentHost: preserve readiness after steering promotion

Keep promoted steering turns marked as SDK-dispatched so later steering reaches the running conversation instead of waiting for it to finish. Cover repeated steering and idle-before-echo promotion.

Regression of #340669.

Co-authored-by: Copilot App <[email protected]>

* agentHost: cover steering delivery and readiness lifecycle

Verify immediate send payloads, response attribution and readiness across sequential steering, idle-before-echo promotion, completion, abort and next-turn reset. Adapt complementary public regression coverage from #345885 while retaining provider admission before the late echo.

Co-authored-by: I.Rezantsev <[email protected]>

Co-authored-by: Copilot App <[email protected]>

---------

Co-authored-by: Copilot App <[email protected]>
@jruales

Joaquín Ruales (jruales) commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Superceded by #346629

Thanks I.Rezantsev (@unclearriw) !

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.

Sequential Copilot Agent Host steering stays pending after the first message is consumed

4 participants