Skip to content

[upstream-sync] Port 28 upstream commits from github/copilot-sdk (f0909a7→b9f746a)#157

Merged
brunoborges merged 7 commits intomainfrom
copilot/sync-upstream-28-commits
Mar 3, 2026
Merged

[upstream-sync] Port 28 upstream commits from github/copilot-sdk (f0909a7→b9f746a)#157
brunoborges merged 7 commits intomainfrom
copilot/sync-upstream-28-commits

Conversation

Copy link
Contributor

Copilot AI commented Mar 2, 2026

  • Port 279f6c4: Require permission handler on createSession/resumeSession; no-arg overloads removed
  • Update all existing E2E tests to use PermissionHandler.APPROVE_ALL
  • Port 279f6c4: Rename/update permission tests
  • Port 9d998fb: Add agent selection APIs (listAgents, getCurrentAgent, selectAgent, deselectAgent) and compact()
  • Add AgentInfo JSON type
  • Add new event types: SessionTaskCompleteEvent, AssistantStreamingDeltaEvent, SubagentDeselectedEvent
  • Update AbstractSessionEvent and SessionEventParser for new types
  • Update event data classes with new fields (interactionId, model, copilotUsage, pluginName/pluginVersion)
  • Port 388f2f3: Add E2E tests for custom tool permission flows
  • Fix ToolsTest.testInvokesCustomToolWithPermissionHandler: use PermissionHandler.APPROVE_ALL.handle() instead of hard-coded "approved" kind; fix Javadoc
  • Fix CopilotClient.java: update @see Javadoc references from removed resumeSession(String) to resumeSession(String, ResumeSessionConfig)
  • Add SessionEventParserTest coverage for all new/updated event fields: AssistantStreamingDeltaEvent, interactionId on AssistantMessageEvent/AssistantTurnStartEvent/ToolExecutionCompleteEvent, copilotUsage on AssistantUsageEvent, model on ToolExecutionCompleteEvent
  • Update CHANGELOG.md and documentation
  • Update .lastmerge to b9f746ab1b9c5f31af03a6f8a6cf4e680b3fd6b8
  • Code review: 0 comments; CodeQL: 0 alerts; Spotless: clean
Original prompt

This section details on the original issue you should resolve

<issue_title>[upstream-sync] Upstream sync: 28 new commits (2026-03-02)</issue_title>
<issue_description>There are 28 new commits in the upstream github/copilot-sdk repository that need to be ported to this Java SDK.

Commit Range

Recent Upstream Commits (20 of 28)

