Skip to content

Make the postinstall vscode-jsonrpc rewrite conditional, then lift the copilot-sdk cap #2415

Open

Description

@tamirdresher

Follow-up to #2414, which caps @github/copilot-sdk below 1.0.29 as a mitigation.

Problem

packages/squad-cli/scripts/patch-esm-imports.mjs runs as the CLI postinstall and from squad upgrade (packages/squad-cli/src/cli/core/upgrade.ts:1113-1114). It patches unconditionally:

  • Layer 1 replaces the exports map of every vscode-jsonrpc copy in its search roots whose map lacks ./node.js. That includes valid 9.x and 10.x maps. It never sees the copy nested under @github/copilot-sdk/node_modules.
  • Layer 2 rewrites vscode-jsonrpc/node to vscode-jsonrpc/node.js in copilot-sdk's dist/session.js.

copilot-sdk 1.0.29 and later depend on vscode-jsonrpc 10, which exports ./node but not ./node.js, so the rewrite breaks the import with ERR_PACKAGE_PATH_NOT_EXPORTED.

Proposed fix

  • Rewrite only when the vscode-jsonrpc that session.js actually resolves to has no exports map (8.x). Otherwise leave the import alone. Consider undoing an earlier rewrite when the resolved copy doesn't export ./node.js.
  • Add an exports map only to copies that have none. Don't overwrite valid maps.
  • Apply the same condition to the squad doctor check (packages/squad-cli/src/cli/commands/doctor.ts:521-539), which currently tells users to run the postinstall whenever the import has no extension.
  • Review the runtime resolver hook in packages/squad-cli/src/cli-entry.ts:42-52.
  • Add regression tests for an 8.x layout and a nested 10.x layout. Then lift the cap in packages/squad-sdk/package.json and confirm test/cli-packaging-smoke.test.ts passes with copilot-sdk 1.0.29 or later.

Activity

  1. added a commit that references this issue on Nov 8, 2026
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