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) Cancelling a context, passed to client.Start, kills the copilot CLI process #668
copilot.Client.Start, under the covers, is using exec.CommandContext for the background copilot CLI process.
exec.CommandContext has a little bit of a footgun, where if you cancel the context that was passed to it, it kills the underlying process. This works great for most command usages, but in this case, where you specifically have a CLI process that intends to outlive 'Start', it results in this idiomatic code causing issues:
client:=copilot.NewClient()
ctx, cancel:=context.WithCancel(context.Background())
client.Start(ctx)
cancel() // <- when this cancels it'll kill copilot CLIsess, err:=client.CreateSession()
// err == 'CLI process exited: signal: killed'
changed the title [-]Cancelling a context, passed to client.Start, kills the `copilot` CLI process[/-][+](Go SDK) Cancelling a context, passed to client.Start, kills the `copilot` CLI process[/+]on Mar 4, 2026
Thanks for reporting this issue. Agree that the CLI lifespan shouldn't be tied to the context passed to Client.Start. I've checked the .NET SDK, which also supports cancellation tokens, and confirmed that canceling the token doesn't kill the CLI.
Activity
[-]Cancelling a context, passed to client.Start, kills the `copilot` CLI process[/-][+](Go SDK) Cancelling a context, passed to client.Start, kills the `copilot` CLI process[/+]qmuntal commentedon Mar 5, 2026
Thanks for reporting this issue. Agree that the CLI lifespan shouldn't be tied to the context passed to
Client.Start. I've checked the .NET SDK, which also supports cancellation tokens, and confirmed that canceling the token doesn't kill the CLI.Will submit a fix soon.