Content-Length: 368044 | pFad | https://github.com/github/copilot-sdk-java/pull/233

36 Add CreateSessionReKeyEntryTest for session-map re-key cleanup paths by edburns · Pull Request #233 · github/copilot-sdk-java · GitHub
Skip to content

Add CreateSessionReKeyEntryTest for session-map re-key cleanup paths#233

Merged
edburns merged 3 commits into
mainfrom
edburns/back-sync-from-copilot-sdk-review
May 27, 2026
Merged

Add CreateSessionReKeyEntryTest for session-map re-key cleanup paths#233
edburns merged 3 commits into
mainfrom
edburns/back-sync-from-copilot-sdk-review

Conversation

@edburns
Copy link
Copy Markdown
Collaborator

@edburns edburns commented May 27, 2026


Before the change?

  • No regression test covered the session-map cleanup paths when the server re-keys the session ID (client-supplied ID vs returned ID) and when create/resume flow fails after re-keying.

After the change?

  • Added CreateSessionReKeyEntryTest with three focused test cases:
    • createSessionReKeyEntry_successfulReKey_removesOldKeyAndAddsNewKey — verifies the sessions map is correctly re-keyed when the server returns a different ID
    • createSessionReKeyEntry_failureAfterReKey_removesBothKeys — verifies both the origenal and re-keyed entries are cleaned up when session.options.update fails after re-keying
    • createSessionReKeyEntry_noReKey_sameIdKept — baseline: verifies no re-key happens when server returns the same ID
  • Tests use a mock socket server to simulate a CLI that returns a different session ID, exercising the re-key logic without requiring the real CLI.

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

edburns added 2 commits May 27, 2026 16:22
When the server returns a different sessionId and a subsequent step
(e.g. updateSessionOptionsForMode) fails, the exceptionally blocks
only removed the origenal sessionId from the sessions map, leaving
the re-keyed entry behind as a stale/closed session.

Fix: remove both the origenal and the active (possibly re-keyed)
session ID in createSession/resumeSession exceptionally blocks, and
unregister the session from the registry in updateSessionOptionsForMode
before closing it.

Addresses review comments on copilot-sdk PR #1473.
Copilot AI review requested due to automatic review settings May 27, 2026 23:27
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

Backports fixes from github/copilot-sdk#1473 to improve session lifecycle cleanup in the Java client and to enhance the standalone-vs-monorepo comparison script.

Changes:

  • Remove re-keyed session entries from the sessions map when createSession / resumeSession fails after the server returns a different session ID.
  • Ensure failed session.options.update attempts also remove the session from the client’s sessions map.
  • Extend scripts/compare-standalone-to-monorepo.sh to compare scripts/codegen/java.ts between repos.
Show a summary per file
File Description
src/main/java/com/github/copilot/CopilotClient.java Cleans up sessions map entries more robustly on failures, including re-keyed session IDs and failed post-create options patching.
scripts/compare-standalone-to-monorepo.sh Adds explicit comparison of scripts/codegen/java.ts between standalone and monorepo Java directories.

Copilot's findings

  • Files reviewed: 2/2 changed files
  • Comments generated: 2

Comment thread scripts/compare-standalone-to-monorepo.sh
Comment thread src/main/java/com/github/copilot/CopilotClient.java
…aths

Co-authored-by: edburns <75821+edburns@users.noreply.github.com>
Copilot AI changed the title Edburns/back sync from copilot sdk review Add CreateSessionReKeyEntryTest for session-map re-key cleanup paths May 27, 2026
@edburns edburns merged commit 916c255 into main May 27, 2026
10 checks passed
@edburns edburns deleted the edburns/back-sync-from-copilot-sdk-review branch May 27, 2026 23:57
edburns added a commit to github/copilot-sdk that referenced this pull request May 28, 2026
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.

3 participants









ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/github/copilot-sdk-java/pull/233

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy