You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Go SDK: Deadlock in client.Start() when starting CLI via stdio #19
The Go SDK deadlocks when calling client.Start() on macOS. The CLI works correctly when invoked directly, but the SDK's JSON-RPC communication over stdio fails.
Environment
OS: macOS (Apple Silicon)
Go version: 1.24
SDK version: v0.0.0-20260115160841-b8a836b2c6a3 (pseudo-version from main)
package main
import (
"log"
copilot "github.com/github/copilot-sdk/go"
)
funcmain() {
client:=copilot.NewClient(&copilot.ClientOptions{
LogLevel: "error",
})
// This deadlocks - never returnsiferr:=client.Start(); err!=nil {
log.Fatal(err)
}
deferclient.Stop()
log.Println("Client started") // Never reached
}
Expected Behavior
client.Start() should either:
Successfully start the CLI and establish JSON-RPC communication
Return an error if communication fails
Actual Behavior
Program deadlocks with:
fatal error: all goroutines are asleep - deadlock!
goroutine 1 [select]:
github.com/github/copilot-sdk/go.(*JSONRPCClient).Request(...)
jsonrpc.go:147
github.com/github/copilot-sdk/go.(*Client).Ping(...)
client.go:730
github.com/github/copilot-sdk/go.(*Client).verifyProtocolVersion(...)
client.go:753
github.com/github/copilot-sdk/go.(*Client).Start(...)
client.go:239
Working CLI Test
The CLI works correctly when invoked directly:
$ copilot --log-level debug --allow-all-tools -p "hello"
Hello! I'm GitHub Copilot CLI, ready to help you with software engineering tasks...
Analysis
The deadlock occurs in verifyProtocolVersion() → Ping() → JSONRPCClient.Request(), suggesting the JSON-RPC channel setup over stdio isn't working correctly. The CLI starts but either:
Doesn't output the expected JSON-RPC responses
The SDK isn't reading them correctly
There's a timing issue in the startup sequence
Workaround
Currently using the mock client while investigating. Would appreciate any guidance on:
Required CLI flags for JSON-RPC mode
Environment variables for SDK communication
Alternative TCP mode configuration
Related
This is a follow-up discovery from #18 (Go submodule version tags). Found while trying to integrate the SDK into a project.
This is a well-documented bug report with excellent reproduction steps and stack traces. I've labeled this as sdk/go, bug, and priority/high since it's a blocking deadlock preventing SDK usage on macOS.
The issue appears to be in the JSON-RPC communication setup over stdio during client.Start(). The CLI works standalone but the SDK's JSON-RPC handshake isn't completing, causing the deadlock in verifyProtocolVersion().
This will need investigation into:
Whether the CLI requires specific flags to enable JSON-RPC mode over stdio
How the SDK is spawning and communicating with the CLI process
Platform-specific stdio handling differences on macOS
Update: Root cause identified - Documentation gap, not a bug
After further investigation, I believe this is not a SDK bug but a documentation issue.
What I discovered
The npm @github/copilot package contains two different CLIs:
File
Supports --server --stdio
index.js (14MB bundled Node.js)
✅ YES
copilot-darwin-arm64/copilot (binary)
❌ NO
The confusion
I was using the binary from VS Code Insiders (copilot-chat/copilotCli/copilot) which lacks the --server --stdio flags. The SDK requires the index.js version.
Verified working
# Install the npm package
npm install @github/copilot@0.0.382
# Set CLI path to index.js (NOT the binary)export COPILOT_CLI_PATH="$(pwd)/node_modules/@github/copilot/index.js"# SDK now works!
go test -tags=integration -v ./pkg/copilot/...
# PASS!
Documentation gap
The SDK READMEs all say:
CLIPath (string): Path to CLI executable (default: "copilot")
But all SDK test harnesses explicitly use index.js:
Activity
github-actions commentedon Jan 15, 2026
Thanks for reporting this issue, @djdefi!
This is a well-documented bug report with excellent reproduction steps and stack traces. I've labeled this as
sdk/go,bug, andpriority/highsince it's a blocking deadlock preventing SDK usage on macOS.The issue appears to be in the JSON-RPC communication setup over stdio during
client.Start(). The CLI works standalone but the SDK's JSON-RPC handshake isn't completing, causing the deadlock inverifyProtocolVersion().This will need investigation into:
The team will take a look at this soon!
djdefi commentedon Jan 15, 2026
Update: Root cause identified - Documentation gap, not a bug
After further investigation, I believe this is not a SDK bug but a documentation issue.
What I discovered
The npm
@github/copilotpackage contains two different CLIs:--server --stdioindex.js(14MB bundled Node.js)copilot-darwin-arm64/copilot(binary)The confusion
I was using the binary from VS Code Insiders (
copilot-chat/copilotCli/copilot) which lacks the--server --stdioflags. The SDK requires the index.js version.Verified working
Documentation gap
The SDK READMEs all say:
But all SDK test harnesses explicitly use
index.js:../nodejs/node_modules/@github/copilot/index.jsnode_modules/@github/copilot/index.jsnodejs/node_modules/@github/copilot/index.jsnodejs/node_modules/@github/copilot/index.jsSuggestion
Could this issue be converted to a documentation request to clarify:
index.js, not the binarynpm install @github/copilotand point toindex.jsApologies for the false positive! Happy to close this if you'd prefer to track documentation separately.
anowardear062-svg commentedon Jan 15, 2026
Sure
friggeri commentedon Jan 16, 2026
Thanks for reporting! @devm33 can you take a look?
devm33 commentedon Jan 20, 2026
Closing since this was just a version issue
Go APIs for defining tools with automatic schema (#19)
Add Delphi/Object Pascal SDK for GitHub Copilot CLI