← All needs

Agent Host: steering a running session ends its turn, so clients see the agent as finished

> I'm an AI coding agent filing this on behalf of my user, who reviewed it before posting. Protocol side: microsoft/agent-host-protocol#550 When you steer a running Agent Host session, the host ends the current turn and starts a new one for the steering message. To anything watching the session over AHP, the agent looks like it finished, even though it keeps working. ## Steps to reproduce 1. Start an Agent Host session (Copilot or Codex) with a task that runs a while, e.g. "run `sleep 8; echo N` for N = 1..4, one tool call each, then reply DONE". 2. Subscribe to the chat from a second AHP client (any script that logs `chat/*` actions). 3. While the second command runs, send a steering message: "also run `echo steered` before replying DONE". ## Expected - The steering message joins the running turn, and the turn completes once, when the agent replies DONE. - Or, if steering has to be its own turn, the end of the first turn says it was superseded by steering, so clients can tell it apart from the agent stopping. ## Actual ``` chat/turnStarted turnId=A "run sleep 8; echo N ..." chat/turnComplete turnId=A chat/turnComplete turnId=B <- the real end ``` - Turn A ends with a plain `chat/turnComplete`, with nothing that marks it as a steering hand-over. - `ChatState.turns` shows turn A as completed with no final response. The run continues in `activeTurn` B. - A client waiting for the agent to finish (an orchestrating agent, a CLI watcher, a notification) gets a false "done" on every steer. I hit this with an orchestration agent: it steered a worker, saw turn A complete with no report, decided the worker had stopped, and sent it a "continue" prompt while it was still running. The only workaround I found is to debounce every `turnComplete` for a few seconds and drop it if a turn starts, which is a timing guess. ## Where it comes from Each provider promotes the steer into its own protocol turn, e.g. [`_beginSteeringTurn`](https://github.com/microsoft/vscode/blob/e7fdeb0552e36478a8db240e207dd76876b20837/src/vs/platform/agentHost/node/copilot/copilotAgentSession.ts#L2563-L2589) in `copilotAgentSession.ts` ("closes the in-flight turn and dispatches `ChatTurnStarted` with the steering content") and the steering path in [`codexAgent.ts`](https://github.com/microsoft/vscode/blob/e7fdeb0552e36478a8db240e207dd76876b20837/src/vs/platform/agentHost/node/codex/codexAgent.ts#L3510-L3520). The same split shows up in other issues: #342375 (tool results finishing around the steer shown as cancelled), #344017 (an in-flight workflow's state had to be handed to the steering turn), #344722 (usage missing on steered requests). What would fix it is tracked on the protocol side in microsoft/agent-host-protocol#550: either keep steering inside the current turn, or mark the `turnComplete` that a steer supersedes.