Skip to content

Inject GH_AW_ENGINE_VERSION into custom engine execution steps - #50597

Merged
pelikhan merged 4 commits into
mainfrom
copilot/add-engine-version-support
Aug 5, 2026
Merged

pelikhan merged 4 commits into
mainfrom
copilot/add-engine-version-support

Conversation

Copilot AI commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

engine.version was parsed and used for installation but never injected into the main agent execution environment for behavior-defined engines (Goose, Ader, Crush, etc.), making it inaccessible to scripts at runtime. Version was already in safe-outputs jobs and audit info (GH_AW_INFO_VERSION).

Changes

  • engine_helpers.go — New applyEngineVersionEnv helper sets GH_AW_ENGINE_VERSION from EngineConfig.Version; supports literal strings and GHA expressions (${{ inputs.engine-version }})
  • behavior_defined_engine.go — Calls applyEngineVersionEnv in buildBehaviorDefinedExecutionEnv, alongside existing applyEngineCwdEnv
  • Tests — Unit tests for the helper; execution-step integration tests asserting presence/absence of GH_AW_ENGINE_VERSION
engine:
  id: goose
  version: "1.2.3"   # now available as GH_AW_ENGINE_VERSION in the run step

Audit logging (GH_AW_INFO_VERSION / GH_AW_INFO_AGENT_VERSION) already covered custom engines via getInstallationVersion — no changes needed there.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title Add GH_AW_ENGINE_VERSION env var injection for custom engine execution steps Inject GH_AW_ENGINE_VERSION into custom engine execution steps Aug 5, 2026
Copilot AI requested a review from pelikhan August 5, 2026 15:36
@pelikhan
pelikhan marked this pull request as ready for review August 5, 2026 16:18
Copilot AI balanced review requested due to automatic review settings August 5, 2026 16:18

Copilot AI 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.

Pull request overview

Injects configured engine versions into behavior-defined engine execution environments.

Changes:

  • Adds applyEngineVersionEnv.
  • Applies it during custom engine execution.
  • Covers literal, expression, absent, and nil configurations.
Show a summary per file
File Description
pkg/workflow/engine_helpers.go Adds version environment helper.
pkg/workflow/engine_helpers_test.go Tests helper behavior.
pkg/workflow/behavior_defined_engine.go Injects version into execution environments.
pkg/workflow/behavior_defined_engine_harness_test.go Tests rendered execution steps.

Review details

Tip

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

  • Files reviewed: 4/4 changed files
  • Comments generated: 0
  • Review effort level: Balanced

@github-actions

github-actions Bot commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

✅ Test Quality Sentinel completed test quality analysis.

@github-actions

github-actions Bot commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Code Quality Reviewer completed the code quality review.

@pelikhan

pelikhan commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

@copilot update goose.md, crush.md, opencode.md, aider.com to declare their version in the front matter and use the version variable in the generate code

@github-actions

github-actions Bot commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

@github-actions

github-actions Bot commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

✅ Design Decision Gate 🏗️ completed the design decision gate check.

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

🧪 Test Quality Sentinel Report

✅ Test Quality Score: 90/100 — Excellent

Analyzed 2 test(s): 2 design, 0 implementation, 0 violation(s).

📊 Metrics (2 tests)
Metric Value
Analyzed 2 (Go: 2, JS: 0)
✅ Design 2 (100%)
⚠️ Implementation 0 (0%)
Edge/error coverage 2 (100%)
Duplicate clusters 0
Inflation YES (test:prod ratio >2:1 in both files)
🚨 Violations 0
Test File Classification Issues
TestBehaviorDefinedEngineVersionEnvInjection behavior_defined_engine_harness_test.go design_test / behavioral_contract / high_value Inflation (51 test lines : 1 prod line)
TestApplyEngineVersionEnv engine_helpers_test.go design_test / behavioral_contract / high_value Inflation (57 test lines : 11 prod lines)

Verdict

✅ passed. 0% implementation tests (threshold: 30%). Score capped from 100 to 90 for test:prod line inflation (both files exceed 2:1), but this is expected when small production helpers receive thorough nil/empty/expression/absent edge coverage. No violations detected.

🧪 Test quality analysis by Test Quality Sentinel · sonnet46 · 37.8 AIC · ⌖ 10.9 AIC · ⊞ 7.7K · ◷
Comment /review to run again

@github-actions github-actions Bot 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.

✅ Test Quality Sentinel: 90/100. 0% implementation tests (threshold: 30%).

@pelikhan

pelikhan commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

@copilot run pr-finisher skill

@github-actions github-actions Bot 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.

The implementation is correct and well-tested. applyEngineVersionEnv is properly nil-guarded, follows the existing helper pattern, and is correctly scoped to behavior-defined (custom) engines only. Test coverage handles nil, empty, literal, and expression cases.> 🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · sonnet46 · 12.6 AIC · ⌖ 9.25 AIC · ⊞ 5.4K

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Design Decision Gate - ADR Required

This PR makes significant changes to core business logic (120 new lines in pkg/workflow/) but does not have a linked Architecture Decision Record (ADR).

Draft ADR committed: docs/adr/50597-inject-engine-version-env-into-behavior-defined-engines.md - review and complete it before merging.

This PR cannot merge until an ADR is linked in the PR body.

What to do next
  1. Review the draft ADR committed to your branch - it was generated from the PR diff
  2. Complete the missing sections - add context the AI could not infer, refine the decision rationale, and list real alternatives you considered
  3. Commit the finalized ADR to docs/adr/ on your branch
  4. Reference the ADR in this PR body by adding a line such as:

    ADR: ADR-50597: Inject Engine Version Env into Behavior-Defined Engines

Once an ADR is linked in the PR body, this gate will re-run and verify the implementation matches the decision.

Why ADRs Matter

ADRs create a searchable, permanent record of why the codebase looks the way it does. Future contributors (and your future self) will thank you.

Michael Nygard ADR Format Reference

An ADR must contain these four sections to be considered complete:

  • Context - What is the problem? What forces are at play?
  • Decision - What did you decide? Why?
  • Alternatives Considered - What else could have been done?
  • Consequences - What are the trade-offs (positive and negative)?

All ADRs are stored in docs/adr/ as Markdown files numbered by PR number.

🏗️ ADR gate enforced by Design Decision Gate 🏗️ · sonnet46 · 50.7 AIC · ⌖ 22.3 AIC · ⊞ 4.4K · ◷
Comment /review to run again

@github-actions github-actions Bot 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.

Skills-Based Review 🧠

Applied /tdd and /codebase-design — changes are solid, approving.

📋 Key Themes & Highlights

Positive Highlights

  • ✅ applyEngineVersionEnv follows the same nil-guard and early-return pattern as applyEngineCwdEnv — consistent with existing conventions
  • ✅ Unit tests cover all five cases: nil data, nil config, empty version, literal version, and GHA expression
  • ✅ Integration harness tests confirm both injection and absence end-to-end
  • ✅ Raw expression (${{ inputs.engine-version }}) is passed through unchanged — correct, since GHA evaluates it at runtime
  • ✅ Call-site ordering in buildBehaviorDefinedExecutionEnv is logical alongside applyEngineCwdEnv
> 🧠 *Reviewed using Matt Pocock's skills by [Matt Pocock Skills Reviewer](https://github.com/github/gh-aw/actions/runs/31024666042)* · sonnet46 · 16.2 AIC · ⌖ 10.7 AIC · ⊞ 7.1K > Comment /matt to run again

@github-actions github-actions Bot 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.

Verdict: COMMENT — no blocking issues

Small, well-tested addition that injects GH_AW_ENGINE_VERSION following the exact same pattern as the existing applyEngineCwdEnv/GH_AW_ENGINE_CWD helper (nil-safe checks, same YAML env rendering path via appendEnvVarLine, which already handles escaping/newlines). Coverage includes literal version, GHA-expression version, and absent-version cases at both the helper unit-test level and the execution-step integration level.

Notes considered
  • No new injection surface: reuses FormatStepWithCommandAndEnv → appendEnvVarLine, the same trusted path used for Cwd.
  • No validation of Version format, but this matches existing Cwd/MaxTurns handling — consistent with current conventions, not a regression.
  • Docs (PR body) accurately describe scope; audit-log injection (GH_AW_INFO_VERSION) was already covered and correctly left untouched.
> 🔎 *Code quality review by [PR Code Quality Reviewer](https://github.com/github/gh-aw/actions/runs/31024666349)* · auto · 82.4 AIC · ⌖ 9.2 AIC · ⊞ 7.9K > Comment /review to run again

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

Copilot AI commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

@copilot update goose.md, crush.md, opencode.md, aider.com to declare their version in the front matter and use the version variable in the generate code

Implemented in 24883d0. The shared engine frontmatter now declares versions; Goose and Aider consume GH_AW_ENGINE_VERSION, while Crush and OpenCode use the declared engine version for generated npm installs. Recompiled lock files are included.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot please refresh this branch, address any remaining review feedback or failed checks, and run the pr-finisher skill before handing back for maintainer review.

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 5.24 AIC · ⌖ 9.9 AIC · ⊞ 8.3K · ◷
Comment /souschef to run again

Comment thread .github/workflows/shared/aider.md Outdated
python:
version: "3.12"
env:
GH_AW_ENGINE_VERSION: "0.86.2"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@copilot not needed since it is populated by the compiller

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed in 1bb6e43. The compiler now sets GH_AW_ENGINE_VERSION at agent-job scope, so the Aider pre-agent install receives it without an imported top-level env declaration.

@pelikhan

pelikhan commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

@copilot run pr-finisher skill

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI requested a review from pelikhan August 5, 2026 17:26
@pelikhan
pelikhan merged commit 9b24bbc into main Aug 5, 2026
30 checks passed
@pelikhan
pelikhan deleted the copilot/add-engine-version-support branch August 5, 2026 18:10
@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.85.4

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.

4 participants