Upstream sync: post-v1.0.0-beta.4 (#1290, #1306, #1308, #1309) + schema 1.0.49-1#107
Conversation
Add optional :agent-model to entries in :custom-agents. When set, the runtime tries to use that model for the agent, falling back to the parent session model if unavailable. Wire conversion goes through util/clj->wire automatically: :agent-model becomes :agentModel on the wire, sent on both session.create and session.resume custom-agents entries — consistent with the existing :agent-name / :agent-display-name / :agent-skills convention. Upstream parity: matches the new model?: string field added to CustomAgentConfig in nodejs/src/types.ts (upstream commit d0eb531e, PR #1309). No other upstream changes since v1.0.0-beta.4 require porting: - #1295 (remote_session) was already shipped in CLI 1.0.48 sync (PR #103) - E2E test stabilization commits affect upstream test fixtures only - CLI version bumps (1.0.49-*) are prerelease; we stay pinned to 1.0.48 Tests: 3 new integration tests (spec validation, wire payload on session.create/resume, omission when not set). Full suite: 257 tests, 1203 assertions, 0 failures. bb ci:full passes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Regenerate wire specs and coercions for upstream PRs #1305, #1307. New pass-through event fields: :display-prompt, :reasoning-summary, :previous-reasoning-summary. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Port three upstream copilot-sdk changes following v1.0.0-beta.4:
* #1290 — :session-id on hook input maps. Hook handlers now receive a
:session-id key on the input map. The wire-provided sessionId from
sub-agent hooks is preserved; otherwise the SDK fills in the parent
session id.
* #1306 — :cloud session config option. create-session and resume-session
accept an optional :cloud {:repository {:owner _ :repository _}} map for
binding the session to a cloud repository. Forwarded as cloud.repository.*
on the wire.
* #1308 — Optional permission and tool callbacks. :on-permission-request is
now optional on create-session/resume-session; :handler is optional on
tools defined via define-tool. When omitted, requests are not auto-resolved
and applications resolve them via the new public functions:
- handle-pending-tool-call! / <handle-pending-tool-call!
- handle-pending-permission-request! / <handle-pending-permission-request!
Note: this is a behavioural change — previously the SDK threw if
:on-permission-request was missing.
Includes specs, fdefs, SDK ns re-exports, integration tests, API.md
reference updates, and CHANGELOG entries under the existing
post-v1.0.0-beta.4 sync section.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Ports several upstream github/copilot-sdk post–v1.0.0-beta.4 changes into the Clojure SDK, including optional callbacks, cloud session config, hook input :session-id behavior, and a schema bump to 1.0.49-1.
Changes:
- Add
:cloudsession config forwarding + validation, and tests ensuring correct wire serialization. - Make
:on-permission-request(session config) and tool:handleroptional; add public APIs to manually resolve pending permission/tool RPCs. - Regenerate schemas/specs for
1.0.49-1and update docs/changelog accordingly.
Show a summary per file
| File | Description |
|---|---|
test/github/copilot_sdk/integration_test.clj |
Adds/updates integration tests for :cloud, optional callbacks, hook :session-id, and per-agent :agent-model. |
src/github/copilot_sdk/tools.clj |
Makes define-tool omit :tool-handler when handler is absent (declaration-only tools). |
src/github/copilot_sdk/specs.clj |
Updates specs for optional tool handlers, optional permission callback, adds :cloud + :agent-model fields. |
src/github/copilot_sdk/session.clj |
Skips nil tool handlers in handler-map, preserves/infers hook input :session-id, and adds pending-RPC resolver APIs. |
src/github/copilot_sdk/instrument.clj |
Registers fdefs for the new pending-RPC resolver functions. |
src/github/copilot_sdk/generated/event_specs.clj |
Regenerated wire event specs for schema 1.0.49-1 (new fields like displayPrompt, reasoningSummary). |
src/github/copilot_sdk/client.clj |
Skips v3 auto-resolution when handlers are absent; forwards :cloud on session.create/resume; removes required permission-handler checks. |
src/github/copilot_sdk.clj |
Exposes new public wrapper fns for manually handling pending tool/permission requests. |
schemas/session-events.schema.json |
Updates upstream-fetched schema contents (adds descriptions + new fields/types). |
schemas/README.md |
Updates pinned schema version display to 1.0.49-1. |
doc/reference/API.md |
Documents new options/APIs (cloud config, optional permission handler, pending-RPC resolver fns, declaration-only tools). |
CHANGELOG.md |
Adds unreleased entries describing the upstream sync changes and schema bump. |
.copilot-schema-version |
Bumps pinned schema version from 1.0.48 to 1.0.49-1. |
Copilot's findings
- Files reviewed: 11/14 changed files
- Comments generated: 5
Opus 4.7 finding (MEDIUM): :cloud diverged from upstream — upstream's ResumeSessionConfig is a Pick<SessionConfig, ...> that explicitly excludes `cloud`. Cloud is creation-only. Drop :cloud from resume-session-config-keys, from the :opt-un of ::resume-session-config and ::join-session-config, and from build-resume-session-params. GPT-5.5 finding (MEDIUM): define-tool-from-spec still installed a :tool-handler wrapper when :handler was omitted, causing v3 external_tool.requested events to auto-resolve to nil instead of remaining pending. Mirror define-tool: only attach :tool-handler when a user handler is supplied. Added a test for declaration-only tools via define-tool-from-spec. Updated CHANGELOG and API.md to clarify that :cloud is create-only. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Multi-model code review (phase 6)Ran parallel reviews with Claude Opus 4.7 and GPT-5.5 before requesting human/Copilot review. Both surfaced one MEDIUM finding each; both were valid and have been addressed in
All 265 tests / 1238 assertions still pass. Out of scope (noted, not blocking)
|
- session.clj: validate :error is a string in handle-pending-tool-call! and <handle-pending-tool-call! before forwarding to RPC. Add tests. - doc/reference/API.md: declaration-only tool surfaces as :copilot/external_tool.requested (not :copilot/session.tool_call). The CHANGELOG/API :cloud shape findings (Copilot comments 1 and 3 in the round-1 review) were already addressed in 9c4331d before this round. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Enforce non-blank :name in ::cloud-repository spec (was string? via shared ::name spec, allowing blanks despite docs) - handle-pending-tool-call! and async variant now throw when neither :result nor :error is supplied (previously fell through to default 'tool returned no result' payload) - Add tests for both new guards Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- :request-id must be a non-blank string across all four pending-RPC resolvers (previously a blank string would pass and produce opaque server-side errors) - handle-pending-permission-request! and async variant now validate :result :kind is a keyword in the documented decision set (:approve-once, :approve-for-session, :approve-for-location, :approve-permanently, :reject) - Add private supported-permission-decision-kinds set and check-pending-* helpers to avoid duplicating validation logic - Add integration tests for blank :request-id and bad :kind shapes Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…optional - create-session, resume-session, <create-session, <resume-session docstrings now state :on-permission-request is optional (upstream PR #1308) and explain that omission leaves permission requests pending for manual resolution - define-tool and define-tool-from-spec docstrings document the declaration-only case (no :handler) and reference session/handle-pending-tool-call! as the resolver Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ed names - create-session/resume-session docstrings now reference copilot/handle-pending-permission-request! (the public API name) instead of the internal session/ namespace - define-tool/define-tool-from-spec docstrings reference copilot/handle-pending-tool-call! - Async variants (names starting with '<') are wrapped in double backticks to avoid markdown parsers mis-reading '`<...' as an HTML tag fragment Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Schema cross-check (api.schema.json $defs/PermissionDecision) confirmed six variants in the upstream union: ApproveOnce, ApproveForSession, ApproveForLocation, ApprovePermanently, Reject, UserNotAvailable. - Add :user-not-available to supported-permission-decision-kinds - Update docstring to list the full set and reference PermissionDecision - Add positive integration tests for :user-not-available and :approve-permanently (previously only :approve-once was exercised) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
✅ Copilot Code Review iteration completeClean review from Copilot — 0 comments generated on commit Round-by-round summary
All 17 in-thread replies posted on the original review comments. All 265 tests / 1253 assertions passing; PR is ready for human review. |
…ta.4 # Conflicts: # CHANGELOG.md
Summary
Ports four upstream
github/copilot-sdkchanges merged after v1.0.0-beta.4 and bumps the pinned schema version.Ported PRs
#1290 —
:session-idon hook input maps. Hook handlers now receive a:session-idkey; wire-provided sessionId (from sub-agent hooks) is preserved.#1306 —
:cloudsession config option.create-session/resume-sessionaccept{:cloud {:repository {:owner _ :repository _}}}.#1308 — Optional permission and tool callbacks.
:on-permission-requestis now optional on session configs;:handleris optional ondefine-tool. Manual resolution via new public fns:handle-pending-tool-call!/<handle-pending-tool-call!handle-pending-permission-request!/<handle-pending-permission-request!Behavioural change: previously the SDK threw when
:on-permission-requestwas missing.#1309 —
:agent-modelon custom-agent configs (committed earlier on this branch).Schema
.copilot-schema-version:1.0.48→1.0.49-1(upstream PRs #1305, #1307). Generated wire specs and coercions regenerated. New pass-through event fields::display-prompt,:reasoning-summary,:previous-reasoning-summary.Validation
bb test— 265 tests / 1235 assertions, 0 failures, 0 errorsbb validate-docs— 13 files, 0 warningsbb jar— JAR builds cleanly./run-all-examples.sh— all examples passbb ci:full— pre-existing flaky E2E (test-e2e-blob-attachment) times out waiting for the image-prompt model response; unrelated to these changes.Notes
:display-prompt,:reasoning-summary,:previous-reasoning-summary) pass through the open generated wire specs. Adding idiom specs deferred to a future PR per design rule "let new fields pass through unless they're in the public idiom layer".:session-id, avoid::repositoryspec name collision vias/and, gate v3 broadcast handlers behindhandler-registered?, skip nil entries in the tool-handlers map, takesession(not client+session-id) for the new pending-RPC functions.