From b819629c34290e913beb1d1d0e815d7cba097217 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 27 Apr 2026 10:46:52 +0000 Subject: [PATCH 1/3] Initial plan From 8e194b09829a2397224c21e2586e28a1fb8cc604 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 27 Apr 2026 11:37:17 +0000 Subject: [PATCH 2/3] Update .lastmerge to c63feb2794786342d57936c13d28c250e723c676 Co-authored-by: edburns <75821+edburns@users.noreply.github.com> --- .lastmerge | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.lastmerge b/.lastmerge index caffac28b..eea41e5b5 100644 --- a/.lastmerge +++ b/.lastmerge @@ -1 +1 @@ -dd2dcbc439256acfb9feb2cff07c0b9c820091b8 +c63feb2794786342d57936c13d28c250e723c676 From 3e2bf92567b501324416d84a57a7b8f736d6dd40 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 27 Apr 2026 11:37:35 +0000 Subject: [PATCH 3/3] Port SetForegroundSessionRequest from reference implementation (c63feb2) Agent-Logs-Url: https://github.com/github/copilot-sdk-java/sessions/4b8200da-787f-4f51-ab9d-c196711007de Co-authored-by: edburns <75821+edburns@users.noreply.github.com> --- .../com/github/copilot/sdk/CopilotClient.java | 21 ++++++++----------- .../sdk/json/SetForegroundSessionRequest.java | 18 ++++++++++++++++ 2 files changed, 27 insertions(+), 12 deletions(-) create mode 100644 src/main/java/com/github/copilot/sdk/json/SetForegroundSessionRequest.java diff --git a/src/main/java/com/github/copilot/sdk/CopilotClient.java b/src/main/java/com/github/copilot/sdk/CopilotClient.java index 4b3bb0904..ebe995bd7 100644 --- a/src/main/java/com/github/copilot/sdk/CopilotClient.java +++ b/src/main/java/com/github/copilot/sdk/CopilotClient.java @@ -744,18 +744,15 @@ public CompletableFuture getForegroundSessionId() { * if the operation fails */ public CompletableFuture setForegroundSessionId(String sessionId) { - return ensureConnected() - .thenCompose( - connection -> connection.rpc - .invoke("session.setForeground", Map.of("sessionId", sessionId), - com.github.copilot.sdk.json.SetForegroundSessionResponse.class) - .thenAccept(response -> { - if (!response.success()) { - throw new RuntimeException(response.error() != null - ? response.error() - : "Failed to set foreground session"); - } - })); + return ensureConnected().thenCompose(connection -> connection.rpc + .invoke("session.setForeground", new com.github.copilot.sdk.json.SetForegroundSessionRequest(sessionId), + com.github.copilot.sdk.json.SetForegroundSessionResponse.class) + .thenAccept(response -> { + if (!response.success()) { + throw new RuntimeException( + response.error() != null ? response.error() : "Failed to set foreground session"); + } + })); } /** diff --git a/src/main/java/com/github/copilot/sdk/json/SetForegroundSessionRequest.java b/src/main/java/com/github/copilot/sdk/json/SetForegroundSessionRequest.java new file mode 100644 index 000000000..30470a5c9 --- /dev/null +++ b/src/main/java/com/github/copilot/sdk/json/SetForegroundSessionRequest.java @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +package com.github.copilot.sdk.json; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Internal request object for setting the foreground session. + * + * @param sessionId + * the ID of the session to set as the foreground session + * @see com.github.copilot.sdk.CopilotClient#setForegroundSessionId(String) + * @since 1.0.0 + */ +public record SetForegroundSessionRequest(@JsonProperty("sessionId") String sessionId) { +}