Add experimental GitHub telemetry redirection across all SDKs#1835
Add experimental GitHub telemetry redirection across all SDKs#1835MackinnonBuck wants to merge 16 commits into
Conversation
Adds an optional otification marker to the shared RpcMethod interface so the per-language generators can emit notification-style dispatch (no JSON-RPC reply) for void clientGlobal methods such as gitHubTelemetry.event. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Regenerates the TypeScript RPC types for the experimental gitHubTelemetry.event clientGlobal notification and wires an onGitHubTelemetry callback on the client. Registering a handler opts created/resumed sessions into telemetry redirection. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Regenerates the C# RPC types for the experimental gitHubTelemetry.event clientGlobal notification and adds an OnGitHubTelemetry callback. Registering a handler opts created/resumed sessions into telemetry redirection. The option is marked [Experimental] and [EditorBrowsable(Never)] to keep it unadvertised. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Regenerates the Python RPC types for the experimental gitHubTelemetry.event clientGlobal notification and adds an on_github_telemetry callback. Registering a handler opts created/resumed sessions into telemetry redirection. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Regenerates the Go RPC types for the experimental gitHubTelemetry.event clientGlobal notification and adds an OnGitHubTelemetry callback. Registering a handler opts created/resumed sessions into telemetry redirection. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Regenerates the Rust RPC types for the experimental gitHubTelemetry.event clientGlobal notification and adds an on_github_telemetry callback. Registering a handler opts created/resumed sessions into telemetry redirection. The telemetry module is #[doc(hidden)] to keep it unadvertised. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Adds the experimental gitHubTelemetry.event notification adapter and an onGitHubTelemetry client option. Registering a handler opts created/resumed sessions into telemetry redirection. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Resolves conflicts in two generated files where main's @github/copilot 1.0.66-2 bump added new RPC types (GitHubRepoRef, user settings, mcp headers, push attachments, etc.) adjacent to this branch's GitHubTelemetry* types: - go/rpc/zrpc.go: union of both sides' struct declarations. - python/copilot/generated/rpc.py: union of __all__ exports and reconstruction of the RPC.from_dict positional constructor call from the (auto-merged) assignment order, verified to match the RPC dataclass field order (795 fields). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
Keep experimental GitHub telemetry schema additions available to codegen until they ship in the packaged Copilot schema, and apply formatter output required by CI. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
The runtime renamed the per-session opt-in capability from "redirection" to "forwarding" (wire field enableGitHubTelemetryForwarding) and updated the GitHubTelemetry schema description strings. This mirrors that rename across every SDK plus the codegen schema overlay so the hand-written opt-in flag matches the runtime contract. Also folds in two PR review fixes: - dotnet: document the expected-teardown catch in GitHubTelemetryTests DisposeAsync (was an empty catch). - python: re-export GitHubTelemetryNotification/Event/ClientInfo from copilot/__init__.py for parity with the nodejs public surface. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…hub-telemetry-contract # Conflicts: # go/client_test.go
There was a problem hiding this comment.
Pull request overview
Implements an experimental cross-SDK surface for receiving per-session GitHub (hydro) telemetry forwarded by the runtime via a new JSON-RPC client-global notification (gitHubTelemetry.event). The PR extends shared codegen to understand notification-style RPC methods and wires opt-in + dispatch behavior across TypeScript/Node, Python, Go, Rust, Java, and .NET, with tests validating forwarding and handler invocation.
Changes:
- Added schema override + shared codegen support for notification-style client-global methods (
RpcMethod.notification) and for injecting additive API schema entries during schema loading. - Implemented per-SDK “on GitHub telemetry” callback wiring and session create/resume opt-in (
enableGitHubTelemetryForwarding) when a handler is registered. - Added/updated unit/integration tests across SDKs to validate handler dispatch and the opt-in flag behavior.
Show a summary per file
| File | Description |
|---|---|
| scripts/codegen/utils.ts | Loads API schema and applies additive overrides; adds notification?: boolean to RpcMethod. |
| scripts/codegen/typescript.ts | Emits onNotification wiring for notification-style client-global methods. |
| scripts/codegen/schema-overrides/api-additions.schema.json | Adds gitHubTelemetry.event + telemetry types via additive schema override (marked notification + experimental). |
| scripts/codegen/rust.ts | Switches schema loading to shared loadSchemaJson (enabling overrides). |
| scripts/codegen/python.ts | Emits notification-handler wiring for notification-style client-global methods. |
| scripts/codegen/go.ts | Adjusts Go codegen for client-global void/notification methods and emits notification-safe handler signatures. |
| rust/src/github_telemetry.rs | New Rust module re-exporting telemetry types + callback alias (doc-hidden). |
| rust/src/lib.rs | Adds client option + plumbing for telemetry callback; adds test constructor helper. |
| rust/src/router.rs | Routes gitHubTelemetry.event client-global notifications to callback (if set). |
| rust/src/session.rs | Sets enableGitHubTelemetryForwarding on create/resume when callback registered. |
| rust/src/types.rs | Initializes new wire fields to None in config→wire conversion. |
| rust/src/wire.rs | Adds enableGitHubTelemetryForwarding wire field to create/resume request DTOs. |
| rust/src/generated/api_types.rs | Generated telemetry DTOs. |
| rust/tests/session_test.rs | Rust integration tests validating opt-in flag and callback dispatch. |
| python/copilot/_jsonrpc.py | Adds method-specific notification handler registry + dispatch path. |
| python/copilot/generated/rpc.py | Generated telemetry DTOs + client-global notification handler registration for gitHubTelemetry.event. |
| python/copilot/client.py | Adds on_github_telemetry option, opt-in flag wiring, and registers client-global handlers. |
| python/copilot/init.py | Re-exports telemetry DTOs at package level. |
| python/test_client.py | Python unit tests for opt-in flag and notification dispatch path. |
| nodejs/src/generated/rpc.ts | Generated telemetry DTOs + onNotification registration for gitHubTelemetry.event. |
| nodejs/src/types.ts | Exposes telemetry DTOs and adds onGitHubTelemetry option type. |
| nodejs/src/index.ts | Re-exports telemetry DTO types from the public entrypoint. |
| nodejs/src/client.ts | Wires onGitHubTelemetry, registers client-global handlers, and sets session opt-in flag. |
| nodejs/test/client.test.ts | Node tests for opt-in flag behavior and notification dispatch. |
| go/rpc/zrpc.go | Generated Go telemetry DTOs + client-global handler interface + registration. |
| go/types.go | Adds OnGitHubTelemetry client option and wire fields on create/resume DTOs. |
| go/client.go | Sets opt-in flag on create/resume and registers telemetry callback adapter. |
| go/client_test.go | Go tests validating opt-in flag serialization and notification routing to callback. |
| java/src/main/java/com/github/copilot/GitHubTelemetryAdapter.java | Java adapter bridging gitHubTelemetry.event into consumer callback. |
| java/src/main/java/com/github/copilot/CopilotClient.java | Registers telemetry adapter on connect; sets opt-in flag on create/resume when handler set. |
| java/src/main/java/com/github/copilot/rpc/CopilotClientOptions.java | Adds experimental setOnGitHubTelemetry option and clones it. |
| java/src/main/java/com/github/copilot/rpc/CreateSessionRequest.java | Adds enableGitHubTelemetryForwarding field + accessors. |
| java/src/main/java/com/github/copilot/rpc/ResumeSessionRequest.java | Adds enableGitHubTelemetryForwarding field + accessors. |
| java/src/main/java/com/github/copilot/rpc/GitHubTelemetryClientInfo.java | Java telemetry DTO. |
| java/src/main/java/com/github/copilot/rpc/GitHubTelemetryEvent.java | Java telemetry DTO. |
| java/src/main/java/com/github/copilot/rpc/GitHubTelemetryNotification.java | Java telemetry DTO. |
| java/src/test/java/com/github/copilot/GitHubTelemetryTest.java | Java tests verifying adapter dispatch and opt-in flag on create/resume. |
| dotnet/src/Generated/Rpc.cs | Generated telemetry DTOs + client-global handler interface and registration. |
| dotnet/src/Types.cs | Adds hidden experimental OnGitHubTelemetry option to CopilotClientOptions. |
| dotnet/src/Client.cs | Sets opt-in flag when handler present; registers telemetry adapter in client-global handlers. |
| dotnet/test/Unit/GitHubTelemetryTests.cs | .NET unit tests validating opt-in behavior and notification forwarding. |
Review details
Files not reviewed (1)
- go/rpc/zrpc.go: Generated file
- Files reviewed: 36/41 changed files
- Comments generated: 6
- Review effort level: Low
Address PR review feedback on the Node telemetry surface: - Omit enableGitHubTelemetryForwarding from session.create/resume unless a handler is registered, matching Go/Python/Rust/dotnet/Java (which all omit the field when off) instead of always sending false. - Isolate consumer callback failures: await the handler inside try/catch so async callbacks or thrown errors cannot leak into the JSON-RPC dispatch path (mirrors the panic isolation in the other SDKs). - Widen onGitHubTelemetry to return void | Promise<void> so consumers can supply async callbacks. - Update the no-handler test to assert the field is absent rather than false. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Use asyncio.create_task instead of the legacy asyncio.ensure_future when scheduling awaitable notification handlers on the event loop thread. - Drop the redundant local `import asyncio` in the telemetry transport test (asyncio is already imported at module scope), clearing CodeQL py/repeated-import. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The DisposeAsync teardown catch swallows expected listener/socket shutdown exceptions. Observe the caught exception so the block is no longer empty, clearing CodeQL cs/empty-catch-block. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
Brings in the @github/copilot 1.0.66 bump (#1859), which re-ran the code generators and added new RPC/session types (SessionLimits*, SessionCompletions, AdaptiveThinkingSupport, etc.). Conflicts were limited to generated files (dotnet Rpc.cs, python rpc.py). Resolved by installing 1.0.66 and re-running `scripts/codegen` with the telemetry schema overlay, so every generated file is a consistent product of the 1.0.66 schema plus the experimental GitHub telemetry additions rather than a hand-merged blend. Verified 1.0.66 still does not ship the telemetry types, so the overlay remains required. Codegen is idempotent (re-running produces no diff) and the hand-written telemetry glue (including the Node conditional-spread opt-in) is unchanged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Cross-SDK Consistency Review ✅This PR adds the experimental GitHub telemetry forwarding feature across all six SDK implementations. Overall, it maintains excellent cross-SDK consistency. What's consistent ✅
All naming follows each language's conventions (camelCase/snake_case/PascalCase/bean-style). The Minor observation: error handling in callback dispatchThere's a small inconsistency in how user-callback exceptions are handled across SDKs:
This isn't a blocking issue (the .NET RPC layer may handle it upstream, and the telemetry path is "best-effort" by nature), but it's worth noting for consistency. If a user's SummaryThis is a well-implemented, genuinely cross-language feature addition. All SDKs have feature parity and consistent API design. No blocking consistency issues found.
|
Why
The runtime can now forward per-session GitHub (hydro) telemetry to opted-in host connections via a new JSON-RPC server to client notification,
gitHubTelemetry.event. This PR implements the consumer side of that contract in every language SDK so hosts can receive those events. The feature is internal and experimental, so it is intentionally kept low-profile and undocumented for public consumers.What
For each SDK this adds an
onGitHubTelemetrycallback (per-language naming) and a hand-written opt-in: when a host registers a handler, the client setsenableGitHubTelemetryRedirectionon every session it creates or resumes, and dispatches eachgitHubTelemetry.eventnotification to the callback.Key pieces:
GitHubTelemetryNotification,GitHubTelemetryEvent,GitHubTelemetryClientInfo, and thegitHubTelemetry.eventclientGlobal method). The shared codegen change adds anotificationflag toRpcMethodso generators emit notification-style dispatch (no JSON-RPC reply) for void clientGlobal methods.llmInference/ notification idiom and wires the opt-in flag into the create/resume requests. We deliberately reuse the generated RPC types directly rather than introducing friendly wrapper types.Notable decisions
utils.ts). This makes the feature trivially revertible language-by-language: reverting a single language's commit removes its support without touching the others. The sharedutils.tschange is purely additive (an optionalnotification?field), so it stays put and never breaks the remaining generators.[EditorBrowsable(EditorBrowsableState.Never)]and Rust uses#[doc(hidden)]. Languages without a true "exported but hidden" mechanism stay visible + experimental with minimal docs.Review notes
This is the SDK side of a contract whose runtime counterpart is merged-in-progress on the
@github/copilot(copilot-agent-runtime) side. The schema is the source of truth; generated files were produced by codegen, not hand-edited.