Skip to content

Detect runtime for copilot-sdk installs from engine.copilot.command via runtime manager#36653

Merged
pelikhan merged 11 commits into
mainfrom
copilot/detect-runtime-install-copilot-sdk
Jun 3, 2026
Merged

Detect runtime for copilot-sdk installs from engine.copilot.command via runtime manager#36653
pelikhan merged 11 commits into
mainfrom
copilot/detect-runtime-install-copilot-sdk

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jun 3, 2026

When copilot-sdk: true is enabled, SDK installation previously assumed npm/Node even for custom engine.copilot.command runtimes. This change infers runtime from the command and emits the matching SDK install command with pinned SDK versioning and safe install flags.

  • Runtime-aware SDK installation

    • Detects runtime from engine.copilot.command (including env ... <cmd> wrappers).
    • Integrates runtime detection with the runtime manager command mapping (commandToRuntime).
    • Maps to language-specific install commands:
      • Node.js/TypeScript → npm install @github/copilot-sdk@<version>
      • Python → pip install github-copilot-sdk==<version>
      • Go → go get github.com/github/copilot-sdk/go@v<version>
      • Rust → cargo add github-copilot-sdk@<version>
      • .NET → dotnet add package GitHub.Copilot.SDK --version <version>
      • Java → Maven artifact fetch for com.github:copilot-sdk-java:<version>
    • Preserves compatibility fallbacks for command tokens not currently represented in runtime manager mappings (cargo/rustc, mvnw, ts-node), and defaults unknown runtimes to Node SDK install.
  • Custom command installation flow

    • engine.copilot.command no longer suppresses SDK installation when copilot-sdk: true.
    • In firewall mode, SDK install step is emitted alongside AWF runtime installation.
  • Install command policy alignment

    • Keeps npm invocation hardened (--ignore-scripts) and non-mutating (--no-save).
    • Uses DefaultCopilotSDKVersion consistently across all runtime-specific install commands.
  • Tests

    • Updated Copilot engine installation tests to validate:
      • Node default behavior remains unchanged
      • runtime-specific command selection for all supported SDK runtimes
      • runtime-manager-derived Java detection (gradle)
      • unsupported runtime fallback to Node SDK install
      • env-wrapped command detection
      • coexistence with firewall/AWF installation
workflowData := &WorkflowData{
  EngineConfig: &EngineConfig{
    Command:    "python3 main.py",
    CopilotSDK: true,
  },
}
// Emits: Install GitHub Copilot SDK (Python)
// run: cd "${GITHUB_WORKSPACE}" && pip install --disable-pip-version-check github-copilot-sdk==<DefaultCopilotSDKVersion>

Copilot AI and others added 3 commits June 3, 2026 14:09
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title Detect runtime for copilot-sdk installs from engine.copilot.command Detect runtime for copilot-sdk installs from engine.copilot.command Jun 3, 2026
Copilot AI requested a review from pelikhan June 3, 2026 14:17
Copy link
Copy Markdown
Collaborator

@pelikhan pelikhan left a comment

Choose a reason for hiding this comment

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

@copilot integrate in runtime manager

Copilot AI and others added 7 commits June 3, 2026 14:26
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Jun 3, 2026

@copilot integrate in runtime manager

Implemented in dda01942c5: Copilot SDK runtime detection now uses the runtime manager command mapping (commandToRuntime) for engine.copilot.command, with compatibility fallbacks for tokens not yet represented there (cargo/rustc, mvnw, ts-node). Added tests for runtime-manager Java detection (gradle) and unsupported runtime fallback to Node SDK install.

Copilot AI changed the title Detect runtime for copilot-sdk installs from engine.copilot.command Detect runtime for copilot-sdk installs from engine.copilot.command via runtime manager Jun 3, 2026
Copilot AI requested a review from pelikhan June 3, 2026 14:41
@pelikhan pelikhan marked this pull request as ready for review June 3, 2026 14:44
Copilot AI review requested due to automatic review settings June 3, 2026 14:44
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

This PR updates Copilot engine installation step generation so that when copilot-sdk: true is enabled, the workflow emits a runtime-specific Copilot SDK install step based on engine.copilot.command (including env ... <cmd> wrappers), instead of always assuming Node/npm.

Changes:

  • Added runtime detection for engine.copilot.command and mapped it to language-specific Copilot SDK install commands (Node/Python/Go/Rust/.NET/Java).
  • Ensured SDK install steps are still emitted even when a custom Copilot command is provided (and in firewall mode, alongside AWF installation).
  • Expanded unit tests to cover runtime-specific SDK installation selection and firewall coexistence.
Show a summary per file
File Description
pkg/workflow/copilot_engine_installation.go Adds runtime-aware SDK install step generation and integrates it into Copilot engine installation flow.
pkg/workflow/copilot_engine_test.go Updates existing assertions and adds coverage for runtime-specific SDK install steps with/without firewall.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 2/2 changed files
  • Comments generated: 1

Comment on lines +83 to +88
var steps []GitHubActionStep
if len(sdkInstallStep) > 0 {
steps = append(steps, sdkInstallStep)
}
return BuildNpmEngineInstallStepsWithAWF(steps, workflowData)
}
@pelikhan pelikhan merged commit 379c247 into main Jun 3, 2026
26 checks passed
@pelikhan pelikhan deleted the copilot/detect-runtime-install-copilot-sdk branch June 3, 2026 14:55
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.

3 participants