feat: add session.getMetadata to all SDK languages#899
Draft
MackinnonBuck wants to merge 1 commit intomainfrom
Draft
feat: add session.getMetadata to all SDK languages#899MackinnonBuck wants to merge 1 commit intomainfrom
MackinnonBuck wants to merge 1 commit intomainfrom
Conversation
Add a new getSessionMetadata method across all four SDK language bindings (Node.js, Python, Go, .NET) that provides efficient O(1) lookup of a single session's metadata by ID via the session.getMetadata JSON-RPC endpoint. Changes per SDK: - Node.js: getSessionMetadata() in client.ts + skipped E2E test - Python: get_session_metadata() in client.py + running E2E test - Go: GetSessionMetadata() in client.go + types in types.go + running E2E test - .NET: GetSessionMetadataAsync() in Client.cs + skipped E2E test Also adds test/snapshots/session/should_get_session_metadata.yaml for the E2E test replay proxy. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
✅ Cross-SDK Consistency ReviewI've reviewed this PR for consistency across all four SDK implementations (Node.js, Python, Go, and .NET). This PR maintains excellent cross-language consistency! SummaryThis PR successfully adds the ✅ API Design
All follow language-specific naming conventions (camelCase, snake_case, PascalCase) and return idiomatic "not found" values ( ✅ Implementation Pattern
✅ Documentation
✅ Test Coverage
No Consistency Issues FoundThis PR maintains feature parity and consistent API design across all SDK implementations. Great work! 🎉
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
The runtime now exposes a
session.getMetadataJSON-RPC method (copilot-agent-runtime#5021) that provides efficient O(1) lookup of a single session's metadata by ID — avoiding the need to callsession.listand filter client-side. This PR exposes that endpoint in all four SDK language bindings.Approach
Each SDK already has
listSessionsreturningSessionMetadata[]. The new method reuses the sameSessionMetadatatype (no new public types needed) but returns a single optional result. When the session is not found, the method returns the language-idiomatic "absent" value rather than throwing an error.getSessionMetadata(sessionId)Promise<SessionMetadata | undefined>undefinedget_session_metadata(session_id)SessionMetadata | NoneNoneGetSessionMetadata(ctx, sessionID)(*SessionMetadata, error)nilGetSessionMetadataAsync(sessionId, ct)Task<SessionMetadata?>nullChanges
client.tswith full JSDoc; skipped E2E test (matching existinglistSessionsskip pattern)client.pywith docstring; running E2E test (Python/Go session lifecycle tests are live)client.go, internal request/response structs intypes.go; running E2E testClient.cs, internal records +[JsonSerializable]registration; skipped E2E testtest/snapshots/session/should_get_session_metadata.yamlfor the replay proxyNotes
listSessionstests ("Re-enable once test harness CAPI proxy supports this test's session lifecycle"). Python and Go E2E tests are running, consistent with their existing session lifecycle tests.