Skip to content

feat: forward GitHub telemetry (upstream #1835) + schema 1.0.68 sync#145

Merged
krukow merged 6 commits into
mainfrom
krukow-sync-upstream-github-telemetry
Jul 3, 2026
Merged

feat: forward GitHub telemetry (upstream #1835) + schema 1.0.68 sync#145
krukow merged 6 commits into
mainfrom
krukow-sync-upstream-github-telemetry

Conversation

@krukow

@krukow krukow commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

Generated via Copilot on behalf of @krukow

Syncs the Clojure SDK with two upstream github/copilot-sdk changes: the experimental GitHub telemetry forwarding callback (#1835) and the schema pin bump to 1.0.68 (#1886).

GitHub telemetry forwarding (#1835)

Adds the :on-github-telemetry client option — a one-arg callback marked @experimental / Internal, mirroring the Node/Python SDKs' onGitHubTelemetry. It is opt-in and off by default.

  • The wire flag enableGitHubTelemetryForwarding: true is stamped onto both session.create and session.resume params, but only when a handler is registered. The flag is omitted entirely otherwise — we never send false.
  • The runtime then emits id-less gitHubTelemetry.event notifications (client-global, not per-session); each invokes the callback.

Non-obvious bits a reviewer might wonder about:

  • catch Throwable, not catch Exception. The callback runs inside the shared notification go-loop. A consumer throwing a non-Exception Throwable (e.g. AssertionError) would otherwise unwind the loop and permanently kill notification dispatch for all sessions. This matches the ~10 other critical-path catch sites. A RED→GREEN regression test pins the behavior.
  • Opaque passthrough. The event's :properties, :metrics, and :features sub-maps are source-defined string maps whose keys must survive verbatim. protocol.clj re-assocs the raw pre-conversion values after wire->clj kebab-cases the rest of the event — the same escape-hatch pattern used for session.event / MCP args / SQL bind params.
  • Wire key casing. The flag keyword is emitted literally as :enableGitHubTelemetryForwarding because camel-snake-kebab would lowercase the H (enableGithubTelemetryForwarding).
  • Idiom specs are intentionally open. The telemetry notification/event/client-info specs are hand-curated open s/keys for documentation only; they are never validated against incoming notifications, so future upstream fields pass through untouched.

Schema 1.0.68 (#1886)

Schema-regen only. The upstream bump adds metadata context-attribution / heaviest-messages RPC methods and slash-command input choices to generated rpc.ts, but none are surfaced on the public Node SDK — so per the API-parity rule no hand-written Clojure API is added. Regenerated wire specs / coercions produced no diff (session events unchanged).

Deliberate non-goals

  • The npm-only version bump (#1892) is tooling and is not ported.
  • The sibling session.lifecycle notification handler has the same pre-existing catch Exception pattern; it is out of scope for this PR and tracked separately.

Validation

  • Full suite: 402 tests / 2178 assertions, 0 failures.
  • bb validate-docs: 17 files, 0 warnings.
  • bb ci:full: jar build ✓, run-all-examples.sh exit 0. (The E2E session.idle timeout is a known benign flake.)

Multi-model review (Phase 6)

# Finding Source Severity Validity Decision
1 Telemetry callback wrapper uses catch Exception; a handler throwing a non-Exception Throwable escapes, unwinds the notification go-loop, and permanently kills dispatch for ALL sessions GPT-5.5 HIGH Valid (reproduced via RED test) FIXEDcatch Exceptioncatch Throwable. RED→GREEN regression test added.
2 normalize-config-for-mode docstring's final line is stale — steps 1 and 3 fire in every mode; only step 2 is :empty-only Opus Note Valid (doc-only) FIXED — corrected the sentence.
3 Telemetry specs' comments overstate the nesting encoded (:event/:client described as nested but not wired into :opt-un) Opus Note Partially valid PARTIALLY FIXED — added ::event and wired it in. ::client collides with the client-record spec keyword; left as open passthrough, comments made honest.
4 Telemetry event specs are too permissive (open maps) GPT-5.5 MEDIUM Invalid DISMISSED — event-data specs are intentionally open for documentation; never validated at runtime; @experimental may change upstream.

krukow and others added 5 commits July 3, 2026 15:11
Sync the pinned @github/copilot schema to 1.0.68. The upstream bump adds
metadata context-attribution / heaviest-messages RPC methods and slash-command
input choices to generated rpc.ts only; none are surfaced on the public Node
SDK, so no hand-written Clojure API changes are needed. Regenerated wire specs
and coercions produced no diff (session events unchanged).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ream #1835)

Add the experimental/internal :on-github-telemetry client callback. When (and
only when) a handler is registered, the client stamps
enableGitHubTelemetryForwarding: true onto the wire params of both
session.create and session.resume; the flag is omitted entirely otherwise.

The notification router gains a "gitHubTelemetry.event" branch that invokes the
callback with the normalized notification params, wrapped in catch Throwable so
a throwing consumer cannot unwind the go-loop and kill dispatch for all sessions.

The runtime's three source-defined sub-maps (:properties, :metrics, :features)
are opaque string maps whose keys must survive verbatim, so an escape hatch in
protocol.clj re-assocs the raw pre-conversion values after wire->clj kebab-cases
the rest of the event.

Hand-curated idiom specs document the notification/event/client-info shapes as
open maps so future upstream fields pass through.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add three integration tests exercising the :on-github-telemetry callback, the
enableGitHubTelemetryForwarding wire flag on create and resume, and the opaque
passthrough of :properties/:metrics/:features. Add a regression test asserting
that a handler throwing a non-Exception Throwable does not kill the notification
router.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add the :on-github-telemetry client-option row and a GitHub telemetry
forwarding subsection under Observability in the API reference, covering the
callback signature, opt-in semantics, notification/event shapes, and the
opaque-passthrough note for :properties/:metrics/:features. Record the sync in
the changelog citing upstream #1835 and the schema 1.0.68 regen (#1886).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sync the version to the 1.0.6-preview.1 upstream pre-release (the sync point for
#1835/#1886) with Clojure patch 0, and teach the build validators to accept
preview qualifiers.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 3, 2026 13:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Syncs the Clojure Copilot SDK with upstream changes by adding opt-in GitHub telemetry forwarding (experimental/internal) and bumping the pinned schema package version to 1.0.68, with accompanying tests and documentation updates.

Changes:

  • Added client option :on-github-telemetry and routing for gitHubTelemetry.event notifications, including an escape hatch to preserve opaque sub-maps verbatim.
  • Stamped enableGitHubTelemetryForwarding: true onto session.create and session.resume when the handler is registered, plus integration tests covering wire params and callback behavior.
  • Synced schema pin to 1.0.68 and updated changelog/docs/version strings accordingly.
Show a summary per file
File Description
test/github/copilot_sdk/integration_test.clj Adds integration tests for telemetry opt-in flagging and notification callback behavior (including Throwable safety).
src/github/copilot_sdk/specs.clj Introduces specs for :on-github-telemetry and idiom-shaped telemetry notification/event maps (open maps).
src/github/copilot_sdk/protocol.clj Adds protocol normalization escape hatch to preserve telemetry opaque sub-maps’ keys verbatim.
src/github/copilot_sdk/client.clj Wires client option, enables forwarding flag on create/resume, and dispatches telemetry notifications to the callback with Throwable protection.
schemas/README.md Updates documented pinned schema version to 1.0.68.
schemas/api.schema.json Regenerated schema content for 1.0.68.
README.md Bumps example dependency version to 1.0.6-preview.1.0.
doc/reference/API.md Documents the new :on-github-telemetry option and describes the notification/event shapes.
doc/getting-started.md Updates dependency snippet version to 1.0.6-preview.1.0.
CHANGELOG.md Adds Unreleased entry describing telemetry forwarding + schema 1.0.68 sync.
build.clj Updates project version and expands upstream version regex/error message to include preview.
.copilot-schema-version Bumps pinned schema version to 1.0.68.

Review details

  • Files reviewed: 12/12 changed files
  • Comments generated: 2
  • Review effort level: Low

Comment thread src/github/copilot_sdk/client.clj Outdated
Comment thread src/github/copilot_sdk/client.clj Outdated
…y true

The session.create/resume wire builders gated the forwarding flag on
`some?`, which would leak `enableGitHubTelemetryForwarding: false` onto
the wire if the config ever carried an explicit `false`. The documented
contract (mirroring upstream #1835) is to omit the field entirely and
never send `false`. Harden both builders to emit only for an explicit
`true` config value; `false`/`nil` omit the key.

Adds a direct-builder regression test covering true/false/absent for
both the create and resume paths.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review details

  • Files reviewed: 12/12 changed files
  • Comments generated: 0 new
  • Review effort level: Low

@krukow krukow marked this pull request as ready for review July 3, 2026 13:55
@krukow krukow merged commit 4082290 into main Jul 3, 2026
3 checks passed
@krukow krukow deleted the krukow-sync-upstream-github-telemetry branch July 3, 2026 13:55
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