Wire up SDK autopilot and plan modes via MessageOptions.Mode#186
Merged
Wire up SDK autopilot and plan modes via MessageOptions.Mode#186
Conversation
9a1cda4 to
ec8d8aa
Compare
Previously, autopilot and plan modes only prepended [[AUTOPILOT]] or
[[PLAN]] text to the prompt. Now the SDK's MessageOptions.Mode property
is set to the correct agent mode string ('autopilot', 'plan', etc.),
letting the Copilot backend handle mode switching natively.
Changes:
- CopilotService.SendPromptAsync: add agentMode parameter, set Mode on MessageOptions
- Dashboard.razor: map input mode to SDK agentMode instead of text prefix
- BridgeMessages.cs: add AgentMode to SendMessagePayload (backward-compatible)
- WsBridgeServer/Client: pass agentMode through bridge protocol
- IWsBridgeClient: updated interface signature
- AgentModeTests: 7 tests covering serialization, round-trip, backward compat
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Code review found that agentMode was lost when messages were queued (session busy). Added _queuedAgentModes parallel tracking dictionary (same pattern as _queuedImagePaths) so plan/autopilot mode survives queuing and is passed through to SendPromptAsync on drain. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…gnment Round 2 multi-model review (Opus, Sonnet, Codex) found 3 issues: 1. _queuedAgentModes inner List<string?> had no lock protection unlike _queuedImagePaths. Now all mutations are under _imageQueueLock. 2. Remote-mode EnqueueMessage silently dropped agentMode. Added AgentMode to QueueMessagePayload and wired through client/server/interface. 3. Re-queue on failure only re-inserted non-null modes, causing alignment drift with the prompt list. Now always re-inserts when a mode queue exists for the session. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
ec8d8aa to
fb28c4c
Compare
…sistency 1. Evaluator async dispatch path (Events.cs:1079) now consumes _queuedAgentModes to maintain alignment and passes agentMode to SendPromptAsync. 2. Reconnect retry path now sets MessageOptions.Mode on the retry MessageOptions, preserving autopilot/plan mode across reconnects. 3. ClearQueue and RenameSession now access _queuedAgentModes under _imageQueueLock for consistent lock discipline. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
Summary
Previously, autopilot and plan modes only prepended
[[AUTOPILOT]]or[[PLAN]]text to the prompt. Now the SDK'sMessageOptions.Modeproperty is set to the correct agent mode string, letting the Copilot backend handle mode switching natively.Changes
Core wiring
agentModeparameter, setsMessageOptions.Modewhen specifiedGetInputMode()) to SDK agent mode string instead of text prefixAgentModefield toSendMessagePayload(backward-compatible — null for old clients)agentModethrough the bridge protocolQueue preservation (review finding)
_queuedAgentModesparallel tracking dictionary (same pattern as_queuedImagePaths)Tests
AgentModeTests.cs: serialization, round-trip, backward compatibilitySDK Mode Values
MessageOptions.Modeaccepts:"interactive","plan","autopilot","shell"Review
Multi-model code review (Opus 4.6, Sonnet 4.6, Codex 5.3) found the queued-message mode loss — fixed in commit 2.