Skip to content

Port ExitPlanMode and AutoModeSwitch mode handler APIs from reference implementation#178

Draft
Copilot wants to merge 6 commits intomainfrom
copilot/reference-impl-sync-new-commits-again
Draft

Port ExitPlanMode and AutoModeSwitch mode handler APIs from reference implementation#178
Copilot wants to merge 6 commits intomainfrom
copilot/reference-impl-sync-new-commits-again

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 8, 2026

Resolves #88


Before the change?

  • The Java SDK lacked ExitPlanMode and AutoModeSwitch handler APIs that were restored across other SDKs in reference impl commit 671b50a.
  • .lastmerge pointed to 066a69c1, 6 commits behind reference implementation HEAD.

After the change?

  • Mode handler types — 8 new files: ExitPlanModeRequest, ExitPlanModeResult, ExitPlanModeInvocation, ExitPlanModeHandler, AutoModeSwitchRequest, AutoModeSwitchResponse (enum: YES/YES_ALWAYS/NO), AutoModeSwitchInvocation, AutoModeSwitchHandler.
  • Session wiringSessionConfig/ResumeSessionConfig gain onExitPlanMode/onAutoModeSwitch fields. SessionRequestBuilder wires handlers to CopilotSession and sets requestExitPlanMode/requestAutoModeSwitch capability flags on Create/ResumeSessionRequest.
  • RPC dispatchRpcHandlerDispatcher registers exitPlanMode.request and autoModeSwitch.request methods. Default behavior: approve exit (no handler) / decline mode switch (no handler).
  • Tests — 11 unit tests (clone, request flags, enum serialization), 2 E2E tests (@Disabled pending snapshot availability after .lastmerge update).
  • Docs — Mode Handlers section added to advanced.md.
  • Sync housekeeping.lastmergece56eb81, copilot version → ^1.0.44-2.

Usage:

var config = new SessionConfig();
config.setOnExitPlanMode((request, invocation) -> {
    var result = new ExitPlanModeResult();
    result.setApproved(true);
    return CompletableFuture.completedFuture(result);
});
config.setOnAutoModeSwitch((request, invocation) -> {
    return CompletableFuture.completedFuture(AutoModeSwitchResponse.YES);
});

Commits not ported (not applicable to Java SDK): ce56eb8 (typo not present), 299ea21/97f505c (CI-only), b0d1c8e (Rust-only), e759700 (.NET generated code).

Pull request checklist

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)
  • mvn spotless:apply has been run to format the code
  • mvn clean verify passes locally

Does this introduce a breaking change?

  • Yes
  • No

Copilot AI and others added 5 commits May 8, 2026 23:21
…ementation

Co-authored-by: edburns <75821+edburns@users.noreply.github.com>
Co-authored-by: edburns <75821+edburns@users.noreply.github.com>
Co-authored-by: edburns <75821+edburns@users.noreply.github.com>
…shots

Co-authored-by: edburns <75821+edburns@users.noreply.github.com>
…om.xml CLI version, and update scripts/codegen @github/copilot version

Co-authored-by: edburns <75821+edburns@users.noreply.github.com>
Copilot AI changed the title [WIP] Sync reference implementation with 6 new commits Port ExitPlanMode and AutoModeSwitch mode handler APIs from reference implementation May 8, 2026
if (response.getFeedback() != null) {
result.put("feedback", response.getFeedback());
}
rpc.sendResponse(Long.parseLong(requestId), result);
}).exceptionally(ex -> {
LOG.log(Level.WARNING, "Exit plan mode handler exception", ex);
try {
rpc.sendResponse(Long.parseLong(requestId), Map.of("approved", true));

session.handleAutoModeSwitchRequest(request).thenAccept(response -> {
try {
rpc.sendResponse(Long.parseLong(requestId), Map.of("response", response.getValue()));
}).exceptionally(ex -> {
LOG.log(Level.WARNING, "Auto mode switch handler exception", ex);
try {
rpc.sendResponse(Long.parseLong(requestId),
Copilot finished work on behalf of edburns May 8, 2026 23:58
Copilot AI requested a review from edburns May 8, 2026 23:58
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.

[reference-impl-sync] Reference Implementation sync: 6 new commits (2026-05-08)

2 participants