-
Notifications
You must be signed in to change notification settings - Fork 35
Open
Labels
Description
Summary
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) - CLI version: 0.0.354 (Commit: 076bd172b)
- CLI path:
/Users/djdefi/Library/Application Support/Code - Insiders/User/globalStorage/github.copilot-chat/copilotCli/copilot
Steps to Reproduce
package main
import (
"log"
copilot "github.com/github/copilot-sdk/go"
)
func main() {
client := copilot.NewClient(&copilot.ClientOptions{
LogLevel: "error",
})
// This deadlocks - never returns
if err := client.Start(); err != nil {
log.Fatal(err)
}
defer client.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.