Skip to content

Soften container pin update failure messages - #72093

Merged
pelikhan merged 6 commits into
mainfrom
fix/container-pin-update-info
Oct 26, 2026
Merged

pelikhan merged 6 commits into
mainfrom
fix/container-pin-update-info

Conversation

@dsyme

@dsyme dsyme commented Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Fixes #72081.

Replace the per-image warning block with one short informational message, for example:

i Container pins could not be updated: registry access denied (HTTP 403).
  • Distinguish registry authorization failures from unavailable Docker Buildx/crane resolvers, including a missing Buildx plugin.
  • Deduplicate causes across images; keep raw per-image diagnostics under DEBUG=cli:update_container_pins.
  • Preserve non-fatal update behavior, existing cached pins, and opt-in fatal resolution behavior.
  • Add regression tests, CLI reference documentation, and a patch changeset.

Validation

Passed:

  • make build
  • make fmt
  • go test ./pkg/cli -run 'Test(FetchContainerDigest|UpdateContainerPins)' -count=1
  • Full CLI lint: golangci-lint run --timeout=15m ./pkg/cli — zero issues
  • golangci-lint run --enable-only perfsprint ./pkg/cli
  • git diff --check
  • Impacted unit-test sampling and schema freshness in make agent-report-progress

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

dsyme and others added 2 commits October 26, 2026 12:56
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>
@dsyme
dsyme marked this pull request as ready for review October 26, 2026 13:11
Copilot AI max review requested due to automatic review settings October 26, 2026 13:12
@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Code Quality Reviewer completed the code quality review.

🔎 Code quality review by PR Code Quality Reviewer

@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

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

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer

@github-actions

github-actions Bot commented Oct 26, 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.

Generated from Test Quality Sentinel · sonnet50 · ~14 AIC · ⌖ ~16 AIC · ◇ ~7 AIC · ⊞ 12.6K · ◷

🧪 Test quality analysis by Test Quality Sentinel

@github-actions

github-actions Bot commented Oct 26, 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.

Commit pushed: ee53403

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

github-actions Bot commented Oct 26, 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 from Ponytail Reviewer · gpt56 · ~6 AIC · ⌖ ~6 AIC · ⊞ 14.8K · ◷

Generated by Ponytail Reviewer for #72093

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (pr-code-quality-reviewer)
reviewed_at: 2026-10-26T13:16:00Z
review_event: COMMENT
top_themes:
  - context cancellation is misclassified as registry failure
  - auth detection depends on exact CLI wording
files_reviewed:
  - pkg/cli/update_container_pins.go
  - pkg/cli/update_container_digest_test.go
  - pkg/cli/update_container_pins_test.go
  - docs/src/content/docs/setup/cli.md
comment_count: 2

Note

This comment is managed by comment memory.

Expand the saved memory block to view or edit the persistent context for this thread.
Edit only the text inside the backtick fences; workflow metadata and the footer are regenerated automatically.

Learn more about comment memory

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~3 AIC · ⌖ ~1 AIC · ⊞ 1.6K · ◷
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.

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

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

Copy link
Copy Markdown
Contributor

🏗️ Design Decision Gate — ADR Required

This PR makes significant changes to core business logic (140 new lines in pkg/), but it does not link an Architecture Decision Record (ADR).

📄 Draft ADR committed: docs/adr/72093-classified-info-summary-for-container-pin-failures.md. Review and complete it before merging.

The draft records this decision: fetchContainerDigest returns a typed containerDigestResolutionError with a short reason and the raw details. The possible reasons are 403, 401, resolvers unavailable, or a generic lookup failure. updateContainerPins removes duplicate reasons and prints them as one info line. Per-image diagnostics go only to the cli:update_container_pins debug log.

🔒 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. Check the Deciders field and the alternatives. Also check the trade-offs: the classification relies on matching error strings, and the default output no longer names the failing images.
  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-72093: Classified, Deduplicated Info Summary for Container Pin Resolution Failures

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

❓ Why ADRs Matter

ADRs 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 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 🏗️ · pi · opus55 · ~26 AIC · ⌖ ~41 AIC · ⊞ 1.9K · ◷
Comment /review to run again

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>

@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 /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-strategy switch on msg is 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 classified reason, 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 containerDigestResolutionError type replacing the old imageFailure struct — good simplification.
  • Deduplication of failure causes via a set + sliceutil.SortedKeys keeps 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

Comment thread pkg/cli/update_container_pins.go Outdated
case strings.Contains(msg, "403 Forbidden"):
reason = "registry access denied (HTTP 403)"
case strings.Contains(msg, "401 Unauthorized"):
reason = "registry authentication required (HTTP 401)"

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.

[/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.

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.

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.

Comment thread pkg/cli/update_container_pins.go Outdated
}

