Skip to content

Commit 121e5d3

Browse files
stephentoubCopilot
andcommitted
Fix Java PingResponse timestamp deserialization for ISO-8601 format
The Copilot CLI now returns ISO-8601 timestamp strings instead of numeric epoch milliseconds. Update PingResponse.timestamp from long to String and PingResult.timestamp from Long to String. Update corresponding test assertions accordingly. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent ff1c65d commit 121e5d3

4 files changed

Lines changed: 10 additions & 9 deletions

File tree

java/src/generated/java/com/github/copilot/sdk/generated/rpc/PingResult.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
public record PingResult(
2424
/** Echoed message (or default greeting) */
2525
@JsonProperty("message") String message,
26-
/** Server timestamp in milliseconds */
27-
@JsonProperty("timestamp") Long timestamp,
26+
/** Server timestamp as an ISO-8601 string */
27+
@JsonProperty("timestamp") String timestamp,
2828
/** Server protocol version number */
2929
@JsonProperty("protocolVersion") Long protocolVersion
3030
) {

java/src/main/java/com/github/copilot/sdk/json/PingResponse.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
public record PingResponse(
2121
/** The echo message from the server. */
2222
@JsonProperty("message") String message,
23-
/** The server timestamp in milliseconds since epoch. */
24-
@JsonProperty("timestamp") long timestamp,
23+
/** The server timestamp as an ISO-8601 string. */
24+
@JsonProperty("timestamp") String timestamp,
2525
/**
2626
* The SDK protocol version supported by the server. The SDK validates that this
2727
* version matches the expected version to ensure compatibility.

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ void testStartAndConnectUsingStdio() throws Exception {
9292

9393
PingResponse pong = client.ping("test message").get();
9494
assertEquals("pong: test message", pong.message());
95-
assertTrue(pong.timestamp() >= 0);
95+
assertNotNull(pong.timestamp());
96+
assertFalse(pong.timestamp().isEmpty());
9697

9798
client.stop().get();
9899
assertEquals(ConnectionState.DISCONNECTED, client.getState());

java/src/test/java/com/github/copilot/sdk/generated/rpc/GeneratedRpcRecordsCoverageTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ void pingParams_record() {
3232

3333
@Test
3434
void pingResult_record() {
35-
var result = new PingResult("pong", 1234L, 2L);
35+
var result = new PingResult("pong", "2026-01-01T00:00:00Z", 2L);
3636
assertEquals("pong", result.message());
37-
assertEquals(1234L, result.timestamp());
37+
assertEquals("2026-01-01T00:00:00Z", result.timestamp());
3838
assertEquals(2L, result.protocolVersion());
3939
}
4040

@@ -471,9 +471,9 @@ void sessionWorkspaceReadFileParams_record() {
471471

472472
@Test
473473
void pingResult_fields() {
474-
var result = new PingResult("pong", 9999L, 1L);
474+
var result = new PingResult("pong", "2026-06-15T10:30:00Z", 1L);
475475
assertEquals("pong", result.message());
476-
assertEquals(9999L, result.timestamp());
476+
assertEquals("2026-06-15T10:30:00Z", result.timestamp());
477477
assertEquals(1L, result.protocolVersion());
478478
}
479479

0 commit comments

Comments
 (0)