Add getSessionMetadata for O(1) session lookup by ID#30
Add getSessionMetadata for O(1) session lookup by ID#30brunoborges wants to merge 2 commits intomainfrom
Conversation
Port upstream copilot-sdk PR #899 to Java SDK. Adds a new getSessionMetadata(sessionId) method to CopilotClient that calls the session.getMetadata JSON-RPC endpoint for efficient single-session metadata lookup. Returns null when the session is not found. Changes: - CopilotClient: new getSessionMetadata(String) method - GetSessionMetadataResponse: new response DTO record - SessionMetadata: updated Javadoc to reference new method - CopilotSessionTest: new @disabled E2E test (matching upstream skip pattern for session lifecycle tests) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Ports upstream support for O(1) session metadata lookup by adding a new CopilotClient#getSessionMetadata(String) API that calls the session.getMetadata JSON-RPC endpoint, plus the associated response DTO and test scaffolding.
Changes:
- Add
CopilotClient#getSessionMetadata(String)that returnsSessionMetadata(ornullif not found). - Introduce
GetSessionMetadataResponseDTO forsession.getMetadataRPC responses. - Update
SessionMetadataJavadoc and add a disabled E2E test for the new behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/main/java/com/github/copilot/sdk/CopilotClient.java |
Adds the new getSessionMetadata JSON-RPC wrapper method. |
src/main/java/com/github/copilot/sdk/json/GetSessionMetadataResponse.java |
Adds the RPC response record used to deserialize session.getMetadata results. |
src/main/java/com/github/copilot/sdk/json/SessionMetadata.java |
Updates Javadoc to reference the new lookup API. |
src/test/java/com/github/copilot/sdk/CopilotSessionTest.java |
Adds an (currently disabled) E2E test for session metadata lookup by ID. |
| * | ||
| * @see com.github.copilot.sdk.CopilotClient#getSessionMetadata(String) | ||
| * @see SessionMetadata | ||
| * @since 1.0.0 |
There was a problem hiding this comment.
The @since tag is set to 1.0.0, but this response type (and CopilotClient#getSessionMetadata(String)) is being introduced in this PR. Please update @since to the version where this API is actually added (consistent with other newer additions that use @since 1.2.0, etc.).
| * @since 1.0.0 | |
| * @since 1.2.0 |
|
Converting this to draft until the reference implementation PR github/copilot-sdk#899 is merged. @MackinnonBuck is still actively working on this. |
|
@copilot In the time between when I most recently marked this as draft and now, the reference implementation did have github/copilot-sdk#899 merged. I believe there have been additional commits to that PR that need to be considered when making a complete implementation of that PR in this codebase. Please analyze the PR and make sure you have picked up all the changes, making changes to your implementation as necessary. |
Agent-Logs-Url: https://github.com/github/copilot-sdk-java/sessions/1dcd7e77-9de7-4ada-81f4-2a0b425919fb Co-authored-by: edburns <75821+edburns@users.noreply.github.com>
Analyzed the final merged state of upstream PR #899 (10 commits, all 4 SDK languages). The Java implementation already matches the upstream API correctly — Changes in
Build passes: 463 tests, 0 failures, 1 skipped (the disabled snapshot test). |
Ports upstream copilot-sdk PR #899 to the Java SDK. Adds a new
getSessionMetadata(String sessionId)method toCopilotClientthat calls thesession.getMetadataJSON-RPC endpoint for efficient O(1) single-session metadata lookup. Returnsnullwhen the session is not found (Java-idiomatic absent value).Before the change?
listSessions()and filter client-side.After the change?
CopilotClient.java— NewgetSessionMetadata(String)method following the same pattern aslistSessions/deleteSessionGetSessionMetadataResponse.java— New response DTO record (@since 1.2.0) for thesession.getMetadataRPC callSessionMetadata.java— Updated Javadoc with@seetag referencing the new methodCopilotSessionTest.java— New@DisabledE2E test; disabled because theshould_get_session_metadatasnapshot was added by upstream PR #899 and won't be available until.lastmergeis advanced past that PRUpstream reference
getSessionMetadata(sessionId)CompletableFuture<SessionMetadata>nullPull request checklist
mvn spotless:applyhas been run to format the codemvn clean verifypasses locallyDoes this introduce a breaking change?
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.