Skip to content

Commit efdec38

Browse files
authored
Merge pull request #136 from copilot-community-sdk/copilot/upstream-sync-2-commits
Upstream sync: 2 commits (8598dc3, 304d812)
2 parents aeed891 + 4a84ca9 commit efdec38

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

.lastmerge

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
e40d57c86e18b495722adbf42045288c03924342
1+
304d812cd4c98755159da427c6701bfb7e0b7c32

src/test/java/com/github/copilot/sdk/CopilotClientTest.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,28 @@ void testForceStopWithNoConnectionCompletes() throws Exception {
424424
}
425425
}
426426

427+
@Test
428+
void testCloseSessionAfterStoppingClientDoesNotThrow() throws Exception {
429+
if (cliPath == null) {
430+
System.out.println("Skipping test: CLI not found");
431+
return;
432+
}
433+
434+
try (var client = new CopilotClient(new CopilotClientOptions().setCliPath(cliPath))) {
435+
var session = client.createSession().get();
436+
437+
// Stop the client first (which closes the RPC connection)
438+
client.stop().get();
439+
440+
// Then close the session - should not throw even though RPC is closed
441+
assertDoesNotThrow(() -> session.close(), "Closing session after client.stop() should not throw exception");
442+
443+
// Verify session is terminated
444+
assertThrows(IllegalStateException.class, () -> session.send("test"),
445+
"Session should be terminated after close()");
446+
}
447+
}
448+
427449
// ===== start() idempotency =====
428450

429451
@Test

0 commit comments

Comments
 (0)