b9f746a fix(python): correct PermissionHandler.approve_all type annotations (#618)
bb02de1 [C#] Use event delegate for thread-safe, insertion-ordered event handler dispatch (#624)
7cc50b6 fix Justfile doesn't install everything necessary to run the test suite (#611)
5718e12 [Python] Remove `--locked` flag from `uv sync` in copilot-setup-steps.yml (#628)
6415c40 [C#] Remove unnecessary SemaphoreSlim locks for handler fields (#625)
cb94df9 [C#] Deduplicate OnDisposeCall and improve implementation (#626)
47cb899 Update `@github/copilot` to 0.0.420 (#605)
58455ec Add workflow to update `@github/copilot` dependency (#604)
117eaf8 Have `CopilotClient.stop()` raise an exception group instead of returning a list of exceptions (#603)
d87af41 Restore package discovery for platform wheel builds (#601)
9d942d4 feat(docs-validation): add hidden block directive and convert samples (#600)
fc63890 docs: fix OpenTelemetry guide to use correct SDK APIs (#597)
942a253 docs: Add OpenTelemetry instrumentation guide for Copilot SDK (#529)
23a9134 fix(python): use 'is not None' check for excluded_tools in session methods (#596)
8e61e9b More e2e nodejs tests (#466)
0e46b36 chore(deps): bump minimatch (#594)
4612a15 chore(deps-dev): bump hono (#595)
9170468 chore(deps-dev): bump minimatch (#593)
35534c4 chore(python): Bump the oldest supported Python version to 3.11 (#561)
5a4f823 Fix Go client data races (#586)

Highlights

Notable C# changes that may require Java porting:

  • bb02de1[C#] Use event delegate for thread-safe, insertion-ordered event handler dispatch — may need Java equivalent
  • 6415c40[C#] Remove unnecessary SemaphoreSlim locks for handler fields — review corresponding Java synchronization
  • cb94df9[C#] Deduplicate OnDisposeCall and improve implementation — review Java close() disposal
  • 388f2f3Add permission checks for SDK-registered custom tools — new feature to port
  • 9d998fbAdd SDK support for agent selection and session compaction APIs — new feature to port
  • 279f6c4Require permission handler on session creation — API change to port

Instructions

Please follow the agentic-merge-upstream prompt to port the relevant changes from the upstream C# SDK into this Java SDK.

After completing the merge:

  1. Update the .lastmerge file with the new upstream HEAD: b9f746ab1b9c5f31af03a6f8a6cf4e680b3fd6b8
  2. Create a Pull Request with the label upstream-sync
  3. Close this issue referencing the PR

Generated by Weekly Upstream Sync Agentic Workflow

  • expires on Mar 8, 2026, 10:37 PM UTC

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@brunoborges brunoborges added the upstream-sync Upstream merge from github/copilot-sdk label Mar 2, 2026
…paction APIs

Co-authored-by: brunoborges <129743+brunoborges@users.noreply.github.com>
Copilot AI changed the title [WIP] Sync 28 new commits from upstream repository [upstream-sync] Port 28 upstream commits from github/copilot-sdk (f0909a7→b9f746a) Mar 2, 2026
@brunoborges
Copy link
Member

@edburns can you please review?

Copilot AI and others added 2 commits March 3, 2026 15:19
Co-authored-by: brunoborges <129743+brunoborges@users.noreply.github.com>
brunoborges and others added 2 commits March 3, 2026 10:30
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…-actions-workflow

Fix CompactionTest timeout caused by prompt mismatch with snapshot
Copy link
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 28 upstream commits from github/copilot-sdk into the Java SDK, including a breaking permission-handler requirement, new session APIs (agent selection + compaction), and expanded event surface area.

Changes:

  • Breaking: require onPermissionRequest for createSession(SessionConfig) and resumeSession(String, ResumeSessionConfig); remove no-arg overloads and update E2E tests accordingly.
  • Add agent selection + session compaction APIs (listAgents/getCurrentAgent/selectAgent/deselectAgent/compact) and new AgentInfo JSON type.
  • Add new event types and extend existing event payloads (e.g., interactionId, copilotUsage, streaming delta metrics), plus update docs/changelog.

Reviewed changes

Copilot reviewed 31 out of 31 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/test/java/com/github/copilot/sdk/ToolsTest.java Updates sessions to provide permission handler; adds E2E tests for custom-tool permission approval/denial flow.
src/test/java/com/github/copilot/sdk/SkillsTest.java Adds PermissionHandler.APPROVE_ALL to skill E2E tests to satisfy new session contract.
src/test/java/com/github/copilot/sdk/SessionEventsE2ETest.java Updates E2E session creation to include required permission handler.
src/test/java/com/github/copilot/sdk/SessionEventParserTest.java Adjusts parser assertions for AssistantMessageDeltaEvent after field move.
src/test/java/com/github/copilot/sdk/SessionEventHandlingTest.java Updates test helper construction for new AssistantMessageEvent data shape.
src/test/java/com/github/copilot/sdk/PermissionsTest.java Renames tests/snapshots to match new permission-handler contract and explicit-deny behavior.
src/test/java/com/github/copilot/sdk/McpAndAgentsTest.java Updates MCP/custom-agent E2E tests to pass required permission handler on create/resume.
src/test/java/com/github/copilot/sdk/ErrorHandlingTest.java Ensures tool error-handling E2E tests set a permission handler.
src/test/java/com/github/copilot/sdk/E2ETestContext.java Updates Javadoc example to show required permission handler usage.
src/test/java/com/github/copilot/sdk/CopilotSessionTest.java Updates many E2E session create/resume sites to provide permission handler; adjusts resume calls to new overload.
src/test/java/com/github/copilot/sdk/CopilotClientTest.java Updates client tests to create sessions with required permission handler.
src/test/java/com/github/copilot/sdk/CompactionTest.java Ensures compaction tests create sessions with a permission handler; adjusts prompt text.
src/test/java/com/github/copilot/sdk/ClosedSessionGuardTest.java Updates session creation to provide required permission handler.
src/test/java/com/github/copilot/sdk/AskUserTest.java Adds permission handler to ask-user tool tests to satisfy session creation contract.
src/site/markdown/documentation.md Documents additional event types (session.task_complete, assistant.streaming_delta, subagent.deselected).
src/main/java/com/github/copilot/sdk/json/AgentInfo.java Adds new JSON DTO for custom agent metadata.
src/main/java/com/github/copilot/sdk/events/ToolExecutionCompleteEvent.java Adds model and interactionId to tool execution completion payload.
src/main/java/com/github/copilot/sdk/events/SubagentDeselectedEvent.java Adds new subagent.deselected event type.
src/main/java/com/github/copilot/sdk/events/SkillInvokedEvent.java Adds pluginName and pluginVersion to skill invocation payload.
src/main/java/com/github/copilot/sdk/events/SessionTaskCompleteEvent.java Adds new session.task_complete event type with summary.
src/main/java/com/github/copilot/sdk/events/SessionEventParser.java Registers new event type mappings for parser dispatch.
src/main/java/com/github/copilot/sdk/events/AssistantUsageEvent.java Adds copilotUsage (token details + nano-AIU totals) to usage payload.
src/main/java/com/github/copilot/sdk/events/AssistantTurnStartEvent.java Adds interactionId to assistant turn start payload.
src/main/java/com/github/copilot/sdk/events/AssistantStreamingDeltaEvent.java Adds new streaming progress event carrying totalResponseSizeBytes.
src/main/java/com/github/copilot/sdk/events/AssistantMessageEvent.java Adds interactionId to assistant message payload.
src/main/java/com/github/copilot/sdk/events/AssistantMessageDeltaEvent.java Removes totalResponseSizeBytes from message delta payload.
src/main/java/com/github/copilot/sdk/events/AbstractSessionEvent.java Extends sealed permits list to include newly added event types.
src/main/java/com/github/copilot/sdk/CopilotSession.java Adds agent selection APIs and compact(); adds internal response DTOs for agent RPCs.
src/main/java/com/github/copilot/sdk/CopilotClient.java Enforces required permission handler for create/resume; removes no-arg overloads; updates Javadoc/examples.
CHANGELOG.md Updates Unreleased notes for upstream sync b9f746a and documents breaking + new APIs/events.
.lastmerge Bumps tracked upstream commit to b9f746ab1b9c5f31af03a6f8a6cf4e680b3fd6b8.

…see refs

Co-authored-by: brunoborges <129743+brunoborges@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 3, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • checkstyle.org
    • Triggering command: /opt/hostedtoolcache/CodeQL/2.24.2/x64/codeql/tools/linux64/java/bin/java /opt/hostedtoolcache/CodeQL/2.24.2/x64/codeql/tools/linux64/java/bin/java -jar /opt/hostedtoolcache/CodeQL/2.24.2/x64/codeql/xml/tools/xml-extractor.jar --fileList=/tmp/codeql-scratch-a0b8ba07f7cabbfc/dbs/java/working/files-to-index9945316311741484777.list --sourceArchiveDir=/tmp/codeql-scratch-a0b8ba07f7cabbfc/dbs/java/src --outputDir=/tmp/codeql-scratch-a0b8ba07f7cabbfc/dbs/java/trap/java (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@brunoborges brunoborges marked this pull request as ready for review March 3, 2026 16:24
@brunoborges brunoborges requested a review from edburns March 3, 2026 16:24
@brunoborges brunoborges merged commit a781790 into main Mar 3, 2026
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

upstream-sync Upstream merge from github/copilot-sdk

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[upstream-sync] Upstream sync: 28 new commits (2026-03-02)

4 participants