Skip to content

[upstream-sync] Port upstream PRs #544, #554, #555: agent selection, compaction, required permission handler, custom-tool#31

Draft
github-actions[bot] wants to merge 1 commit intomainfrom
upstream-sync/2026-02-25-4761ff525a24e34e
Draft

[upstream-sync] Port upstream PRs #544, #554, #555: agent selection, compaction, required permission handler, custom-tool#31
github-actions[bot] wants to merge 1 commit intomainfrom
upstream-sync/2026-02-25-4761ff525a24e34e

Conversation

@github-actions
Copy link
Contributor

Summary

This PR ports three upstream github/copilot-sdk changes merged since the last sync (2026-02-24).


Upstream Changes Ported

PR #554 — Require onPermissionRequest on session creation (BREAKING)

Upstream change: onPermissionRequest moved from optional to required in SessionConfig and ResumeSessionConfig. createSession/resumeSession throw if the handler is not provided.

Clojure port:

  • :on-permission-request moved to :req-un in both ::session-config and ::resume-session-config specs
  • validate-session-config! now throws with a helpful message before spec checking
  • resume-session also throws explicitly with the same pattern
  • Removed 0-arity overloads of create-session, <create-session, resume-session, <resume-session
  • Updated all integration tests and e2e tests to include :on-permission-request sdk/approve-all
  • Replaced test-permission-denied-without-handler with test-permission-required-on-create (tests that session creation throws when handler is missing)

PR #544 — Agent selection and session compaction APIs

Upstream change: New RPC methods: session.agent.list, session.agent.getCurrent, session.agent.select, session.agent.deselect, session.compaction.compact. New event type session.task_complete.

Clojure port:

  • New functions in session.clj: list-agents, current-agent, select-agent!, deselect-agent!, compact!
  • :copilot/session.task_complete added to ::event-type spec and event-types/session-events sets in main namespace
  • Wire format uses camelCase (sessionId, name) matching upstream
  • fdefs added in instrument.clj for all 5 new functions

PR #555 — custom-tool permission kind

Upstream change: Adds "custom-tool" to PermissionRequest.kind union type for SDK-registered custom tools.

Clojure port:

  • :custom-tool added to ::permission-kind spec
  • test-approve-all-returns-approved updated to include :custom-tool

Skipped

  • PR #556 (docs: fix inaccuracies in skills.md) — documentation only, no code changes needed

Testing

Documentation validation passes (bb --config /dev/null script/validate_docs.clj).

Unit/integration tests could not be run due to network restrictions in the sandbox environment (Maven Central unreachable). All test changes are logically correct — the new test assertions match the new API contracts.


Files Changed

  • src/github/copilot_sdk/specs.clj::permission-kind + :custom-tool, ::session-config/::resume-session-config req-un, ::event-type + session.task_complete
  • src/github/copilot_sdk/client.clj — Required permission handler validation, removed 0-arity overloads, updated docstrings
  • src/github/copilot_sdk/session.clj — New: list-agents, current-agent, select-agent!, deselect-agent!, compact!
  • src/github/copilot_sdk.cljsession.task_complete in event sets
  • src/github/copilot_sdk/instrument.clj — fdefs for new session functions; session creation fdefs require config
  • test/github/copilot_sdk/integration_test.clj — All session calls updated; broken test replaced; :custom-tool added
  • test/github/copilot_sdk/e2e_test.clj — All session calls updated
  • doc/reference/API.md:on-permission-request marked required; agent/compaction functions documented; session.task_complete in event table
  • CHANGELOG.md — Entries added under [Unreleased]

Generated by Upstream Sync Agent

  • expires on Mar 4, 2026, 2:24 PM UTC

…ired permission handler, custom-tool kind

- PR #554: Make :on-permission-request required in create-session and resume-session.
  Adds explicit validation with helpful error message. Removes 0-arity overloads.
  event type.
- PR #555: Add :custom-tool to permission-kind spec.
- Update integration tests: replace test-permission-denied-without-handler with
  test-permission-required-on-create (tests the new throwing behavior); add
  :on-permission-request to all remaining test calls; add :custom-tool to
  test-approve-all-returns-approved doseq.
- Update e2e tests: add :on-permission-request sdk/approve-all to all session
  creation calls.
- Update instrument.clj: add fdefs for 5 new session functions; update session
  creation fdefs to require config (no more optional).
- Update docs: mark :on-permission-request as Required; add agent/compaction
  function docs; add session.task_complete to event type table.
- Update CHANGELOG.md: document all 3 ported PRs.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants