Skip to content

Pin setup action and built-in containers to compiler version on update - #78311

Merged
pelikhan merged 4 commits into
mainfrom
pelikhan/pin-setup-action-to-compiler-version
Nov 16, 2026
Merged

pelikhan merged 4 commits into
mainfrom
pelikhan/pin-setup-action-to-compiler-version

Conversation

@pelikhan

@pelikhan pelikhan commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

ADR: ADR-78311: Pin Setup Action and Built-in Containers to Compiler Version

github/gh-aw-actions/setup and the compiler's built-in containers are gh-aw's supporting runtime, so they must match the compiler that generated the lock files. Before this change, gh aw update / upgrade treated them like any other dependency. The setup action moved to the latest release, which could differ from the CLI version. Built-in images were re-resolved from the registry, which caused churn such as unrelated digest re-pins on every update.

Approach

  • Setup action: new helpers in update_actions_deps.go (compilerPinnedActionTag, resolveActionUpdateTarget) resolve the target to exactly the running compiler release tag and its SHA. Both the actions-lock.json updater and the markdown uses: ref updater use them. Pinned entries skip the latest-release lookup, the native-action cap, and downgrade prevention, so they move up or down to the compiler version, even with --no-release-bump. Dev builds (non-release versions) keep the existing behavior.
  • Built-in containers: updateContainerPins recognizes compiler-injected images (gh-aw-firewall/*, gh-aw-mcpg, gh-aw-router, gh-aw-node, github-mcp-server). For these images it uses the compiler's embedded pins (actionpins.GetContainerPin) instead of fetching from the registry. If an image has no embedded pin, it falls back to registry resolution.
  • compile --force-refresh-container-pins sets a new refreshBuiltins option, so the trusted pins in this repo can still be refreshed from the registry (used by daily-squid-image-scan).

Tests

  • New end-to-end test TestUpdate_CompileThenUpdateKeepsCompilerPinnedArtifactsConsistent:
    • Compiles a workflow, then runs the update passes in RunUpdateWorkflows order against stubs that report a newer setup release and drifted image digests, then recompiles.
    • Asserts the lock file is byte-identical to the first compile and that built-in images are never fetched.
    • Confirmed it fails when the new pinning logic is disabled.
  • Focused unit tests for lockfile pinning (older lock, lock newer than compiler, --no-release-bump), markdown ref pinning, and built-in container handling, including refreshBuiltins.
  • pkg/cli has existing failures that also fail on main locally (graders, yamllint, fix dry-run, manifest, and path-related tests). They are unrelated to this change.

Notes for reviewers

The new test found an unrelated existing inconsistency: compiling with an explicit --dir emits GH_AW_ACTION_FAILURE_ISSUE_EXPIRES_HOURS: "168", while the default dir emits "0". This comes from the config.WorkflowDir == "" guard in compile_pipeline.go. This PR does not fix it. The test uses the default dir, as gh aw update does.

Docs: updated the update section of docs/src/content/docs/setup/cli.md.

…e/upgrade

gh aw update/upgrade now pins github/gh-aw-actions/setup to exactly the
running compiler release (up or down, regardless of --no-release-bump) in
both actions-lock.json and workflow markdown refs, and keeps compiler
built-in container images (firewall, MCP gateway, router, gh-aw-node,
GitHub MCP server) on the compiler's embedded digest pins instead of
re-resolving them from the registry. compile --force-refresh-container-pins
still re-resolves built-ins from the registry.

Adds an end-to-end test that compiles a workflow, runs the update passes
against stubbed newer releases and drifted digests, recompiles, and
asserts the lock file is unchanged.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@pelikhan
pelikhan marked this pull request as ready for review November 16, 2026 07:51
Copilot AI adaptive review requested due to automatic review settings November 16, 2026 07:51
@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft.

🏗️ ADR gate enforced by Design Decision Gate 🏗️ · pi · routed: haiku55 xhigh · ~3 AIC · ⌖ ~2 AIC · ⊞ 8.6K · ◷

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Specification Reviewer completed successfully!

PR Specification Reviewer

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated by PR Specification Reviewer for #78311 · copilot · gpt56 · ~1 AIC · ⌖ ~1 AIC · ⊞ 1.6K · ◷

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

✅ Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

🧪 Test quality analysis by Test Quality Sentinel · copilot · routed: haiku55 xhigh · ~1 AIC · ⌖ ~2 AIC · ⊞ 7.2K · ◷

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Ponytail Reviewer

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated by Ponytail Reviewer for #78311 · codex · routed: gpt61 medium · ~6 AIC · ⌖ ~1 AIC · ⊞ 185 · ◷

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Code Quality Reviewer completed the code quality review.

PR Code Quality Reviewer

Outcome: reported_action

The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt56 · ~4 AIC · ⌖ ~1 AIC · ⊞ 1.5K · ◷

The new compile-then-update test used helpers that only exist in
!integration test files, breaking the integration/harbor test build.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

@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.

Found one correctness issue: compiler pinning is enabled for semver-shaped versions even when the binary is marked as a non-release build. This can make dev/local builds pin the setup action to an unsupported compiler tag; see the inline comment on update_actions_deps.go:48.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~4 AIC · ⌖ ~1 AIC · ⊞ 1.5K
Comment /review to run again

Comment thread pkg/cli/update_actions_deps.go Resolved
@github-actions

Copy link
Copy Markdown
Contributor

Warning

The push_to_pull_request_branch operation was skipped: Cannot push to pull request branch: bundle modifies files outside the allowed-files list (pkg/cli/update_compile_test.go). Add the files to the allowed-files configuration field or remove them from the bundle.. The code changes were not applied.

🏗️ Design Decision Gate — ADR Required

This PR makes significant changes to core business logic (>100 new lines) but does not have a linked Architecture Decision Record (ADR).

📄 Draft ADR committed: docs/adr/78311-pin-setup-action-to-compiler-version.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 couldn't infer, refine the decision rationale, and list real alternatives you considered. Confirm the draft note that it narrows ADR-26827 for the setup action: the setup action now moves to the exact compiler version and bypasses the native-action cap and downgrade guard.

  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-78311: Pin Setup Action and Built-in Containers to Compiler Version (link unavailable: invalid HTTPS URL)

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

❓ Why ADRs Matter

"AI made me procrastinate on key design decisions. Because refactoring was cheap, I could always say 'I'll deal with this later.' Deferring decisions corroded my ability to think clearly."

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 (e.g., 0042-use-postgresql.md for PR #42).

🏗️ ADR gate enforced by Design Decision Gate 🏗️ · pi · routed: haiku55 xhigh · ~3 AIC · ⌖ ~2 AIC · ⊞ 8.6K · ◷
Comment /review to run again

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (review-history)
{"id":"ldg-1b0558ab-d176-47fe-9a64-18d36881b7e6","parents":[],"payload":{"id":"ldg-1331f237-546a-428b-98f5-cf273c7a0b9f","operation":"append","value":{"finding_count":1,"head_sha":"1e2ea7de48dddc37022127bbfbcafcc9920438f7","outcome":"findings"}},"sha":"sha256:b3e587ddd54b3361988f4cd0fc59e21f170c3bcdf3cf83839f4efb317cf7e989","timestamp":"2026-11-16T07:59:52.048Z","type":"ledger_append","version":1}
History

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@pelikhan

Copy link
Copy Markdown
Collaborator Author

Addressing the top-level bot comments:

  • Design Decision Gate (6910763259): Accepted. The bot's push was skipped, so the ADR was authored directly as docs/adr/78311-pin-setup-action-to-compiler-version.md (4fba8ac). It records that release builds pin the setup action to the exact compiler version (narrowing ADR-26827 for setup only) and that built-in containers use the compiler's embedded digest pins, with the alternatives considered. The PR body now links ADR-78311.
  • Design Decision Gate status (6910640820), PR Specification Reviewer (6910641301), Test Quality Sentinel (6910642130), Ponytail Reviewer (6910642610), PR Code Quality Reviewer (6910644064), Comment Memory (6910768792): status and ledger comments with no requested changes. The one code-quality finding was the inline review comment on update_actions_deps.go, which is now fixed and resolved.

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.

🟡 Changes recommended

Release detection misclassifies development and prerelease builds, while API-only tag lookup bypasses the Git fallback for authentication failures, risking incorrect or unchanged setup action references.

2 open issues
What changed in this PR

Keeps gh-aw’s supporting runtime aligned with the compiler during gh aw update and upgrade, reducing setup-action version drift and container digest churn.

Changes:

  • Pin setup action references to the running compiler’s release tag.
  • Reuse bundled pins for built-in containers while preserving explicit registry refreshes.
  • Add consistency tests and document the updated pinning behavior.
File Description
pkg/​cli/​update_container_pins.go Identifies built-in images and applies embedded compiler pins.
pkg/​cli/​update_container_pins_test.go Tests built-in image detection, bundled pins, and registry refresh overrides.
pkg/​cli/​update_compile_test.go Adds compile/update consistency coverage for runtime artifacts.
pkg/​cli/​update_actions_lockfile.go Applies compiler-specific setup pinning to the action cache.
pkg/​cli/​update_actions_lockfile_test.go Covers older and newer setup locks and disabled release bumps.
pkg/​cli/​update_actions_deps.go Adds shared compiler-tag classification and action resolution helpers.
pkg/​cli/​update_actions_content_refs.go Applies compiler pinning to workflow uses: references.
pkg/​cli/​update_actions_content_refs_test.go Tests setup tag and SHA updates with release bumps disabled.
pkg/​cli/​compile_orchestrator.go Enables registry refreshes for built-ins when explicitly requested.
docs/​src/​content/​docs/​setup/​cli.md Documents setup-action and built-in container pinning.

Review effort: Max (dynamic)

Comment thread pkg/cli/update_actions_deps.go Outdated
// (e.g. "v0.68.3"), or "" for dev, dirty, or otherwise non-release builds.
func compilerReleaseTag() string {
version := GetVersion()
if strings.Contains(version, "-") || parseVersion(version) == nil {

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.

Implemented in 6b1c2df: release builds now pin valid prerelease compiler tags, while non-release builds retain the regular update policy. The pinning tests explicitly set and restore release mode.

Comment on lines +71 to +73
sha, err := deps.getActionSHAForTag(ctx, gitutil.ExtractBaseRepo(repo), tag)
if err != nil {
return "", "", fmt.Errorf("cannot resolve SHA for compiler version %s: %w", tag, err)

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.

Implemented in 6b1c2df: compiler-tag SHA resolution now falls back to git ls-remote on API authentication errors, selecting the exact tag and using peeled commit SHAs for annotated tags.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot

🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes.
  2. Review (pkg/cli/update_actions_deps.go:48): address unresolved feedback - Review comment
  3. Review (pkg/cli/update_actions_deps.go:73): address unresolved feedback - Review comment

Keeping the changes focused; human review and CI get the final taste test. No merging or CI triggering.

Structured data
{
  "completed_task": 0,
  "head": "4fba8ac38ba55246757383452edf8c44a77b528d",
  "kind": "requested",
  "schema_version": "1",
  "state": "1afe15a9c02b5425d0546e04ab2cd9bf4b7208854f0509940814c0920f793976",
  "work": [
    "415657ba8aa6956f36657e40c09fe3cb794b691c38deaeff5e3a34c98f76ad13",
    "e82111ded5de46de7bab38e5c41d19dfe0d8466bb2b6fcd5cb1a26ac0e558521"
  ],
  "workflow": "pr-sous-chef"
}

Generated by 👨🍳 PR Sous Chef · pi · routed: haiku55 xhigh · ~2 AIC · ⌖ ~2 AIC · ⊞ 7K · ◷
Comment /souschef to run again

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor

Category: bug
Risk: medium
Total score: 55/100
Score breakdown: impact 30 + urgency 16 + quality 9 = 55
Recommended action: batch_review
Batch: none

Generated by 🔧 PR Triage Agent · copilot · mai11 · ~6 AIC · ⌖ ~2 AIC · ⊞ 15.3K · ◷

@pelikhan
pelikhan merged commit 6fcef58 into main Nov 16, 2026
70 checks passed
@pelikhan
pelikhan deleted the pelikhan/pin-setup-action-to-compiler-version branch November 16, 2026 15:13
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v1.3.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants