Repository navigation
Soften container pin update failure messages - #72093
Conversation
Summarize failed container digest refreshes in one informational line, distinguish registry authorization from unavailable resolvers, and retain per-image debug diagnostics. Fixes #72081 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
✅ PR Code Quality Reviewer completed the code quality review.
|
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅
|
|
✅ Test Quality Sentinel completed test quality analysis. Test Quality SentinelOutcome: 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.
|
|
✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft. Commit pushed:
|
|
✅ Ponytail Reviewer completed successfully! Ponytail ReviewerOutcome: 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.
|
Comment MemoryPeek at saved memory (pr-code-quality-reviewer)Note This comment is managed by comment memory.Expand the saved memory block to view or edit the persistent context for this thread.
|
There was a problem hiding this comment.
Review: comment
Two correctness concerns are noted inline: cancellation is reported as a registry failure, and registry authorization detection is too dependent on exact CLI wording. Neither blocks merge by itself, but both reduce the reliability and actionability of the new failure summaries. Specialist pass completed; its findings were independently adjudicated.
🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~3 AIC · ⌖ ~1 AIC · ⊞ 1.6K
Comment /review to run again
🏗️ Design Decision Gate — ADR RequiredThis PR makes significant changes to core business logic (140 new lines in 📄 Draft ADR committed: The draft records this decision:
📋 What to do next
Once an ADR is linked in the PR body, this gate will re-run and check that the implementation matches the decision. ❓ Why ADRs MatterADRs create a searchable, permanent record of why the codebase looks the way it does. They help future contributors, including your future self. 📋 Michael Nygard ADR Format ReferenceAn ADR must contain these four sections to be considered complete:
All ADRs are stored in
|
Preserve cancellation and deadline errors, recognize standard registry authorization diagnostics from Docker and crane, and add focused regression tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /diagnosing-bugs and /tdd (per pr-triage classification: bug_fix). This is a well-scoped, well-tested softening of failure messaging — good use of a typed error, good dedup via sliceutil.SortedKeys, and solid new regression tests (TestFetchContainerDigestFailureReasons, TestUpdateContainerPins_FailureSummary).
📋 Key Themes & Highlights
Key Themes
- Reason-priority ambiguity (
update_container_pins.go~L334-341): the per-strategyswitchonmsgis last-write-wins when both buildx and crane fail with different matched causes (e.g. 403 then 401). No explicit priority is documented or tested for this case. - Diagnostic gap:
containerDigestResolutionError.Error()drops the classifiedreason, so the debug log (DEBUG=cli:update_container_pins) does not reveal when a failure was misclassified into the wrong bucket. - Test coverage gap: the new failure-reason test table only varies a single strategy output per case; no case stubs both docker and crane with distinct signals to pin down priority behavior.
Positive Highlights
- Clean, minimal
containerDigestResolutionErrortype replacing the oldimageFailurestruct — good simplification. - Deduplication of failure causes via a set +
sliceutil.SortedKeyskeeps output short and deterministic. - Good coverage of the Buildx-plugin-missing and unknown-buildx-command edge cases, which are easy to miss.
- Preserves existing cached pins and non-fatal behavior, matching the stated design goal.
None of these are blocking for the stated goal (softer messaging), but the priority-ambiguity point is a genuine latent bug risk worth closing before merge.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · sonnet50 · ~104 AIC · ⌖ ~15 AIC · ⊞ 10.2K
Comment /matt to run again
| case strings.Contains(msg, "403 Forbidden"): | ||
| reason = "registry access denied (HTTP 403)" | ||
| case strings.Contains(msg, "401 Unauthorized"): | ||
| reason = "registry authentication required (HTTP 401)" |
There was a problem hiding this comment.
[/tdd] The per-strategy reason assignment at lines 334-341 is last-write-wins across strategies (buildx then crane), so if buildx surfaces a specific cause (e.g. 403 Forbidden) and crane later fails for an unrelated reason that does not match either case, the earlier specific reason is silently kept — but if crane instead reports a different matched cause (e.g. 401 Unauthorized), it silently overwrites the first one with no priority rule. This is an untested branch.
💡 Suggested fix
Add an explicit priority (e.g. keep the first non-default reason found, or rank 403 > 401 > generic) and add a regression test in TestFetchContainerDigestFailureReasons with two different real signals across strategies (buildx=403, crane=401) asserting which reason wins. Without this, a future refactor could silently flip the reported reason and nobody would notice.
@copilot please address this.
There was a problem hiding this comment.
Fixed in 6d5d4a0. Resolver preference now explicitly preserves the first authorization cause, while allowing a later authorization cause to replace the generic fallback. Regression tests cover both 403/401 orders and mixed generic/authorization failures.
| } | ||
|
|
||
| func (e *containerDigestResolutionError) Error() string { | ||
| return "could not resolve container digest without downloading image layers: " + e.details |
There was a problem hiding this comment.
[/diagnosing-bugs] Error() only returns the preamble + raw details, never the categorized reason. The debug log at line 168 (containerPinsLog.Printf("Failed to resolve digest for %s: %v", image, resolveErr)) therefore never surfaces why an image was bucketed into "registry access denied" vs "tools unavailable" vs "metadata lookup failed" — only the raw strategy text.
💡 Why this matters
The PR promises raw per-image diagnostics under DEBUG=cli:update_container_pins to help diagnose misclassification, but the reason bucket itself (most likely source of error) is never logged. If the 403/401 substring matching misfires for an image, there is no way to see that from the debug log without reading source.
Suggest including e.reason in Error(), e.g. fmt.Sprintf("could not resolve container digest without downloading image layers (%s): %s", e.reason, e.details).
@copilot please address this.
There was a problem hiding this comment.
Fixed in 6d5d4a0. Error() now includes the selected category alongside the complete raw strategy diagnostics. Regression assertions verify both are retained.
| {"network failure", "dial tcp: connection refused", "registry metadata lookup failed"}, | ||
| {"tools missing", "", "Docker Buildx and crane are unavailable"}, | ||
| {"buildx plugin missing", "docker: 'buildx' is not a docker command.", "Docker Buildx and crane are unavailable"}, | ||
| {"unknown buildx command", `unknown command "buildx" for "docker"`, "Docker Buildx and crane are unavailable"}, |
There was a problem hiding this comment.
[/tdd] This test table only exercises scenarios where both strategies fail with the same category of error (or where the failing output is empty). It never covers mixed-signal cases, e.g. buildx reports 403 but crane reports 401, or buildx is unavailable while crane reports 403 — which is exactly the ambiguous priority case flagged in update_container_pins.go. Add a case with distinct outputs for each strategy.
💡 Suggested addition
Add a fixture that stubs docker to fail with one signal and a crane stub (also injected into PATH) to fail with a different signal, then assert which reason wins so the priority behavior is pinned down by a test rather than left implicit.
@copilot please address this.
There was a problem hiding this comment.
Fixed in 6d5d4a0. Added distinct Docker/crane outputs for 403→401, 401→403, authorization/network failures in both orders, and unavailable Buildx→crane DENIED. All focused resolver tests pass.
There was a problem hiding this comment.
🟡 Changes recommended
Supported resolver failure formats remain misclassified, so the requested behavior is not yet reliable.
4 open issues
What changed in this PR
This PR makes container pin update failures less noisy in gh aw update, while preserving best-effort updates and cached pins.
Changes:
- Replace repeated warnings with one informational summary, keeping detailed diagnostics in debug logs.
- Distinguish registry authorization failures from unavailable resolvers.
- Add regression tests, CLI documentation, and a patch changeset.
| File | Description |
|---|---|
pkg/cli/update_container_pins.go |
Summarizes failures and classifies resolver errors. |
pkg/cli/update_container_pins_test.go |
Tests summary output and cached-pin preservation. |
pkg/cli/update_container_digest_test.go |
Tests failure causes and diagnostic retention. |
docs/src/content/docs/setup/cli.md |
Documents best-effort updates and debug logging. |
.changeset/fix-container-pin-update-info.md |
Records the user-facing reporting change. |
Review effort: Max
| case strings.Contains(msg, "403 Forbidden"): | ||
| reason = "registry access denied (HTTP 403)" | ||
| case strings.Contains(msg, "401 Unauthorized"): | ||
| reason = "registry authentication required (HTTP 401)" |
| expected := console.FormatInfoMessage("Container pins could not be updated: " + tc.reason + ".") | ||
| assert.Equal(t, strings.TrimSpace(expected), strings.TrimSpace(output), "emit exactly one informational line without per-image diagnostics") |
There was a problem hiding this comment.
Fixed in 6d5d4a0. The expectation is rendered inside stderr capture; recognized debug records are filtered before an exact single-line normal-output comparison. Interruption assertions use the same filtering. Tests pass with DEBUG=, DEBUG=cli:, and ACTIONS_RUNNER_DEBUG=true.
| }) | ||
| expected := console.FormatInfoMessage("Container pins could not be updated: " + tc.reason + ".") | ||
| assert.Equal(t, strings.TrimSpace(expected), strings.TrimSpace(output), "emit exactly one informational line without per-image diagnostics") | ||
| require.NoError(t, cache.Load()) |
There was a problem hiding this comment.
Fixed in 6d5d4a0. The preservation assertion now loads a fresh ActionCache instance before checking the persisted pin, so a stale in-memory pin cannot satisfy it.
|
@copilot address the following outstanding work in one pass:
Push the necessary fixes, reply to each listed review thread and resolve it when addressed. Ignore feedback already answered or resolved. Use the pr-finisher skill and stop when only human review or CI remains; do not trigger CI. Sous-chef head: b84066c
|
…ate-info Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Pushed merge a3e055d and fixes 6d5d4a0. Addressed all seven listed review threads and replied individually. The prior impacted-go CI failure is fixed by retaining ShellCheck stderr details alongside invocation errors; its regression now passes. Full lint, build/format, focused tests (normal and all requested debug modes), and the final gate’s sampled tests pass. Remaining pre-existing local failures: custom function-length/slice-index findings and TestFetchAndSaveRemoteFrontmatterImports_SectionStrippedDedup in the broader impacted-package run. Secret scan is clean; CodeQL found no Actions alerts and skipped Go analysis due database size. Thread resolution is not supported by the available tools. No CI was triggered; maintainer thread resolution and fresh CI remain. |
|
🎉 This pull request is included in a new release. Release: |

Summary
Fixes #72081.
Replace the per-image warning block with one short informational message, for example:
DEBUG=cli:update_container_pins.Validation
Passed:
make buildmake fmtgo test ./pkg/cli -run 'Test(FetchContainerDigest|UpdateContainerPins)' -count=1golangci-lint run --timeout=15m ./pkg/cli— zero issuesgolangci-lint run --enable-only perfsprint ./pkg/cligit diff --checkmake agent-report-progressLocal environment and existing findings
The original global linter was built with Go 1.26 and could not load this repository. At the user request, rebuilt and globally installed the repository-pinned golangci-lint v2.15.0 with Go 1.27.3. Full CLI lint subsequently passed with an increased local timeout; no repository timeout setting was changed.
The aggregate local custom-linter gate still reports pre-existing function-length and slice-index findings in the touched production file. Verified the flagged indexing expressions already exist on
origin/main; unrelated refactoring is intentionally excluded. CI checks are running.