Skip to content

Add experimental GitHub telemetry redirection across all SDKs#1835

Draft
MackinnonBuck wants to merge 9 commits into
mainfrom
mackinnonbuck-sdk-github-telemetry-contract
Draft

Add experimental GitHub telemetry redirection across all SDKs#1835
MackinnonBuck wants to merge 9 commits into
mainfrom
mackinnonbuck-sdk-github-telemetry-contract

Conversation

@MackinnonBuck

Copy link
Copy Markdown
Collaborator

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 onGitHubTelemetry callback (per-language naming) and a hand-written opt-in: when a host registers a handler, the client sets enableGitHubTelemetryRedirection on every session it creates or resumes, and dispatches each gitHubTelemetry.event notification to the callback.

Key pieces:

  • Generated types. Regenerated the RPC types in all languages from the new schema (GitHubTelemetryNotification, GitHubTelemetryEvent, GitHubTelemetryClientInfo, and the gitHubTelemetry.event clientGlobal method). The shared codegen change adds a notification flag to RpcMethod so generators emit notification-style dispatch (no JSON-RPC reply) for void clientGlobal methods.
  • Hand-written glue. Each SDK surfaces the callback using its existing 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.
  • Tests. Real-wire tests per language verify the handler fires with a correctly typed payload and that the opt-in flag is present when a handler is registered and omitted otherwise.

Notable decisions

  • One commit per language (plus a small shared codegen-infra commit for 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 shared utils.ts change is purely additive (an optional notification? field), so it stays put and never breaks the remaining generators.
  • "Unadvertised" where the language supports it. C# uses [EditorBrowsable(EditorBrowsableState.Never)] and Rust uses #[doc(hidden)]. Languages without a true "exported but hidden" mechanism stay visible + experimental with minimal docs.
  • No public docs. The types are internal/experimental by design.

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.

MackinnonBuck and others added 8 commits June 29, 2026 14:01
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>
Comment thread rust/src/router.rs
);
}
}
Err(e) => {
@github-actions

This comment has been minimized.

Comment on lines +213 to +215
catch (Exception ex) when (ex is OperationCanceledException or ObjectDisposedException or IOException or SocketException)
{
}
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>
@github-actions

Copy link
Copy Markdown
Contributor

Cross-SDK Consistency Review

This PR implements the gitHubTelemetry.event consumer surface across all six SDKs (Node.js, Python, Go, .NET, Java, Rust). The implementation is strongly consistent across languages. A few notes:

✅ Consistent across all SDKs

  • Callback option naming follows each language's conventions: onGitHubTelemetry (TS/Java), on_github_telemetry (Python/Rust), OnGitHubTelemetry (Go/.NET)
  • Wire flag enableGitHubTelemetryRedirection is set on both createSession and resumeSession in all six implementations
  • Notification dispatch — all SDKs intercept gitHubTelemetry.event and forward to the registered callback
  • Adapter pattern — all SDKs use a language-appropriate adapter class/type to bridge the raw RPC layer to the user callback
  • Experimental markers.NET uses [EditorBrowsable(EditorBrowsableState.Never)]+[Experimental], Rust uses #[doc(hidden)], others use inline doc notes (consistent with the PR's stated "unadvertised where supported" policy)
  • Tests — all six SDKs add tests covering the opt-in flag presence/absence and notification dispatch

⚠️ Minor inconsistency: Python doesn't export the telemetry types from the public API root

Node.js adds GitHubTelemetryNotification, GitHubTelemetryEvent, and GitHubTelemetryClientInfo to nodejs/src/index.ts (the package entry point), so consumers can do:

import { GitHubTelemetryNotification } from '`@github/copilot-sdk`';

In Python, these types live in copilot.generated.rpc and are not added to python/copilot/__init__.py. A consumer wanting to type-annotate their callback would need:

from copilot.generated.rpc import GitHubTelemetryNotification  # internal path

This differs from how other comparable types (e.g. ModelBillingTokenPrices) are handled — those are exported from both index.ts and __init__.py.

Given the intentionally "internal and experimental" posture described in the PR, keeping these types out of __init__.py may be a deliberate choice. But if that's the intent, it would be worth a brief comment in the Python code (or alternatively, add the three types to __init__.py to match the Node.js export surface). Go, .NET, Java, and Rust all expose the types through their normal public import paths (rpc.GitHubTelemetryNotification, Rpc.GitHubTelemetryNotification, com.github.copilot.rpc.GitHubTelemetryNotification, github_telemetry::GitHubTelemetryNotification respectively), so Python is the only SDK where the types are reachable only via an internal subpath.


Overall this is a well-coordinated cross-SDK feature addition. The one Python export gap is the only cross-language inconsistency I found.

Generated by SDK Consistency Review Agent for issue #1835 · sonnet46 3.6M ·

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