[upstream-sync] Port disconnect! from upstream PR #599#42
Closed
github-actions[bot] wants to merge 1 commit intomainfrom
Closed
[upstream-sync] Port disconnect! from upstream PR #599#42github-actions[bot] wants to merge 1 commit intomainfrom
github-actions[bot] wants to merge 1 commit intomainfrom
Conversation
…stroy! Port upstream PR #599: add disconnect() as the preferred method for closing sessions across all SDKs, with destroy() deprecated to delegate to disconnect(). Changes: - Add session/disconnect! with same semantics as destroy! (sends session.destroy RPC, clears handlers, closes event channel) - Deprecate session/destroy! to delegate to disconnect! - Add disconnect! to github.copilot-sdk top-level namespace - Update with-session and with-client-session macros to use disconnect! - Update client stop! to call session/disconnect! internally - Add disconnect! to both instrument-all! and unstrument-all! lists - Document disconnect! in API reference, mark destroy! as deprecated 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
Ports upstream PR #599: adds
disconnect!as the preferred method for closing sessions, deprecatingdestroy!.Upstream Changes
The upstream Node.js SDK added
disconnect()as the new preferred way to close a session, withdestroy()deprecated to delegate todisconnect(). The wire protocol remains unchanged — both methods still sendsession.destroyon the wire.Changes
session/disconnect!— new preferred function for closing a session. Same semantics asdestroy!: sendssession.destroyRPC, clears all handlers, closes the event channel. Session disk state is preserved for resumption.session/destroy!— deprecated; now delegates todisconnect!. Kept for backward compatibility.github.copilot-sdk/disconnect!— re-exported at top-level namespace.github.copilot-sdk/destroy!— re-exported, now delegates todisconnect!, deprecated in docstring.with-sessionandwith-client-sessionmacros — updated to calldisconnect!in theirfinallycleanup forms.client/stop!— internally callssession/disconnect!instead ofsession/destroy!.instrument.clj— addeddisconnect!fdef (same spec asdestroy!); added to bothinstrument-all!andunstrument-all!lists.doc/reference/API.md— addeddisconnect!section, markeddestroy!as deprecated.CHANGELOG.md— updated[Unreleased]section.Upstream PRs Skipped
All other upstream commits since last sync (2026-03-05):
get_last_session_idalready portedTesting
bb validate-docs— passed (0 warnings)bb testcould not run; changes are straightforward refactoring with no behavioral change to existing callers (destroy! still works, just delegates)