Skip to content

feat: sync upstream copilot-sdk (post-v1.0.1, CLI schema 1.0.63)#139

Merged
krukow merged 6 commits into
mainfrom
krukow/upstream-sync-post-v1-0-1
Jun 18, 2026
Merged

feat: sync upstream copilot-sdk (post-v1.0.1, CLI schema 1.0.63)#139
krukow merged 6 commits into
mainfrom
krukow/upstream-sync-post-v1-0-1

Conversation

@krukow

@krukow krukow commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

Generated via Copilot on behalf of @krukow

Brings the Clojure SDK to parity with the unreleased public-SDK surface upstream has merged since v1.0.1, and bumps the pinned CLI schema 1.0.61 → 1.0.63. Clojure patch version 1.0.1.0 → 1.0.1.1.

What this adds

  • :memory session config ({:enabled boolean}) — forwarded on both create-session and resume-session. (upstream #1617)
  • :otlp-protocol telemetry option"http/json" / "http/protobuf", mapped to the OTEL_EXPORTER_OTLP_PROTOCOL env var on the spawned CLI. (upstream #1648)
  • Graceful shutdownstop! now sends a runtime.shutdown RPC and waits for SDK-owned processes to exit naturally (10s bound) before terminating. force-stop! is unchanged. (upstream #1667)
  • :defer-tools on MCP stdio/http server configs#{:auto :never}, rendered as deferTools on the wire (1.0.63 schema).
  • :token-prices on ::model-billing. (upstream #1633)
  • Schema 1.0.63 additions — the :copilot/session.todos_changed public event, optional assistant.usage fields (content-filter/finish-reason), and tool.execution_complete structured content.

Implementation notes

  • :memory is omit-vs-null. It is only placed on the wire when the caller sets it, never sent as null. In :empty mode it defaults to {:enabled false} to match upstream configDefaultsForMode; caller config always wins over the mode default.
  • Graceful shutdown ordering. runtime.shutdown is sent after sessions disconnect but before the connection closes, and only for SDK-owned (non-external) processes. If the RPC fails or the process doesn't exit within the timeout, stop! falls back to SIGTERM→SIGKILL — it never hangs. The wait uses Process.waitFor rather than the exit channel to avoid racing the existing exit-watcher consumer.
  • generated/ is regenerated, not hand-edited. The schema additions flow in through bb codegen; the idiom layer only moves under curated review.

Validation

bb ci:full green — E2E tests, all examples, bb validate-docs (17 files, 0 warnings), and bb jar.

Multi-model review (claude-opus-4.8 + gpt-5.5) surfaced three findings, all fixed and re-validated:

Severity Finding Resolution
HIGH :empty mode missing the memory {:enabled false} default Added to config-defaults-for-mode; caller override wins
MEDIUM Graceful shutdown killed the child immediately instead of waiting Added wait-for-exit!; stop! waits up to 10s for natural exit
LOW Stale advisor-block spec test asserting removed fields Replaced with :server-tools / :service-request-id assertions

Opening as a draft for @krukow's review.

krukow and others added 4 commits June 17, 2026 10:02
Pins @github/copilot to 1.0.63 and regenerates generated/event_specs.clj
from the refreshed JSON Schemas. Pulls in new wire surface: the
session.todos_changed event, optional AssistantUsageData fields
(contentFilterTriggered, finishReason), ToolExecutionCompleteResult
structuredContent, ToolExecutionStartData toolDescription, and the
plugin/session ExtensionSource values.

Upstream: github/copilot-sdk#1686 (1.0.63),
commit a115246a (1.0.62).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Adds the public-SDK surface introduced upstream after v1.0.1:

- :memory session config ({:enabled boolean}) forwarded on both
  create-session and resume-session, omitted when unset.
  github/copilot-sdk#1617
- :otlp-protocol telemetry option mapped to OTEL_EXPORTER_OTLP_PROTOCOL.
  github/copilot-sdk#1648
- Graceful runtime.shutdown in stop! for SDK-owned processes, bounded by
  a 10s timeout; force-stop! left unchanged.
  github/copilot-sdk#1667
- :mcp-defer-tools (#{:auto :never}) on MCP stdio/http server configs,
  rendered as deferTools on the wire (1.0.63 schema).
- :token-prices on ::model-billing.
  github/copilot-sdk#1633
- Optional event-data fields surfaced by the 1.0.63 schema
  (assistant.usage content-filter/finish-reason,
  tool.execution_complete structured-content) and the
  :copilot/session.todos_changed public event.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Adds integration coverage for the new session config and wire mappings,
mock-server handling for the runtime.shutdown RPC, and process-level
assertions for graceful termination ordering.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Documents :memory, :otlp-protocol, MCP :defer-tools, :token-prices,
the session.todos_changed event, and graceful shutdown across API.md,
the MCP overview, and CHANGELOG. Bumps the Clojure patch to 1.0.1.1.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 17, 2026 09:20

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 to upstream changes post-v1.0.1, including a CLI schema bump to 1.0.63 and corresponding SDK/API surface updates (session :memory, OTLP protocol telemetry, graceful shutdown, MCP deferTools, and new/updated event/spec shapes).

Changes:

  • Add session :memory config (forwarded on create/resume; defaulted off in :empty mode) and update specs/tests/docs accordingly.
  • Add telemetry :otlp-protocolOTEL_EXPORTER_OTLP_PROTOCOL, plus graceful runtime.shutdown handling in stop! (with wait-for-exit).
  • Regenerate schema-derived artifacts for CLI schema 1.0.63 (new session.todos_changed event, optional usage/tool fields, MCP deferTools, etc.), and bump project version/pinned schema.
Show a summary per file
File Description
test/github/copilot_sdk/process_test.clj Adds unit coverage for OTLP protocol env var mapping and omission behavior.
test/github/copilot_sdk/mock_server.clj Extends mock RPC surface to include runtime.shutdown for shutdown-path tests.
test/github/copilot_sdk/integration_test.clj Updates spec assertions, adds coverage for :memory, MCP deferTools, and graceful shutdown behavior.
src/github/copilot_sdk/util.clj Adds MCP :mcp-defer-tools mapping and value stringification in wire conversion.
src/github/copilot_sdk/specs.clj Adds/updates specs for OTLP protocol, MCP defer-tools, memory config, new events/fields, and token pricing metadata.
src/github/copilot_sdk/process.clj Maps :otlp-protocol to env var; introduces wait-for-exit! helper for graceful stop.
src/github/copilot_sdk/generated/event_specs.clj Regenerated wire specs for schema 1.0.63 (new event + field changes).
src/github/copilot_sdk/client.clj Implements graceful stop! via runtime.shutdown + bounded wait; adds :memory to create/resume wire config; updates docs/comments.
src/github/copilot_sdk.clj Exposes new :copilot/session.todos_changed in curated event sets.
schemas/session-events.schema.json Updates pinned upstream session-events schema (serverTools, todos_changed, optional usage/tool fields, etc.).
schemas/README.md Updates documented pinned schema version.
schemas/api.schema.json Updates pinned upstream API schema (todos deps RPC, provider endpoint RPC, MCP deferTools, memory config, etc.).
README.md Bumps documented dependency version to 1.0.1.1.
doc/reference/API.md Documents new :memory, :otlp-protocol, updated :empty defaults count, graceful stop, and new event fields.
doc/mcp/overview.md Documents :mcp-defer-tools and its wire encoding.
doc/getting-started.md Bumps documented dependency version to 1.0.1.1.
CHANGELOG.md Adds unreleased entries describing the upstream sync features and schema bump.
build.clj Bumps project version to 1.0.1.1.
.copilot-schema-version Bumps pinned schema version to 1.0.63.

Copilot's findings

  • Files reviewed: 18/19 changed files
  • Comments generated: 4

Comment thread CHANGELOG.md Outdated
Comment thread src/github/copilot_sdk/specs.clj Outdated
Comment thread src/github/copilot_sdk/util.clj Outdated
Comment thread src/github/copilot_sdk/process.clj
Resolve four findings from the Copilot Code Review bot on PR #139:

- process.clj: preserve the thread interrupt flag in wait-for-exit!.
  .waitFor throws InterruptedException (a subclass of Exception), so the
  generic catch was swallowing it and clearing the interrupt flag. Catch
  it separately and re-set the flag via (.interrupt (Thread/currentThread))
  so callers still observe cancellation.
- util.clj: correct the mcp-server->wire docstring example. clj->wire
  produces camelCase keyword keys, not string keys.
- specs.clj: fix the memory-config comment to cite upstream PR #1617
  (not #1638).
- CHANGELOG.md: drop the nonexistent ::memory-enabled spec reference;
  only ::memory exists (reusing the existing ::enabled spec).

Co-authored-by: Copilot <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.

Copilot's findings

  • Files reviewed: 18/19 changed files
  • Comments generated: 1

Comment thread doc/reference/API.md Outdated
The session.todos_changed event reference pointed Clojure users at
session.plan.readSqlTodosWithDependencies(), a TS-style method call for
an @experimental upstream method this SDK does not expose. Reword the row
as signal-only with no payload, consistent with how the rest of the doc
names JSON-RPC methods.

Co-authored-by: Copilot <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.

Copilot's findings

  • Files reviewed: 18/19 changed files
  • Comments generated: 0 new

@krukow krukow marked this pull request as ready for review June 18, 2026 09:20
@krukow krukow merged commit 7626bb7 into main Jun 18, 2026
3 checks passed
@krukow krukow deleted the krukow/upstream-sync-post-v1-0-1 branch June 18, 2026 09:20
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