From 2007e2a38622ba0179de8b5b53749b8b10ff0b33 Mon Sep 17 00:00:00 2001 From: GitHub Copilot Date: Wed, 11 Mar 2026 14:04:24 +0000 Subject: [PATCH] Port upstream PR #787: ignore cli-path when cli-url is set When :cli-url is provided, :cli-path is now silently ignored instead of throwing a mutual exclusion error. This matches the upstream Node.js SDK behavior introduced in PR #787. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- CHANGELOG.md | 3 +++ doc/reference/API.md | 2 +- src/github/copilot_sdk/client.clj | 4 +--- test/github/copilot_sdk_test.clj | 7 ++++--- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f1e5a68a..07bb706f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,9 @@ All notable changes to this project will be documented in this file. This change ## [Unreleased] +### Changed (v0.1.32 sync) +- `:cli-path` is now silently ignored when `:cli-url` is provided, instead of throwing an error. Providing both is no longer an error — the remote CLI URL takes precedence and the local path is unused (upstream PR #787). + ## [0.1.32.0] - 2026-03-10 ### Added (v0.1.32 sync) - `:agent` optional string parameter in `create-session` and `resume-session` configs — pre-selects a custom agent by name when the session starts. Must match a name in `:custom-agents`. Equivalent to calling `agent.select` after creation (upstream PR #722). diff --git a/doc/reference/API.md b/doc/reference/API.md index 033f30b6..47fe4a04 100644 --- a/doc/reference/API.md +++ b/doc/reference/API.md @@ -104,7 +104,7 @@ Explicitly shutdown the shared client. Safe to call multiple times. | Key | Type | Default | Description | |-----|------|---------|-------------| -| `:cli-path` | string | `"copilot"` | Path to CLI executable | +| `:cli-path` | string | `"copilot"` | Path to CLI executable. Ignored when `:cli-url` is provided | | `:cli-args` | vector | `[]` | Extra arguments prepended before SDK-managed flags | | `:cli-url` | string | nil | URL of existing CLI server (e.g., `"localhost:8080"`). When provided, no CLI process is spawned | | `:port` | number | `0` | Server port (0 = random) | diff --git a/src/github/copilot_sdk/client.clj b/src/github/copilot_sdk/client.clj index ddac7480..c41f9cc8 100644 --- a/src/github/copilot_sdk/client.clj +++ b/src/github/copilot_sdk/client.clj @@ -105,7 +105,7 @@ "Create a new CopilotClient. Options: - - :cli-path - Path to CLI executable (default: \"copilot\") + - :cli-path - Path to CLI executable (default: \"copilot\"). Ignored when :cli-url is provided - :cli-args - Extra arguments for CLI - :cli-url - URL of existing server (e.g., \"localhost:8080\") - :cwd - Working directory for CLI process @@ -127,8 +127,6 @@ ([opts] (when (and (:cli-url opts) (= true (:use-stdio? opts))) (throw (ex-info "cli-url is mutually exclusive with use-stdio?" opts))) - (when (and (:cli-url opts) (:cli-path opts)) - (throw (ex-info "cli-url is mutually exclusive with cli-path" opts))) ;; Validation: github-token and use-logged-in-user? cannot be used with cli-url (when (and (:cli-url opts) (or (:github-token opts) (some? (:use-logged-in-user? opts)))) (throw (ex-info "github-token and use-logged-in-user? cannot be used with cli-url (external server manages its own auth)" diff --git a/test/github/copilot_sdk_test.clj b/test/github/copilot_sdk_test.clj index 9c9f07ce..ffd4377d 100644 --- a/test/github/copilot_sdk_test.clj +++ b/test/github/copilot_sdk_test.clj @@ -66,9 +66,10 @@ (is (thrown? Exception (copilot/client {:cli-url "localhost:8080" :use-stdio? true})))) - (testing "cli-url mutual exclusion with cli-path" - (is (thrown? Exception - (copilot/client {:cli-url "localhost:8080" :cli-path "/path/to/cli"})))) + (testing "cli-url with cli-path: cli-path is silently ignored" + (let [c (copilot/client {:cli-url "localhost:8080" :cli-path "/path/to/cli" :auto-start? false})] + (is (some? c)) + (is (true? (:external-server? c))))) (testing "is-child-process? mutual exclusion with cli-url" (is (thrown-with-msg? Exception #"is-child-process\? is mutually exclusive with cli-url"