Skip to content

Agent hangs when executed in GitHub Action #343

@JasonYeMSFT

Description

@JasonYeMSFT

Steps to reproduce:

  1. Create a GitHub repo with a package.json using @github/copilot-sdk as a dependency. Add a bugRepro.mjs file to the repo with the following content
import { CopilotClient } from "@github/copilot-sdk";

async function main() {
    const client = new CopilotClient({
        logLevel: 'all',
    });

    const session = await client.createSession({
        model: 'claude-sonnet-4.5',
    });

    const done = new Promise((resolve) => {
        session.on((event) => {
            console.log(`=== session event ${event.type}`);
            if (event.type === 'session.idle') {
                console.log("resolve");
                resolve();
                return;
            }
        });
    });

    await session.send({ prompt: "hello, what can you do?" });
    await done;
    process.exit();
}

main();
  1. Install the dependencies and run node bugRepro.mjs. The agent will do some work and finally emit a session.idle event.
  2. Create a manual GitHub Action workflow that installs the npm modules, uses mvkaran/setup-copilot-cli@v1 to setup Copilot CLI, and executes the node bugRepro.mjs script.
  3. Observe that the agent consistently emits two pending_messages.modified events and then hangs.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions