Skip to content

Commit 496ed7d

Browse files
Allow tcpConnectionToken when cliUrl is set (Node + Go)
CliUrl/CLIUrl always implies TCP mode (it overrides useStdio/UseStdio internally), so rejecting the token when useStdio: true is set should only fire when no cliUrl is provided. Brings Node and Go in line with the .NET behavior. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 203f7b6 commit 496ed7d

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

go/client.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,9 @@ func NewClient(options *ClientOptions) *Client {
171171
panic("GitHubToken and UseLoggedInUser cannot be used with CLIUrl (external server manages its own auth)")
172172
}
173173

174-
// Validate token vs stdio
175-
if options.TCPConnectionToken != "" && options.UseStdio != nil && *options.UseStdio {
174+
// Validate token vs stdio. CLIUrl always implies TCP mode (it overrides UseStdio
175+
// below), so only reject the token when stdio is actually going to be used.
176+
if options.TCPConnectionToken != "" && options.UseStdio != nil && *options.UseStdio && options.CLIUrl == "" {
176177
panic("TCPConnectionToken cannot be used with UseStdio: true")
177178
}
178179

nodejs/src/client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ export class CopilotClient {
331331
) {
332332
throw new Error("tcpConnectionToken must be a non-empty string");
333333
}
334-
if (options.useStdio === true) {
334+
if (options.useStdio === true && !options.cliUrl) {
335335
throw new Error("tcpConnectionToken cannot be used with useStdio: true");
336336
}
337337
}

0 commit comments

Comments
 (0)