mirror of
https://github.com/microsoft/vscode.git
synced 2026-08-27 12:56:39 +01:00
* agentHost: move side chat behavior into a contribution
Moves the side chat ("btw") feature out of the individual agent harnesses and
into one chat contribution. The agents no longer know what a side chat is. The
host now sends every agent a plain fork and owns the context injection and the
history filtering.
- Adds SideChatContribution. It reads the chat origin and the source chat state
through IAgentHostStateManager, so it needs no protocol change and no
provider private data.
- Keeps the side chat context in the user message. Instructions are not used,
because a change to them invalidates the provider prompt cache and increases
the cost for the user.
- Adds an optional message to ISendContribution. The dispatcher threads the
message through the contributions in order, in the same way that it threads
restored turns. This extends an existing payload instead of adding a hook.
- Collapses the side chat creation option into the fork option. The host
resolves the anchor turn, so an agent receives only a fork.
- Returns the inherited turn id from the create result instead of storing it in
each agent's private data. The host persists it and the contribution uses it
to find the boundary. A chat that was persisted before this change still uses
the seed marker scan.
- Adds an independent queue flag to the fork options, which keeps the Copilot
behavior where a side chat does not block the queue of its source chat.
- Moves the side chat helpers next to the contribution and deletes the ones
that no longer have a caller.
Codex supports side chats for the first time. Its create path already handled a
fork, so the support comes from the deletion of the agent specific code rather
than from new Codex code.
The full agent host suite passes. A driven window confirms that a side chat
answers from the source conversation on all three agents, that the transcript
shows neither the inherited turns nor the injected context, that a normal fork
still inherits its history, and that a cancelled turn still does not send a
queued message.
(Commit message generated by Copilot)
* agentHost: address side chat review feedback
Fixes the problems raised in review of the side chat contribution, and stops
Codex from advertising a capability it cannot yet fulfil.
- Replaces the turn count test that decided whether to inject the source
context. A turn is appended to the chat state for every terminal outcome, so
a first attempt that failed or was cancelled suppressed the context on the
retry. The contribution now records a seeded flag when a turn succeeds, and
restores that flag during hydration from the turns that completed, so the
answer survives a reload.
- Narrows the outgoing message contract to the message text. The previous type
offered the whole message, but attachments are resolved and the model and
agent are selected before the hook runs, so a contribution that replaced any
of them was ignored without a warning.
- Stops Codex from advertising side chat support. A side chat usually branches
from a turn that is still running, and Codex maps a host turn to its own turn
only when the turn completes, so it cannot resolve that fork. The shared end
to end suite already expects Codex to lack the capability, and that
expectation was correct.
- Adds Codex coverage that creates a side chat rather than only reading the
advertised flag.
- Describes the message replacement in the contribution skill, including why
the context belongs in the user message: a change to the instructions
invalidates the provider prompt cache and increases the cost for the user.
(Commit message generated by Copilot)
* agentHost: only inject side chat context the fork cannot carry
Restores the rule that the host applied before the side chat contribution
existed. A side chat that branches from a completed turn inherits that history
through the provider fork, so adding the transcript to the message repeated the
conversation and spent context for nothing. The end to end suite caught this:
the recorded request carries the selection alone, and the contribution was
sending the whole source transcript.
- Adds the source transcript only when the source turn is still active, or when
it is a host injected local turn, because neither reaches the provider through
the fork. A completed turn now contributes the selection alone, as before.
- Explains the rule where the check lives, so it is not simplified back into an
unconditional injection.
- Registers the local turn store as a service so the contribution can ask
whether a source turn is host injected, and injects it into the local command
dispatcher instead of passing it in.
- Adds tests for a completed source turn and an active source turn, which fail
without this change and need no end to end run.
(Commit message generated by Copilot)