Skip to content

Upstream sync: post-v1.0.0-beta.4 (#1290, #1306, #1308, #1309) + schema 1.0.49-1#107

Merged
krukow merged 11 commits into
mainfrom
upstream-sync/post-beta.4
May 19, 2026
Merged

Upstream sync: post-v1.0.0-beta.4 (#1290, #1306, #1308, #1309) + schema 1.0.49-1#107
krukow merged 11 commits into
mainfrom
upstream-sync/post-beta.4

Conversation

@krukow
Copy link
Copy Markdown
Collaborator

@krukow krukow commented May 19, 2026

Summary

Ports four upstream github/copilot-sdk changes merged after v1.0.0-beta.4 and bumps the pinned schema version.

Ported PRs

  • #1290:session-id on hook input maps. Hook handlers now receive a :session-id key; wire-provided sessionId (from sub-agent hooks) is preserved.

  • #1306:cloud session config option. create-session / resume-session accept {:cloud {:repository {:owner _ :repository _}}}.

  • #1308 — Optional permission and tool callbacks. :on-permission-request is now optional on session configs; :handler is optional on define-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-request was missing.

  • #1309:agent-model on custom-agent configs (committed earlier on this branch).

Schema

.copilot-schema-version: 1.0.481.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 errors
  • bb validate-docs — 13 files, 0 warnings
  • bb jar — JAR builds cleanly
  • ./run-all-examples.sh — all examples pass
  • ⚠️ bb ci:full — pre-existing flaky E2E (test-e2e-blob-attachment) times out waiting for the image-prompt model response; unrelated to these changes.

Notes

  • New event-data fields from 1.0.49 (: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".
  • Rubber-duck consulted at planning time; key feedback adopted: preserve wire-provided sub-agent :session-id, avoid ::repository spec name collision via s/and, gate v3 broadcast handlers behind handler-registered?, skip nil entries in the tool-handlers map, take session (not client+session-id) for the new pending-RPC functions.

krukow and others added 3 commits May 18, 2026 08:23
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>
Copilot AI review requested due to automatic review settings May 19, 2026 08:15
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 :cloud session config forwarding + validation, and tests ensuring correct wire serialization.
  • Make :on-permission-request (session config) and tool :handler optional; add public APIs to manually resolve pending permission/tool RPCs.
  • Regenerate schemas/specs for 1.0.49-1 and 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

Comment thread doc/reference/API.md Outdated
Comment thread doc/reference/API.md Outdated
Comment thread CHANGELOG.md Outdated
Comment thread src/github/copilot_sdk/session.clj
Comment thread src/github/copilot_sdk/session.clj
@krukow krukow marked this pull request as ready for review May 19, 2026 08:57
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>
@krukow
Copy link
Copy Markdown
Collaborator Author

krukow commented May 19, 2026

Generated via Copilot on behalf of @krukow

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 9c4331d.

# Finding Source Severity Decision
1 :cloud accepted on resume-session / join-session diverges from upstream — ResumeSessionConfig is a Pick<SessionConfig, ...> that explicitly excludes cloud (creation-only) Opus 4.7 MEDIUM Fixed. Dropped :cloud from resume-session-config-keys, ::resume-session-config, ::join-session-config, and build-resume-session-params. CHANGELOG and API.md updated to mark cloud as create-only.
2 define-tool-from-spec still installed a :tool-handler wrapper when :handler was omitted — declaration-only tools created via this fn would auto-resolve to nil instead of remaining pending for handle-pending-tool-call! GPT-5.5 MEDIUM Fixed. Mirrored define-tool: only attach :tool-handler when handler is provided. Added a test for declaration-only define-tool-from-spec tools.

All 265 tests / 1238 assertions still pass. bb validate-docs ✓.

Out of scope (noted, not blocking)

  • Pre-existing flaky test-e2e-blob-attachment E2E (30s timeout on image prompt) — unrelated to this sync.
  • Idiom specs for new 1.0.49 event fields (:display-prompt, :reasoning-summary, :previous-reasoning-summary) — intentionally deferred per design rule "let new fields pass through unless they're in the public idiom layer".

- 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>
Copilot AI review requested due to automatic review settings May 19, 2026 11:58
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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: 11/14 changed files
  • Comments generated: 3

Comment thread src/github/copilot_sdk/specs.clj Outdated
Comment thread src/github/copilot_sdk/session.clj Outdated
Comment thread src/github/copilot_sdk/session.clj Outdated
- 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>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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: 11/14 changed files
  • Comments generated: 2

Comment thread src/github/copilot_sdk/session.clj
Comment thread src/github/copilot_sdk/session.clj Outdated
- :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>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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: 11/14 changed files
  • Comments generated: 3

Comment thread src/github/copilot_sdk/client.clj
Comment thread src/github/copilot_sdk/tools.clj
Comment thread src/github/copilot_sdk/tools.clj
…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>
@krukow krukow requested a review from Copilot May 19, 2026 12:44
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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: 11/14 changed files
  • Comments generated: 4

Comment thread src/github/copilot_sdk/tools.clj Outdated
Comment thread src/github/copilot_sdk/tools.clj Outdated
Comment thread src/github/copilot_sdk/client.clj Outdated
Comment thread src/github/copilot_sdk/client.clj Outdated
…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>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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: 11/14 changed files
  • Comments generated: 3

Comment thread src/github/copilot_sdk/session.clj Outdated
Comment thread src/github/copilot_sdk/session.clj Outdated
Comment thread test/github/copilot_sdk/integration_test.clj
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>
@krukow krukow requested a review from Copilot May 19, 2026 13:07
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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: 11/14 changed files
  • Comments generated: 0 new

@krukow
Copy link
Copy Markdown
Collaborator Author

krukow commented May 19, 2026

✅ Copilot Code Review iteration complete

Clean review from Copilot — 0 comments generated on commit f8986ac. Closing the /pr auto loop after 6 rounds.

Round-by-round summary

Round Commit Issues Type
1 2ae8851 5 doc key-name + non-string :error guards
2 5986c75 3 non-blank ::name in cloud-repo + :result/:error required
3 00d3a43 2 non-blank :request-id + validated :kind
4 ae2235d 3 docstrings for handler-optional + on-permission-request-optional
5 24d5ad5 4 copilot/ namespace alias + double-backticks for <-prefixed names
6 f8986ac 3 added :user-not-available to PermissionDecision set + tests
7 0 ✅ clean

All 17 in-thread replies posted on the original review comments. All 265 tests / 1253 assertions passing; bb validate-docs ✓.

PR is ready for human review.

Generated via Copilot on behalf of @krukow

@krukow krukow merged commit b58d11c into main May 19, 2026
2 checks passed
@krukow krukow deleted the upstream-sync/post-beta.4 branch May 19, 2026 13:26
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