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
[TypeScript SDK] Process not returning properly after client stop / dangling promise in sendAndWait #136
When try this simple example, the node process gets stuck after the client.stop() ends and doesn't return until the sendAndWait timeout expires. I tried changing the sendAndWait timeout duration and it effectively reduces or augments the time before the node process completed.
import { CopilotClient } from "@github/copilot-sdk";
const client = new CopilotClient();
try {
await client.start();
const session = await client.createSession({ model: "gpt-4.1" });
const response = await session.sendAndWait({ prompt: "Say hello in french and stop" });
console.log(response?.data.content);
await session.destroy();
console.log(`Session destroyed`);
} catch (error) {
console.error("Error:", error);
} finally {
const errors = await client.stop();
if (errors.length > 0) {
console.error("Cleanup errors:", errors);
}
console.log(`Client stopped`);
// DO NOT force kill the process to show the dangling promise.
// process.exit(0);
}
Since this is related to the sendAndWait timeout there might be a dangling promise there.
I've labeled this as a bug affecting the Node.js SDK. The reproduction code is clear and the suspected root cause (dangling promise in sendAndWait) is helpful. This looks like a legitimate cleanup issue where the timeout timer isn't being properly cancelled when client.stop() is called.
Activity
github-actions commentedon Jan 23, 2026
Thanks for reporting this issue! 👍
I've labeled this as a bug affecting the Node.js SDK. The reproduction code is clear and the suspected root cause (dangling promise in
sendAndWait) is helpful. This looks like a legitimate cleanup issue where the timeout timer isn't being properly cancelled whenclient.stop()is called.X4MU-L commentedon Jan 23, 2026
+1
DaiqianHu commentedon Jan 23, 2026
You need to run /login in Copilot CLI first?
sinedied commentedon Jan 23, 2026
@DaiqianHu unrelated, this happens after the session has successfully ended. And yes for the session to be successful, I'm logged in.
fix github#136
fix: clear timeout timer in sendAndWait to prevent process hang
fix: clear timeout timer in sendAndWait to prevent process hang (gith…
fix: clear timeout timer in sendAndWait to prevent process hang (#349)