Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 25 additions & 3 deletions src/test/java/com/github/copilot/sdk/CapiProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down
8 changes: 2 additions & 6 deletions src/test/java/com/github/copilot/sdk/CopilotSessionTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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");

Expand Down
Loading