[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
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR ports three upstream
github/copilot-sdkchanges merged since the last sync (2026-02-24).Upstream Changes Ported
PR #554 — Require
onPermissionRequeston session creation (BREAKING)Upstream change:
onPermissionRequestmoved from optional to required inSessionConfigandResumeSessionConfig.createSession/resumeSessionthrow if the handler is not provided.Clojure port:
:on-permission-requestmoved to:req-unin both::session-configand::resume-session-configspecsvalidate-session-config!now throws with a helpful message before spec checkingresume-sessionalso throws explicitly with the same patterncreate-session,<create-session,resume-session,<resume-session:on-permission-request sdk/approve-alltest-permission-denied-without-handlerwithtest-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 typesession.task_complete.Clojure port:
session.clj:list-agents,current-agent,select-agent!,deselect-agent!,compact!:copilot/session.task_completeadded to::event-typespec andevent-types/session-eventssets in main namespacesessionId,name) matching upstreaminstrument.cljfor all 5 new functionsPR #555 —
custom-toolpermission kindUpstream change: Adds
"custom-tool"toPermissionRequest.kindunion type for SDK-registered custom tools.Clojure port:
:custom-tooladded to::permission-kindspectest-approve-all-returns-approvedupdated to include:custom-toolSkipped
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-configreq-un,::event-type+session.task_completesrc/github/copilot_sdk/client.clj— Required permission handler validation, removed 0-arity overloads, updated docstringssrc/github/copilot_sdk/session.clj— New:list-agents,current-agent,select-agent!,deselect-agent!,compact!src/github/copilot_sdk.clj—session.task_completein event setssrc/github/copilot_sdk/instrument.clj— fdefs for new session functions; session creation fdefs require configtest/github/copilot_sdk/integration_test.clj— All session calls updated; broken test replaced;:custom-tooladdedtest/github/copilot_sdk/e2e_test.clj— All session calls updateddoc/reference/API.md—:on-permission-requestmarked required; agent/compaction functions documented;session.task_completein event tableCHANGELOG.md— Entries added under[Unreleased]