Skip to content

NodeJS - v1.0.0-beta.9 - createSession with cloud options returns error "Cannot specify sessionId when creating a remote session in the cloud." #1493

Description

@BenMorganNt

SDK version: @github/copilot-sdk@1.0.0-beta.9
Typescript node application

Following the example shared in the release notes for v1.0.0-beta.8 I've created a function to trigger a cloud session.

export async function triggerCloudSession(payload: OrchestratorPayload) {
  const client = new CopilotClient({
    gitHubToken: config.githubToken,
    useLoggedInUser: false,
  })
  await client.start()

  try {
    const options = {
      model: config.copilotModel,
      cloud: {
        repository: {
          owner: payload.owner,
          name: payload.repository,
          branch: payload.branch,
        },
      },
      onPermissionRequest: approveAll,
    } as SessionConfig

    const session = await client.createSession(options)

    try {
      const ack = await session.sendAndWait({
        prompt: `Reply with exactly: ACK`,
      })
      logger.info("Control sendAndWait OK", {
        ack,
      })
    } catch (e) {
      logger.error("Control sendAndWait FAILED", {
        ...serializeError(e),
      })
    }

    const resp = await session.sendAndWait({
      prompt:
        "Do you have any tools available? If yes, list their names. If no, reply NO_TOOLS.",
    })
    logger.info("tools check", { resp })

    const promptSuffix = `After you start, immediately create a draft PR titled "Agent connectivity test" that adds a single line to README.md, then stop.`
    const structuredPrompt = `/delegate in ${payload.owner}/${payload.repository}:${payload.branch} ${payload.task} ${promptSuffix}`

    const sendResult = await session.sendAndWait({ prompt: structuredPrompt })
    logger.info("sendAndWait() result", { sendResult })
  } catch (error) {
    logger.error("Failed to trigger Copilot session", serializeError(error))
  } finally {
    await client.stop()
  }
}

However when calling my function it returns the following error:

2026-05-28T13:32:09.4985236Z stderr F {"timestamp":"2026-05-28T13:32:09.498Z","level":"ERROR","message":"Failed to orchestrate Copilot session","context":{"name":"Error","message":"Request session.create failed with message: Cannot specify sessionId when creating a remote session in the cloud.","stack":"Error: Request session.create failed with message: Cannot specify sessionId when creating a remote session in the cloud.\n    at handleResponse (/app/node_modules/vscode-jsonrpc/lib/common/connection.js:565:48)\n    at handleMessage (/app/node_modules/vscode-jsonrpc/lib/common/connection.js:345:13)\n    at processMessageQueue (/app/node_modules/vscode-jsonrpc/lib/common/connection.js:362:17)\n    at Immediate.<anonymous> (/app/node_modules/vscode-jsonrpc/lib/common/connection.js:334:13)\n    at process.processImmediate (node:internal/timers:504:21)"}}

sessionId is not specified within my function or elsewhere within the application.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions