Skip to content

[upstream-sync] Port 21 upstream commits (2026-03-10): protocol v3, agent pre-selection, onListModels, session logging, new event types#182

Closed
Copilot wants to merge 2 commits intomainfrom
copilot/update-from-upstream-21-commits
Closed

[upstream-sync] Port 21 upstream commits (2026-03-10): protocol v3, agent pre-selection, onListModels, session logging, new event types#182
Copilot wants to merge 2 commits intomainfrom
copilot/update-from-upstream-21-commits

Conversation

Copy link
Contributor

Copilot AI commented Mar 10, 2026

Resolves #

Ports 21 upstream commits from github/copilot-sdk (4e1499d..7235609).


Before the change?

  • SDK negotiated protocol v2 only — rejected any server reporting v3
  • No way to supply a custom model list for BYOK scenarios without a running CLI server
  • No way to pre-select a custom agent at session creation time
  • No way to log messages into the session timeline from SDK code
  • Protocol v3 event types (external_tool.requested, permission.requested, command.queued, etc.) were unknown/dropped

After the change?

Protocol v3 (backward-compatible)

  • SdkProtocolVersion bumped to 3; range check accepts v2–v3 so existing deployments keep working

BYOK: Custom Model List (e478657)

  • CopilotClientOptions.setOnListModels(Supplier<CompletableFuture<List<ModelInfo>>>) — called by listModels() instead of querying the CLI; results are cached; no client.start() required
var options = new CopilotClientOptions()
    .setOnListModels(() -> CompletableFuture.completedFuture(List.of(
        new ModelInfo().setId("my-model").setName("My Custom Model")
    )));

Agent pre-selection at session start (7766b1a)

  • SessionConfig.setAgent(String) / ResumeSessionConfig.setAgent(String) — activates a named custom agent immediately on session creation, replacing a follow-up selectAgent() call
new SessionConfig()
    .setCustomAgents(List.of(reviewer))
    .setAgent("reviewer")   // activated immediately

Session logging (11dde6e)

  • CopilotSession.log(String) and CopilotSession.log(String, SessionLogRequestLevel, Boolean) — writes to the session timeline via session.log RPC; supports INFO/WARNING/ERROR levels and ephemeral (non-persisted) messages

New protocol v3 event types (11dde6e, 396e8b3)

  • 8 new event classes registered in AbstractSessionEvent and SessionEventParser: ExternalToolRequestedEvent, ExternalToolCompletedEvent, PermissionRequestedEvent, CommandQueuedEvent, CommandCompletedEvent, ExitPlanModeRequestedEvent, ExitPlanModeCompletedEvent, SystemNotificationEvent
  • Events are observable via session.on(); SDK does not auto-respond to them because the current CLI sends both v2 RPCs and v3 broadcast events simultaneously — auto-handling caused double-response conflicts

Pull request checklist

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)
  • mvn spotless:apply has been run to format the code
  • mvn clean verify passes locally

Does this introduce a breaking change?

  • Yes
  • No


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

…els, log(), new event types

Co-authored-by: brunoborges <129743+brunoborges@users.noreply.github.com>
Copilot AI changed the title [WIP] Sync with upstream repository to include 21 new commits [upstream-sync] Port 21 upstream commits (2026-03-10): protocol v3, agent pre-selection, onListModels, session logging, new event types Mar 10, 2026
@brunoborges brunoborges marked this pull request as ready for review March 10, 2026 12:30
@brunoborges brunoborges requested a review from edburns as a code owner March 10, 2026 12:30
@edburns
Copy link
Collaborator

edburns commented Mar 10, 2026

I am reviewing this now, @brunoborges

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.

[upstream-sync] Upstream sync: 21 new commits (2026-03-10)

3 participants