Skip to content

Add 1ES lane for building Copilot CLI with latest MXC - #1116

Draft
Huzaifa Danish (huzaifa-d) wants to merge 2 commits into
mainfrom
user/modanish/cli-mxc-1es-workflow
Draft

Add 1ES lane for building Copilot CLI with latest MXC#1116
Huzaifa Danish (huzaifa-d) wants to merge 2 commits into
mainfrom
user/modanish/cli-mxc-1es-workflow

Conversation

@huzaifa-d

@huzaifa-dHuzaifa Danish (huzaifa-d) commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

📖 Description

Adds a manual-only copilot-cli-build validation plan that runs on 1es-mxc-windows-prerelease-t1-x64 and:

  • checks out the latest microsoft/mxc@main and private github/copilot-agent-runtime@main;
  • uses the copilot environment's GHCP_CLI_SOURCE_READ secret only for private source checkout;
  • rewrites the disposable CLI checkout to use the local MXC mxc-sdk;
  • builds the runtime and required CLI native addon using the CLI-pinned Rust toolchain;
  • stages a job-local copilot-mxc-test command;
  • verifies Cargo provenance and source/bundled runtime hash equality;
  • uploads only a sanitized provenance manifest and summary, never private source or binaries.

This first lane proves private checkout, combined compilation, staging, and provenance. It intentionally does not authenticate to Copilot or run sandbox capability scenarios yet.

🔗 References

🔍 Validation

  • pwsh -NoProfile -File scripts/ci/test-copilot-cli-mxc-build.ps1 — 14 contract tests pass.
  • PowerShell parser checks pass for the module, orchestrator, and test harness.
  • Both changed workflow YAML files parse successfully.
  • git diff --check passes.
  • The initial 1ES workflow dispatch is queued on the selected hosted pool.

✅ Checklist

  • Signed the Contributor License Agreement
  • Linked to an issue
  • Updated documentation (if applicable)
  • Updated Copilot instructions (if build, architecture, or conventions changed)
  • If this PR changes Cargo.lock, the dependency-feed-check check passes (not applicable; Cargo.lock is unchanged)

📋 Issue Type

  • Bug fix
  • Feature
  • Task

GitHub Actions runs the PR validation build automatically. The ADO pipeline
(MXC-PR-Build) is the Azure version of the PR pipeline, kept in parity with the GitHub
Actions build; it runs on merge to main, and Microsoft reviewers with write access can trigger it
on a PR with /azp run. See docs/pull-requests.md.

If the dependency-feed-check check fails on a new dependency, the crate must be added to
the feed before the PR can pass. See docs/pull-requests.md
for the steps.

Microsoft Reviewers: Open in CodeFlow

huzaifa-msftand others added 2 commits September 4, 2026 15:49
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
CopilotAI balanced review requested due to automatic review settings September 4, 2026 23:01
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@microsoft-github-policy-servicemicrosoft-github-policy-serviceBot added the Copilot-Instructions PR modifies Copilot instruction files (.github/copilot-instructions.md or .github/instructions/) label Sep 4, 2026

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Private-source logging, fail-open manifest sanitization, and unwired contract tests must be addressed.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review tier: Balanced
Findings: 2 High severity · 1 Medium severity

New issues introduced by this change (3)
SeverityFinding
High severity.github/​workflows/​Validation.CopilotCli.Mxc.Job.yml — This directly streams pnpm, Cargo, rustc, and bundler diagnostics from the private checkout into…
High severityscripts/​ci/​CopilotCliMxcBuild.psm1 — Validate the manifest before writing it. This branch suppresses deletion failures and then throws,…
Medium severityscripts/​ci/​test-copilot-cli-mxc-build.ps1 — This new contract suite is not invoked by any workflow, so future changes to the helper or…
What changed in this PR

Adds a manual 1ES lane that builds the latest Copilot CLI against MXC main and records provenance.

Changes:

  • Adds reusable and dispatch workflows for the build lane.
  • Adds build helpers, orchestration, and contract tests.
  • Documents the lane and its security boundaries.
FileDescription
.github/​workflows/​Validation.Tests.Scheduled.ymlAdds the manual plan.
.github/​workflows/​Validation.CopilotCli.Mxc.Job.ymlDefines checkout, build, evidence, and cleanup.
scripts/​ci/​CopilotCliMxcBuild.psm1Implements build and provenance helpers.
scripts/​ci/​build-copilot-cli-with-mxc.ps1Orchestrates compilation and staging.
scripts/​ci/​test-copilot-cli-mxc-build.ps1Adds contract tests.
docs/​ci-validation-infrastructure.mdDocuments the lane.
.github/​copilot-instructions.mdRecords the new CI architecture.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +91 to +95
./scripts/ci/build-copilot-cli-with-mxc.ps1 `
-MxcRoot "$env:GITHUB_WORKSPACE\source\mxc" `
-CliRoot "$env:GITHUB_WORKSPACE\source\cli" `
-StageRoot "$env:RUNNER_TEMP\copilot-mxc-test" `
-ManifestPath "$env:RUNNER_TEMP\copilot-cli-mxc-provenance.json"
Comment on lines +378 to +398
$json = $manifest | ConvertTo-Json -Depth 4
Set-Content -Path $ManifestPath -Value $json -Encoding utf8NoBOM
Write-Host "Manifest written to $ManifestPath"

# Post-write sanitization check — reject if the file contains tokens,
# private checkout paths, or environment secret names.
$content = Get-Content $ManifestPath -Raw
$suspiciousPatterns = @(
'ghp_' # GitHub PAT prefix
'gho_' # GitHub OAuth prefix
'github_pat_' # Fine-grained PAT prefix
'GHCP_CLI_' # Environment secret name fragment
'\\source\\cli' # Private CLI absolute path (backslash)
'/source/cli' # Private CLI absolute path (forward slash)
)
foreach ($pattern in $suspiciousPatterns) {
if ($content -match [regex]::Escape($pattern)) {
Remove-Item $ManifestPath -Force -ErrorAction SilentlyContinue
throw "Manifest contains suspicious content matching '$pattern'. File removed."
}
}
@@ -0,0 +1,366 @@
#Requires -Version 7.0
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Copilot-InstructionsPR modifies Copilot instruction files (.github/copilot-instructions.md or .github/instructions/)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@huzaifa-d@huzaifa-msft