Skip to content

Stop copying node-pty into Copilot CLI SDK#310925

Merged
anthonykim1 merged 9 commits intomainfrom
anthonykim1/removeNodePtyCopying
Apr 21, 2026
Merged

Stop copying node-pty into Copilot CLI SDK#310925
anthonykim1 merged 9 commits intomainfrom
anthonykim1/removeNodePtyCopying

Conversation

@anthonykim1
Copy link
Copy Markdown
Contributor

@anthonykim1 anthonykim1 commented Apr 17, 2026

Fixes #307746

The Copilot CLI SDK now resolves node-pty from the host (VS Code) via hostRequire and falls back to its bundled copy only if that fails, shipped in @github/copilot@1.0.26-0

  • Meaning, we no longer need to copy our node-pty binaries into the SDK's prebuilds folder.

We had two copies of the same workaround:

  • Build time (build/lib/copilot.ts) ran during packaging, so shipped builds had node-pty already in place inside the SDK's prebuilds folder.
  • Runtime (nodePtyShim.ts, called from ensureShims()) ran the first time the CLI was used. This covered the dev loop (Code OSS / ./scripts/code.sh) where the build-time step never runs, plus served as a safety net if the build-time copy was ever missing.

Both are now obsolete — the SDK would finds VS Code's node-pty on its own.

Kept as-is:

  • .moduleignore rules that strip @github/copilot/prebuilds/** and @github/copilot-{platform} packages — we still don't want to ship the SDK's bundled prebuilds, even as an unused fallback.
  • ensureRipgrepShim — unchanged; ripgrep still needs to be shimmed.

@DonJayamanne Now that we no longer shim node-pty, the computer.node and win32.node files under the previously skipped sdk/prebuilds/ are surfaced. We should acknowledge them in knownBinaries so the test continues to track changes to them.

  • Previously hidden by a broad sdk/prebuilds/** exclusion that was masking the node-pty files we used to shim in at test setup. Node-pty is now resolved from VS Code via hostRequire, no shim runs, so these SDK-shipped binaries are visible and must be acknowledged here.

Copilot AI review requested due to automatic review settings April 17, 2026 06:26
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 17, 2026

Screenshot Changes

Base: 8974e745 Current: 92822001

Changed (2)

chat/aiCustomizations/aiCustomizationManagementEditor/McpBrowseMode/Light
Before After
before after
editor/inlineCompletions/other/JumpToHint/Dark
Before After
before after

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Removes the now-obsolete node-pty shim/copy logic for the Copilot CLI SDK after the SDK started resolving node-pty from the host (VS Code) via hostRequire, keeping only the ripgrep shim behavior.

Changes:

  • Delete the runtime node-pty shim (nodePtyShim.ts) and stop invoking it during CLI SDK initialization.
  • Remove the build-time packaging copy step for node-pty and update build tasks to only prepare Copilot shims (ripgrep + marker).
  • Update upgrade tests/docs to no longer treat node-pty as a shimmed artifact.
Show a summary per file
File Description
extensions/copilot/src/extension/chatSessions/vscode-node/test/copilotCLISDKUpgrade.spec.ts Removes test-time node-pty shim copying; keeps ripgrep shim setup and binary inventory checks.
extensions/copilot/src/extension/chatSessions/copilotcli/node/nodePtyShim.ts Removes the runtime node-pty shim implementation entirely.
extensions/copilot/src/extension/chatSessions/copilotcli/node/copilotCli.ts Stops creating node-pty shims at runtime; keeps ripgrep shim before SDK import.
extensions/copilot/src/extension/chatSessions/copilotcli/AGENTS.md Updates documentation to reflect that only ripgrep is shimmed; node-pty is resolved via hostRequire.
extensions/copilot/eslint.config.mjs Removes ESLint ignore entry for the deleted shim file.
build/lib/copilot.ts Removes build-time node-pty copy helper; keeps built-in shim preparation for ripgrep + marker.
build/gulpfile.vscode.ts Updates packaging pipeline to only prepare Copilot shims (no native deps copy).
build/gulpfile.reh.ts Same as above for REH/server packaging.

Copilot's findings

Comments suppressed due to low confidence (3)

extensions/copilot/src/extension/chatSessions/vscode-node/test/copilotCLISDKUpgrade.spec.ts:125

  • Test name says it verifies loading the @github/copilot module, but the test currently imports @github/copilot/sdk again (same as the earlier test). This won’t catch regressions in the @github/copilot entrypoint; either change the import to @github/copilot or update/remove the redundant test so the assertion matches the intent.
	it('should be able to load the @github/copilot module without errors', async function () {
		await import('@github/copilot/sdk');
	});

extensions/copilot/src/extension/chatSessions/vscode-node/test/copilotCLISDKUpgrade.spec.ts:131

  • copyBinaries redefines copilotSDKPath, shadowing the outer copilotSDKPath constant from the suite. This makes the test a bit harder to follow; consider reusing the outer constant (or rename the inner variable) to avoid shadowing.
async function copyBinaries(extensionPath: string) {
	const copilotSDKPath = path.join(extensionPath, 'node_modules', '@github', 'copilot');
	const vscodeRipgrepPath = path.join(copilotSDKPath, 'ripgrep', 'bin', process.platform + '-' + process.arch);
	await copyRipgrepShim(extensionPath, vscodeRipgrepPath, new TestLogService());

extensions/copilot/src/extension/chatSessions/copilotcli/node/copilotCli.ts:467

  • ILogService.error is intended to take the thrown Error as the first argument and an optional stable context message as the second (and the message should not embed error details). Here the error is interpolated into the message and the Error object isn’t passed, which can lose stack/metadata and may include sensitive info. Pass error as the first arg and a short context string as the second.
		try {
			// Ensure the ripgrep shim exists before importing the SDK (required for CLI sessions)
			await this._ensureShimsPromise;
			return await import('@github/copilot/sdk');
		} catch (error) {
			this.logService.error(`[CopilotCLISession] Failed to load @github/copilot/sdk: ${error}`);
			throw error;
  • Files reviewed: 8/8 changed files
  • Comments generated: 1

Co-authored-by: Copilot <copilot@github.com>
@anthonykim1 anthonykim1 self-assigned this Apr 17, 2026
@anthonykim1 anthonykim1 added this to the 1.118.0 milestone Apr 20, 2026
@anthonykim1 anthonykim1 marked this pull request as ready for review April 20, 2026 18:29
@anthonykim1 anthonykim1 merged commit e8a7c6d into main Apr 21, 2026
57 of 82 checks passed
@anthonykim1 anthonykim1 deleted the anthonykim1/removeNodePtyCopying branch April 21, 2026 04:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow Copilot CLI to use vscode's node-pty

3 participants