Repository navigation
linux: expose the Copilot shim in DEB/RPM packages - #342014
Don Jayamanne (DonJayamanne) wants to merge 3 commits into
Conversation
Honor Linux installation policy and preserve the official installer PATH. Manage Stable and Insiders command ownership through guarded package lifecycle hooks. Add native runtime regressions and a focused package lifecycle harness while leaving deferred packaging formats and non-Linux behavior unchanged. Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
🟡 Changes recommended
Placeholder validation and root launcher invocation prevent the new package-lifecycle matrix from completing.
2 open findings
What changed in this PR
Exposes the bundled Copilot shim through Linux DEB/RPM packages, with guarded shared-command ownership and Linux installation-policy enforcement.
Changes:
- Adds lifecycle-managed
/usr/bin/copilotlinks for Stable and Insiders. - Preserves Linux installer PATH and adds native policy enforcement.
- Adds runtime regressions, package-lifecycle tooling, and documentation.
| File | Description |
|---|---|
| test/sanity/src/generateCopilotShimFixtures.ts | Generates package fixtures and provenance. |
| test/sanity/src/copilotShimRuntime.ts | Stores lifecycle runner configuration. |
| test/sanity/src/copilotShimRenderingIndex.ts | Runs rendering checks. |
| test/sanity/src/copilotShimRendering.ts | Validates embedded helpers and hooks. |
| test/sanity/src/copilotShimRendering.test.ts | Tests template rendering contracts. |
| test/sanity/src/copilotShimIndex.ts | Configures the focused lifecycle runner. |
| test/sanity/src/copilotShimHarness.ts | Implements package transactions and assertions. |
| test/sanity/src/copilotShimFixtures.ts | Loads and validates fixture manifests. |
| test/sanity/src/copilotShim.test.ts | Covers ownership and lifecycle scenarios. |
| test/sanity/scripts/run-copilot-shim-container.sh | Launches disposable test containers. |
| test/sanity/scripts/provision-copilot-shim-runner.sh | Provisions runner markers and directories. |
| test/sanity/README.md | Documents fixture generation and validation. |
| test/sanity/package.json | Adds focused test commands. |
| test/sanity/fixtures/copilot-shim-fixtures.schema.json | Defines fixture manifest structure. |
| test/sanity/fixtures/copilot-shim-fixture-plan.example.json | Provides an example fixture plan. |
| resources/linux/rpm/code.spec.template | Adds RPM lifecycle hooks. |
| resources/linux/debian/postrm.template | Handles shared-link removal and fallback. |
| resources/linux/debian/postinst.template | Selects the shared link during configuration. |
| resources/linux/copilot-link.sh | Implements guarded shared-link management. |
| copilot_shim/tests/pty.rs | Tests inherited PATH and fallback launches. |
| copilot_shim/tests/native_policy.rs | Tests native Linux policy dispatch. |
| copilot_shim/src/runtime.rs | Delegates policy checks to the reader. |
| copilot_shim/src/policy.rs | Implements Linux policy parsing. |
| copilot_shim/src/lib.rs | Registers the policy module. |
| copilot_shim/src/install.rs | Preserves Linux installer PATH. |
| copilot_shim/src/candidate.rs | Limits production PATH filtering to non-Linux Unix. |
| copilot_shim/src/app.rs | Extends policy and installer regressions. |
| copilot_shim/SHIM_POST_INSTALL.md | Explains platform-specific installation behavior. |
| copilot_shim/REQUIREMENTS.md | Defines Linux exposure and policy contracts. |
| copilot_shim/Cargo.toml | Bumps shim version and adds JSON support. |
| copilot_shim/Cargo.lock | Locks updated version and dependencies. |
| build/gulpfile.vscode.linux.ts | Embeds the helper into package templates. |
🧠 Review effort: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Preserve the upstream macOS Copilot installation flow alongside Linux native policy enforcement and DEB/RPM command exposure. Co-authored-by: Copilot <[email protected]>
Use a scenario-local profile for root launcher validation and ignore disabled shell comments when checking unresolved package placeholders. Preserve strict helper validation and add focused regressions. Co-authored-by: Copilot <[email protected]>
|
Superseded by #342101, which includes every commit from this PR ( |

Summary
/usr/bin/copilotin Linux DEB/RPM Stable and Insiders packages, including external terminals.CopilotCliCommandpolicy reader from fix: enforce Copilot CLI shim policy on macOS and Linux #341916. An eligible installed CLI still launches; disabled policy blocks installation of a missing CLI.PATH, avoiding removal of system utilities when a shim is exposed through/usr/bin. Retain shim-aware discovery and installation-directory fallback.0.1.1.Windows/macOS behaviour, existing
codelaunchers, and independent Copilot CLI installations/data are intended to remain unchanged. Snap exposure, archive layout/exposure, downstream recipes, and special handling for image-based Fedora systems are deferred. Shared Linux runtime changes still reach binaries bundled in those existing formats.Validation
The following checks were run during implementation; successful checks were reused while their relevant inputs remained unchanged.
copilot_shimcargo test --lockedcargo fmt --checkcargo clippy --all-targets --locked -- -D warningsVSCODE_COPILOT_SHIM_NATIVE_POLICY_TEST=1 VSCODE_COPILOT_SHIM_NATIVE_POLICY_TEST_ROOT=/etc/vscode cargo test --locked --test native_policy -- --ignored --exact native_binary_dispatches_provisioned_policycargo test --manifest-path copilot_shim\Cargo.toml --lockedcargo test --manifest-path copilot_shim\Cargo.toml --locked --lib app::testscargo clippy --manifest-path copilot_shim\Cargo.toml --lib --test app --test native_policy --test pty --locked -- -D warningsnpm --prefix test\sanity run compilenpm --prefix test\sanity run test-copilot-shim-renderingbuild\azure-pipelines\ossnpx --yes [email protected] tsx cargo-section4.test.tsgit diff --cached --checkTargeted TypeScript lint also passed:
npm run eslint -- build\gulpfile.vscode.linux.ts test\sanity\src\copilotShimFixtures.ts test\sanity\src\copilotShimHarness.ts test\sanity\src\copilotShimIndex.ts test\sanity\src\copilotShimRuntime.ts test\sanity\src\copilotShimRendering.ts test\sanity\src\copilotShimRenderingIndex.ts test\sanity\src\copilotShimRendering.test.ts test\sanity\src\copilotShim.test.ts test\sanity\src\generateCopilotShimFixtures.tsAn additional isolated smoke using an actual
/usr/bin/copilotshim and merged/binalias verified unchanged installer/downloader/CLI PATH, available system utilities, one installation, and two successful fallback launches.Validation limitations:
chunks_exactlint in unchanged ConPTY tests; affected Windows targets and all Linux targets under Rust 1.88 pass.Draft follow-ups
The read-only review and subsequent rubber-duck review identified these test-tooling issues. They are intentionally left unfixed in this draft:
/usr/bin/code//usr/bin/code-insiderscommand.Installer validation
Build this branch with the existing Azure product pipeline using
VSCODE_BUILD_TYPE=Product, the required Linux architecture,VSCODE_BUILD_LINUX_SNAP=false,VSCODE_PUBLISH=false, andVSCODE_RELEASE=false. Keep tests enabled; artifact-backed sanity testing can be enabled withVSCODE_RUN_ARTIFACT_SANITY_TESTS=true.Use separate Stable and Insiders builds from the same implementation commit to test fresh installation, cross-edition takeover, owner/non-owner removal, fallback, and preservation of unrelated commands. Retain older/newer package revisions for genuine upgrade tests. The existing artifact sanity tests do not replace the full new ownership matrix.