func (e *containerDigestResolutionError) Error() string {
return "could not resolve container digest without downloading image layers: " + e.details

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.

[/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.

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.

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"},

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.

[/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.

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.

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.

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

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

Comment thread pkg/cli/update_container_pins.go Resolved
Comment thread pkg/cli/update_container_pins.go Outdated
Comment on lines +338 to +341
case strings.Contains(msg, "403 Forbidden"):
reason = "registry access denied (HTTP 403)"
case strings.Contains(msg, "401 Unauthorized"):
reason = "registry authentication required (HTTP 401)"

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 categorization and crane-only UNAUTHORIZED coverage were already present in b84066c. Commit 6d5d4a0 adds explicit uppercase DENIED coverage, including crane-only execution and a missing-Buildx/crane-denial combination. Focused tests pass.

Comment thread pkg/cli/update_container_pins_test.go Outdated
Comment on lines +558 to +559
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")

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.

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())

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.

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.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot address the following outstanding work in one pass:

  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_container_pins.go:341): [/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. - Soften container pin update failure messages #72093 (comment)
  3. Review (pkg/cli/update_container_pins.go:31): [/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. - Soften container pin update failure messages #72093 (comment)
  4. Review (pkg/cli/update_container_digest_test.go:30): [/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. - Soften container pin update failure messages #72093 (comment)
  5. Review (pkg/cli/update_container_pins.go:334): Docker's missing-plugin diagnostic can be docker: unknown command: docker buildx, which matches neither substring here. If crane is also absent, this reports a registry lookup failure even though no resolver ran. Recognize this wording as unavailable Buildx and add it to TestFetchContainerDigestFailureReasons. - Soften container pin update failure messages #72093 (comment)
  6. Review (pkg/cli/update_container_pins.go:341): When Docker is unavailable and crane receives a structured registry error, it emits DENIED: ... or UNAUTHORIZED: ... without the HTTP status text checked here. Those access or authentication failures therefore fall through to registry metadata lookup failed. Recognize these registry error codes too, and cover the crane-only path in the regression tests. - Soften container pin update failure messages #72093 (comment)
  7. Review (pkg/cli/update_container_pins_test.go:559): With DEBUG=*, DEBUG=cli:*, or a debug-enabled CI rerun, logger output enters the capture and makes this exact comparison fail even when the summary is correct. Rendering expected after restoring stderr can also add terminal styling that was absent from the capture. Render the expectation inside the capture and make the assertion tolerate enabled debug loggers while still checking the single-line normal output. - Soften container pin update failure messages #72093 (comment)
  8. Review (pkg/cli/update_container_pins_test.go:560): cache still contains the pin set above, and ActionCache.Load() does not clear existing map entries or cached data when the file is missing. This assertion can therefore pass even if the persisted pin or the entire cache file is removed. Reload into a new ActionCache before checking pin preservation. - Soften container pin update failure messages #72093 (comment)
  9. Fix failing check impacted-go-tests (FAILURE): https://github.com/github/gh-aw/actions/runs/40330740388/job/121599404975.

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
Sous-chef work: 11f8dcf25e82cfef2f5a70a37256ce67a4124139c05832e00e89104e24b4181b 35b3957c05dfa206b16138a4aa570129022f3af211317e53560083d5cbb26482 3b21ec490edd8783de84a73be28d33e90de6516f50939babd8c8f051ff115442 42e5d572d9d75b7168fe7d0aeda0717cc07e65ed240f6d299e6fec661214f1ac 569a34bf277d841dd7a3f107934620aaf0b0f709edd41dcb3a4d4481c4538006 6cd93bec4bd65355fb15ef839d3da2120f5c7686debdf16c08a65bd31269c990 c5a9e2e906c2db52cc598b81754dd3cc55699d1a9d98caf70b271d5b7011fca0 eb3c086931d2f664e3a0a84083819fa33150715fd59affa839e91ed6cb384c71
Sous-chef state: d9760c9a6563b162d12059c4d2776dc0114628e2e190324ff7a6ca3c0613dbfb

Generated by 👨‍🍳 PR Sous Chef · pi · haiku45 · ~10 AIC · ⌖ ~15 AIC · ⊞ 1.1K · ◷
Comment /souschef to run again

Copilot AI and others added 2 commits October 26, 2026 14:47
…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>

Copilot AI commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

@copilot address the following outstanding work in one pass:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes....

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.

Copilot AI requested a review from gh-aw-bot October 26, 2026 15:05
@pelikhan
pelikhan merged commit 89a4ff4 into main Oct 26, 2026
36 checks passed
@pelikhan
pelikhan deleted the fix/container-pin-update-info branch October 26, 2026 16:28
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v1.0.1

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.

Summarize container pin update failures as one informational message

5 participants