Skip to content

Add getSessionMetadata for O(1) session lookup by ID#30

Draft
brunoborges wants to merge 1 commit intomainfrom
feat/add-get-session-metadata
Draft

Add getSessionMetadata for O(1) session lookup by ID#30
brunoborges wants to merge 1 commit intomainfrom
feat/add-get-session-metadata

Conversation

@brunoborges
Copy link
Collaborator

Summary

Ports upstream copilot-sdk PR #899 to the Java SDK. Adds a new getSessionMetadata(String sessionId) method to CopilotClient that calls the session.getMetadata JSON-RPC endpoint for efficient O(1) single-session metadata lookup. Returns null when the session is not found (Java-idiomatic absent value).

Changes

  • CopilotClient.java — New getSessionMetadata(String) method following the same pattern as listSessions/deleteSession
  • GetSessionMetadataResponse.java — New response DTO record for the session.getMetadata RPC call
  • SessionMetadata.java — Updated Javadoc to reference the new method
  • CopilotSessionTest.java — New @Disabled E2E test matching the upstream skip pattern (needs test harness CAPI proxy support for session lifecycle tests)

Testing

  • mvn verify passes: 463 tests run, 0 failures, 1 skipped (the new disabled test)
  • Test follows the same structure as existing testShouldListSessions and testShouldDeleteSession

Upstream reference

SDK Method Return type Not-found value
Java getSessionMetadata(sessionId) CompletableFuture<SessionMetadata> null

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>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 returns SessionMetadata (or null if not found).
  • Introduce GetSessionMetadataResponse DTO for session.getMetadata RPC responses.
  • Update SessionMetadata Javadoc 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
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.).

Suggested change
* @since 1.0.0
* @since 1.2.0

Copilot uses AI. Check for mistakes.
@edburns edburns marked this pull request as draft March 25, 2026 22:08
@edburns
Copy link
Collaborator

edburns commented Mar 25, 2026

Converting this to draft until the reference implementation PR github/copilot-sdk#899 is merged. @MackinnonBuck is still actively working on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants