Skip to content

feat: expose clientName in SDK session metadata#1435

Open
Davsterl wants to merge 13 commits into
mainfrom
davsterl/expose-client-name
Open

feat: expose clientName in SDK session metadata#1435
Davsterl wants to merge 13 commits into
mainfrom
davsterl/expose-client-name

Conversation

@Davsterl
Copy link
Copy Markdown
Contributor

This PR adds the clientName field to SessionMetadata across all SDK languages to expose the runtime client identifier that created or last resumed a session.

Motivation

The Copilot runtime now tracks which client (CLI, SDK application, extension) created or last resumed each session via the clientName field in session metadata. SDK consumers need access to this field when listing sessions to identify session ownership and filter sessions by client type.

Changes

Updated all six SDK languages:

  • .NET - Added ClientName property to both generated RPC type and public SessionMetadata class
  • Node/TypeScript - Added clientName field to generated RPC interface and public SessionMetadata interface
  • Python - Added client_name attribute to generated RPC class and public SessionMetadata dataclass
  • Go - Added ClientName field to generated RPC struct and public SessionMetadata struct
  • Rust - Added client_name field to generated RPC struct and public SessionMetadata struct
  • Java - Regenerated RPC types from updated runtime schema to include clientName in SessionMetadata record; updated public SessionMetadata class

Testing:

  • Added serialization tests for the new field in applicable SDK unit tests
  • Created and validated external C# smoke test that creates a session with ClientName and verifies it via ListSessionsAsync()

Implementation Notes

The Java generated types required regeneration because the SDK's codegen uses the @github/copilot npm package's api.schema.json. The schema was manually updated from the runtime's latest generated schema to pick up the clientName field definition.

All changes follow existing SDK patterns - the field is optional (nullable) and uses the appropriate naming convention for each language (camelCase for TS/Java, snake_case for Python/Rust, PascalCase for .NET/Go).

Copilot AI review requested due to automatic review settings May 26, 2026 19:48
@Davsterl Davsterl requested a review from a team as a code owner May 26, 2026 19:48
@github-actions

This comment has been minimized.

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

This PR exposes the runtime clientName identifier on SessionMetadata so SDK consumers can tell which client created or last resumed a session when listing sessions or fetching session metadata.

Changes:

  • Added an optional clientName/client_name field to SessionMetadata types across Rust, Python, Node/TypeScript, Go, .NET, and Java.
  • Updated client-side parsing/mapping and wire/generated RPC types where applicable.
  • Added/updated unit tests to validate JSON serialization/deserialization and mapping for the new field.
Show a summary per file
File Description
rust/tests/session_test.rs Extends session list/getMetadata tests to assert client_name is parsed from clientName.
rust/src/types.rs Adds client_name: Option<String> to Rust SessionMetadata (serde camelCase).
rust/src/generated/api_types.rs Adds client_name to generated Rust RPC SessionMetadata.
python/test_client.py Adds a unit test verifying Python SessionMetadata round-trips clientName.
python/copilot/generated/rpc.py Updates generated RPC SessionMetadata to parse/emit clientName.
python/copilot/client.py Adds client_name to public SessionMetadata and maps JSON clientName.
nodejs/test/client.test.ts Adds tests verifying clientName mapping from session.list and session.getMetadata.
nodejs/src/types.ts Adds optional clientName to public SessionMetadata interface.
nodejs/src/generated/rpc.ts Adds optional clientName to generated RPC SessionMetadata interface.
nodejs/src/client.ts Plumbs clientName through raw response typing and mapSessionMetadata.
go/types.go Adds ClientName *string \json:"clientName,omitempty"`to publicSessionMetadata`.
go/rpc/zrpc.go Adds ClientName to generated Go RPC SessionMetadata.
go/client_test.go Adds JSON round-trip test for SessionMetadata.clientName.
dotnet/src/Types.cs Adds ClientName to public .NET SessionMetadata.
dotnet/src/Generated/Rpc.cs Adds ClientName to generated RPC SessionMetadata.
dotnet/test/Unit/SerializationTests.cs Adds SDK-options round-trip serialization test for SessionMetadata.ClientName.
java/src/main/java/com/github/copilot/sdk/json/SessionMetadata.java Adds clientName field with Jackson mapping + getter/setter to public Java SessionMetadata.
java/src/test/java/com/github/copilot/sdk/ModelInfoTest.java Extends getter/setter unit test to cover SessionMetadata.get/setClientName().
java/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpAppsApi.java New generated Java RPC wrapper for session.mcp.apps.* methods.
java/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpAppsCallToolParams.java New generated params record for MCP Apps callTool.
java/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpAppsDiagnoseParams.java New generated params record for MCP Apps diagnose.
java/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpAppsDiagnoseResult.java New generated result record for MCP Apps diagnose.
java/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpAppsGetHostContextParams.java New generated params record for MCP Apps getHostContext.
java/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpAppsGetHostContextResult.java New generated result record for MCP Apps getHostContext.
java/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpAppsListToolsParams.java New generated params record for MCP Apps listTools.
java/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpAppsListToolsResult.java New generated result record for MCP Apps listTools.
java/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpAppsReadResourceParams.java New generated params record for MCP Apps readResource.
java/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpAppsReadResourceResult.java New generated result record for MCP Apps readResource.
java/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionMcpAppsSetHostContextParams.java New generated params record for MCP Apps setHostContext.
java/src/generated/java/com/github/copilot/sdk/generated/rpc/McpAppsDiagnoseCapability.java New generated record for MCP Apps diagnostic capability snapshot.
java/src/generated/java/com/github/copilot/sdk/generated/rpc/McpAppsDiagnoseServer.java New generated record for MCP Apps diagnostic server snapshot.
java/src/generated/java/com/github/copilot/sdk/generated/rpc/McpAppsHostContextDetails.java New generated record for MCP Apps host context.
java/src/generated/java/com/github/copilot/sdk/generated/rpc/McpAppsHostContextDetailsTheme.java New generated enum for MCP Apps theme.
java/src/generated/java/com/github/copilot/sdk/generated/rpc/McpAppsHostContextDetailsPlatform.java New generated enum for MCP Apps platform.
java/src/generated/java/com/github/copilot/sdk/generated/rpc/McpAppsHostContextDetailsDisplayMode.java New generated enum for MCP Apps display mode.
java/src/generated/java/com/github/copilot/sdk/generated/rpc/McpAppsHostContextDetailsAvailableDisplayMode.java New generated enum for MCP Apps available display modes.
java/src/generated/java/com/github/copilot/sdk/generated/rpc/McpAppsResourceContent.java New generated record for MCP Apps resource content.
java/src/generated/java/com/github/copilot/sdk/generated/rpc/McpAppsSetHostContextDetails.java New generated record for setting MCP Apps host context.
java/src/generated/java/com/github/copilot/sdk/generated/rpc/McpAppsSetHostContextDetailsTheme.java New generated enum for set-host-context theme.
java/src/generated/java/com/github/copilot/sdk/generated/rpc/McpAppsSetHostContextDetailsPlatform.java New generated enum for set-host-context platform.
java/src/generated/java/com/github/copilot/sdk/generated/rpc/McpAppsSetHostContextDetailsDisplayMode.java New generated enum for set-host-context display mode.
java/src/generated/java/com/github/copilot/sdk/generated/rpc/McpAppsSetHostContextDetailsAvailableDisplayMode.java New generated enum for set-host-context available display modes.
java/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionCanvasApi.java New generated Java RPC wrapper for session.canvas.*.
java/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionCanvasCloseParams.java New generated params record for closing a canvas instance.
java/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionCanvasInvokeActionParams.java New generated params record for invoking a canvas action.
java/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionCanvasInvokeActionResult.java New generated result record for canvas action invocation.
java/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionCanvasListParams.java New generated params record for listing canvases.
java/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionCanvasListResult.java New generated result record for listing canvases.
java/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionCanvasListOpenParams.java New generated params record for listing open canvases.
java/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionCanvasListOpenResult.java New generated result record for listing open canvases.
java/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionCanvasOpenParams.java New generated params record for opening a canvas.
java/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionCanvasOpenResult.java New generated result record for opening a canvas.
java/src/generated/java/com/github/copilot/sdk/generated/rpc/OpenCanvasInstance.java New generated record representing an open canvas instance snapshot.
java/src/generated/java/com/github/copilot/sdk/generated/rpc/CanvasAction.java New generated record representing a canvas action.
java/src/generated/java/com/github/copilot/sdk/generated/rpc/CanvasHostContext.java New generated record representing canvas host context.
java/src/generated/java/com/github/copilot/sdk/generated/rpc/CanvasHostContextCapabilities.java New generated record for canvas host capabilities.
java/src/generated/java/com/github/copilot/sdk/generated/rpc/CanvasInstanceAvailability.java New generated enum for canvas instance routing/availability.
java/src/generated/java/com/github/copilot/sdk/generated/rpc/CanvasCloseParams.java New generated params record for provider canvas close.
java/src/generated/java/com/github/copilot/sdk/generated/rpc/CanvasOpenParams.java New generated params record for provider canvas open.
java/src/generated/java/com/github/copilot/sdk/generated/rpc/CanvasOpenResult.java New generated result record for provider canvas open.
java/src/generated/java/com/github/copilot/sdk/generated/rpc/CanvasInvokeActionParams.java New generated params record for provider action invocation.
java/src/generated/java/com/github/copilot/sdk/generated/rpc/DiscoveredCanvas.java New generated record representing a discovered canvas.
java/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionWorkspacesDiffParams.java New generated params record for workspace diff computation.
java/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionWorkspacesDiffResult.java New generated result record for workspace diff computation.
java/src/generated/java/com/github/copilot/sdk/generated/rpc/WorkspaceDiffMode.java New generated enum for diff mode selection.
java/src/generated/java/com/github/copilot/sdk/generated/rpc/WorkspaceDiffFileChangeType.java New generated enum for file change types in workspace diffs.
java/src/generated/java/com/github/copilot/sdk/generated/rpc/WorkspaceDiffFileChange.java New generated record representing a file diff entry.
java/src/generated/java/com/github/copilot/sdk/generated/rpc/ModelBillingTokenPricesLongContext.java New generated record for long-context tier billing prices.

