Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 29, 2026

Enables runtime version overrides for Copilot, Claude, and Codex CLI installations via environment variables, allowing version testing without code changes or releases.

Changes

Constants & Configuration

  • Added GH_AW_COPILOT_VERSION, GH_AW_CLAUDE_VERSION, GH_AW_CODEX_VERSION constants
  • Extended EngineInstallConfig with optional EnvVarName field

Engine Installation

  • Copilot: Modified GenerateCopilotInstallerSteps() to inject env var with fallback
  • Claude/Codex: Added GenerateNpmInstallStepsWithEnvOverride() for npm-based engines
  • Updated GetBaseInstallationSteps() to conditionally apply env var pattern

Runtime Metadata (aw_info.json)

  • Updated agent_version field to use environment variable pattern when no explicit version is configured
  • Maintains consistency between installation steps and runtime metadata
  • For Copilot: agent_version: process.env.GH_AW_COPILOT_VERSION || "0.0.395"
  • For Claude: agent_version: process.env.GH_AW_CLAUDE_VERSION || "2.1.20"
  • For Codex: agent_version: process.env.GH_AW_CODEX_VERSION || "0.92.0"

Version Resolution Priority

  1. Workflow config (explicit engine.version)
  2. Environment variable (runtime override)
  3. Default constant (fallback)

Example

Setting GH_AW_COPILOT_VERSION=0.0.400 in repository variables generates:

# Installation step
- name: Install GitHub Copilot CLI
  env:
    COPILOT_VERSION: ${{ env.GH_AW_COPILOT_VERSION || '0.0.395' }}
  run: /opt/gh-aw/actions/install_copilot_cli.sh "${COPILOT_VERSION}"
// aw_info.json metadata
{
  engine_id: "copilot",
  agent_version: process.env.GH_AW_COPILOT_VERSION || "0.0.395",
  // ... other fields
}

Without the variable set, defaults to 0.0.395.

Original prompt

Allow override the default agentic engine environmen through an environment variabl.e

See a env var on the agent job that takes a environment version or the one baked into the release.

AGENT_CLI_VERSION: ${{ env.GH_AW_COPILOT_VERSION || "version" }}

then later use it when invoking the agent cli.

Add support for Claude (GH_AW_CLAUDE_VERSION) and codex (GH_AW_CODEX_VERSION)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits January 29, 2026 00:33
- Add EnvVarCopilotVersion, EnvVarClaudeVersion, and EnvVarCodexVersion constants
- Update Copilot installation to use GH_AW_COPILOT_VERSION env var
- Update Claude installation to use GH_AW_CLAUDE_VERSION env var
- Update Codex installation to use GH_AW_CODEX_VERSION env var
- Add GenerateNpmInstallStepsWithEnvOverride function for npm package installs
- Update GetBaseInstallationSteps to support environment variable overrides
- Modify copilot_srt.go to use environment variable syntax in installer script

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
- Update test expectations to check for new env var format
- Verify GH_AW_COPILOT_VERSION environment variable is used
- Ensure fallback to default version works correctly

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@pelikhan
Copy link
Contributor

@copilot make sure aw_info.json is also updated

Copilot AI and others added 2 commits January 29, 2026 00:44
- Update Claude engine test to check for new env var format
- Update Codex engine test to check for new env var format
- Remove unused fmt import from claude_engine_test.go

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support for overriding agentic engine environment version Add environment variable overrides for engine CLI versions Jan 29, 2026
Copilot AI requested a review from pelikhan January 29, 2026 00:53
…nt_version

- Modified compiler_yaml.go to use env var pattern for agent_version field
- For Copilot: agent_version: process.env.GH_AW_COPILOT_VERSION || "default"
- For Claude: agent_version: process.env.GH_AW_CLAUDE_VERSION || "default"
- For Codex: agent_version: process.env.GH_AW_CODEX_VERSION || "default"
- Updated aw_info_agent_version_test.go to check for env var pattern
- Explicit versions still use static strings
- Custom engines use static strings (no env var support)

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 29, 2026

@copilot make sure aw_info.json is also updated

Updated in commit 84bc564. The aw_info.json now includes environment variable support for agent_version:

  • Copilot: agent_version: process.env.GH_AW_COPILOT_VERSION || "0.0.395"
  • Claude: agent_version: process.env.GH_AW_CLAUDE_VERSION || "2.1.20"
  • Codex: agent_version: process.env.GH_AW_CODEX_VERSION || "0.92.0"

This matches the installation behavior - when environment variables are set, both the installation steps and the metadata in aw_info.json will use the overridden versions.

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.

2 participants