Skip to content

[Bug]: Source-built server cannot resolve the Copilot SDK at runtime #34

Open

Description

@jdbencardinop

Before submitting

  • Searched existing open issues; no dedicated duplicate found.
  • Included reproduction and a user-confirmed workaround.

Area

Build, CI, or release tooling; apps/server; packages/provider-copilot.

Steps to reproduce

  1. Install locked workspace dependencies and build the source distribution with pnpm exec vp run --filter t3 build.
  2. Run node apps/server/dist/bin.mjs serve as a persistent background service.
  3. Enable native GitHub Copilot with an explicit executable path.
  4. Observe initialization failure; changing to default copilot fails later instead.

Expected behavior

The built server resolves its pinned SDK without manually repairing node_modules. Default discovery and explicit executable overrides work when otherwise correctly configured.

Actual behavior

Explicit path: Disabled · Driver 'githubCopilot' failed to create instance: Could not configure Copilot.

Default copilot: Status Not found · Unable to start the Copilot CLI.

The SDK exists under packages/provider-copilot/node_modules, but cannot be resolved from the built server chunk. The server package does not declare it as a direct runtime dependency. Emitted code retains createRequire(import.meta.url) and runtime require("@github/copilot-sdk"). Explicit paths hit this require during configuration; the default hits it when constructing the client.

Impact

Blocks Copilot on the affected source-built server. HTTP/V2 readiness passes despite provider failure.

Version or commit

Fork 0.1.4-preview.20261029.1; runtime source 16d428db823f17c18ec16a79e1ec12ae4ba795c1; SDK 1.0.8.

Environment

Intel macOS 15.7.7; Node 24.15.0; pnpm workspace; source-built server/web distribution managed by a user LaunchAgent. Packaged desktop/SEA impact is not established by this reproduction.

Logs or stack traces

MODULE_NOT_FOUND Cannot find module '@github/copilot-sdk'
Require stack:
- <release>/apps/server/dist/binCli-C61nmx6v.mjs

Node createRequire anchored at the built server reproduced this. Directly loading the SDK from the provider package succeeded; CopilotClient and RuntimeConnection.forStdio exports were present. The platform executable existed and ran.

Screenshots, recordings, or supporting files

No screenshot attached. Runtime resolution probes reproduced the failure; the user confirmed operation after the workaround.

Workaround

Expose the existing pinned dependency without downloading/upgrading:

RELEASE="<active-release-directory>"
mkdir -p "$RELEASE/apps/server/node_modules/@github"
# Only create when the destination does not already exist.
ln -s "$RELEASE/packages/provider-copilot/node_modules/@github/copilot-sdk" \
  "$RELEASE/apps/server/node_modules/@github/copilot-sdk"

Verify SDK resolution from the server directory, restart the exact service after work finishes, and use the explicit platform executable path. User confirmed this restored operation. The link is deployment-local and may disappear during dependency restoration.

Follow-up / acceptance criteria

  • Make SDK resolution work through the supported source-build/install pipeline, preserving pinned versions and account settings.
  • Add a focused distribution-level regression for default and explicit-path configuration outside the provider source directory.
  • Include provider readiness in the relevant deployment gate, not just HTTP readiness.
  • Preserve underlying diagnostic causes to distinguish missing SDK, missing executable, and authentication failures.
  • Do not infer effective CLI version from the package folder: a platform folder named 1.0.75 reported CLI 1.0.106-2 when executed. No CLI update was performed during diagnosis.

Related: #17. This records deferred work; no durable source fix or tpatch feature has been implemented.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions