diff --git a/src/test/java/com/github/copilot/sdk/CapiProxy.java b/src/test/java/com/github/copilot/sdk/CapiProxy.java index 0b85e4ec3..ecfdaceee 100644 --- a/src/test/java/com/github/copilot/sdk/CapiProxy.java +++ b/src/test/java/com/github/copilot/sdk/CapiProxy.java @@ -289,12 +289,34 @@ public String getProxyUrl() { } /** - * Checks if the proxy process is still alive. + * Checks if the proxy process is still alive and responsive. This does both a + * process alive check AND an HTTP health check. * - * @return true if the proxy is running, false otherwise + * @return true if the proxy is running and responsive, false otherwise */ public boolean isAlive() { - return process != null && process.isAlive(); + if (process == null || !process.isAlive()) { + return false; + } + + // Also verify the proxy is responsive via HTTP + if (proxyUrl != null) { + try { + java.net.HttpURLConnection conn = (java.net.HttpURLConnection) new java.net.URL(proxyUrl + "/exchanges") + .openConnection(); + conn.setRequestMethod("GET"); + conn.setConnectTimeout(1000); + conn.setReadTimeout(1000); + int responseCode = conn.getResponseCode(); + conn.disconnect(); + return responseCode == 200; + } catch (Exception e) { + // If HTTP check fails, the proxy is not responsive + return false; + } + } + + return true; } /** diff --git a/src/test/java/com/github/copilot/sdk/CopilotSessionTest.java b/src/test/java/com/github/copilot/sdk/CopilotSessionTest.java index eca9b1776..bcea394ed 100644 --- a/src/test/java/com/github/copilot/sdk/CopilotSessionTest.java +++ b/src/test/java/com/github/copilot/sdk/CopilotSessionTest.java @@ -19,7 +19,6 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.condition.DisabledIfEnvironmentVariable; import com.github.copilot.sdk.events.AbstractSessionEvent; import com.github.copilot.sdk.events.AbortEvent; @@ -487,12 +486,9 @@ void testCreateSessionWithCustomConfigDir() throws Exception { } } - // Skip in CI - this test validates client-side timeout behavior, not LLM - // responses. - // The test intentionally times out before receiving a response, so there's no - // snapshot to replay. + // This test validates client-side timeout behavior. The snapshot has no + // assistant response because the test expects timeout BEFORE completion. @Test - @DisabledIfEnvironmentVariable(named = "CI", matches = ".*") void testSendAndWaitThrowsOnTimeout() throws Exception { ctx.configureForTest("session", "sendandwait_throws_on_timeout");