Copilot's findings

Files not reviewed (1)
  • go/rpc/zrpc.go: Language not supported
  • Files reviewed: 13/68 changed files
  • Comments generated: 0

Adds clientName field to SessionMetadata across all SDK languages
(Node, Python, Go, .NET, Rust, Java) to expose the runtime client
identifier that created or last resumed a session.

Changes:
- Updated generated RPC types to include clientName field
- Added clientName to public SessionMetadata models
- Added serialization tests for new field

The clientName field allows SDK consumers to identify which client
(CLI, SDK app, extension) owns a session when listing sessions.

Co-authored-by: Copilot <[email protected]>
@Davsterl Davsterl force-pushed the davsterl/expose-client-name branch from a51f681 to d649959 Compare May 26, 2026 19:57
Auto-committed by java-codegen-check workflow.
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Generated by SDK Consistency Review Agent for issue #1435 · ● 6.9M

Comment thread java/src/main/java/com/github/copilot/rpc/SessionMetadata.java
Copy link
Copy Markdown
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.

Copilot's findings

Files not reviewed (1)
  • go/rpc/zrpc.go: Language not supported
  • Files reviewed: 13/18 changed files
  • Comments generated: 1

Comment thread nodejs/src/client.ts
The type assertion for session.getMetadata response was missing the
clientName field, making it inconsistent with listSessions and less
type-safe. Added clientName?: string to the inline session type.

Co-authored-by: Copilot <[email protected]>
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

Regenerate all SDK generated types to align with the current schema
from @github/copilot package. This ensures the codegen check passes.

Co-authored-by: Copilot <[email protected]>
@github-actions

This comment has been minimized.

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Generated by SDK Consistency Review Agent for issue #1435 · ● 5.1M

Comment thread python/copilot/client.py Outdated
The client_name field should be handled consistently with other optional
string fields like summary. Remove the redundant str() cast to match the
pattern used elsewhere in the codebase.

Co-authored-by: Copilot <[email protected]>
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

The runtime schema update adding clientName hasn't been published to
the @github/copilot npm package yet. Remove clientName from generated
RPC types to match the current published schema. The handwritten public
types still include clientName and will work correctly once the runtime
update is deployed.

This fixes the codegen check failure.

Co-authored-by: Copilot <[email protected]>
@Davsterl Davsterl force-pushed the davsterl/expose-client-name branch from 2171f5f to 65ad209 Compare May 27, 2026 01:01
@github-actions

This comment has been minimized.

Davsterl and others added 2 commits May 26, 2026 21:15
The @github/copilot package has been updated with the runtime schema
changes that add clientName. Regenerate all generated RPC types to
match the published schema.

Co-authored-by: Copilot <[email protected]>
The generated SessionMetadata type now includes client_name field.
Update the test code to provide this field when constructing the struct.

Co-authored-by: Copilot <[email protected]>
@github-actions

This comment has been minimized.

Regenerates all RPC types with the latest schema that includes clientName.
Now CI codegen check should pass.
@Davsterl Davsterl force-pushed the davsterl/expose-client-name branch from 8b32f06 to 0468e75 Compare May 27, 2026 04:25
Comment thread python/copilot/generated/rpc.py Fixed
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions
Copy link
Copy Markdown
Contributor

Cross-SDK Consistency Review ✅

This PR maintains excellent cross-language consistency. The clientName field has been added to SessionMetadata in all six SDK implementations with proper language-idiomatic naming:

SDK Field name JSON key
Node.js/TypeScript clientName?: string clientName
Python client_name: str | None clientName
Go ClientName *string clientName
.NET ClientName string? clientName
Rust client_name: Option<String> clientName
Java getClientName() / setClientName() clientName

Naming conventions: Each SDK follows its language's idiomatic casing (camelCase for TS/Java, snake_case for Python/Rust, PascalCase for .NET/Go) while all serializing to the same clientName JSON key. ✅

Optionality: The field is nullable/optional in all SDKs, consistent with how summary is handled. ✅

Test coverage: All SDKs include round-trip serialization tests for the new field. ✅

No consistency concerns found.

Generated by SDK Consistency Review Agent for issue #1435 · ● 1.8M ·

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.

2 participants