Skip to content

Recover AWF release downloads through the assets API after HTTP 5xx - #76332

Closed
pelikhan wants to merge 3 commits into
mainfrom
pelikhan-reimagined-doodle
Closed

pelikhan wants to merge 3 commits into
mainfrom
pelikhan-reimagined-doodle

Conversation

@pelikhan

@pelikhan pelikhan commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

Why

Four workflows failed during AWF installation on November 9 because downloading v0.29.10's checksums.txt repeatedly returned HTTP 504. The same installer and release later succeeded without code changes, indicating a release-download-path availability failure rather than an invalid version pin. Representative failure: https://github.com/github/gh-aw/actions/runs/42580751881.

Approach

After the existing direct-download retries exhaust an HTTP 5xx response, try the public GitHub release-assets API with bounded retries. Resolve the exact pinned tag and require one numeric asset ID; keep API requests unauthenticated and HTTPS-only. Successful direct downloads and non-5xx failures retain their existing behavior.

Both paths retain the trusted manifest digest, release identity, payload checksum, and attestation checks. The fallback requires jq and fails explicitly if unavailable. It is a mitigation, not a guarantee against outages affecting both download paths.

Extend the isolated installer harness to cover 504 recovery across release assets, API failures and invalid metadata, rejected manifests/attestations, and no fallback for 401/403/404. Clear inherited job-environment/runtime variables in test subprocesses. Include a patch changeset.

Validation

  • bash actions/setup/sh/install_awf_binary_test.sh: 38 tests passed.
  • make agent-report-progress: passed, including build and action-shell lint. No Go changes, so impacted Go tests were skipped.
  • No workflow dispatches or reruns; recovery is validated with mocked transport failures, not a hosted outage reproduction.

Review note

The earlier security review identified a test-isolation gap, now fixed. Its required same-reviewer follow-up was unavailable because that reviewer invocation could not accept follow-up messages; no independent approval of the corrected harness is claimed. This draft is available for further review.

@pelikhan
pelikhan marked this pull request as ready for review November 9, 2026 22:48
Copilot AI adaptive review requested due to automatic review settings November 9, 2026 22:49
@github-actions

github-actions Bot commented Nov 9, 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.

Generated from PR Code Quality Reviewer · gpt56 · ~5 AIC · ⌖ ~2 AIC · ◇ ~1 AIC · ⊞ 1.6K · ◷

🔎 Code quality review by PR Code Quality Reviewer

@github-actions

github-actions Bot commented Nov 9, 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 · routed: haiku55 xhigh · ~1 AIC · ⌖ ~2 AIC · ◇ ~1 AIC · ⊞ 7.2K · ◷

🧪 Test quality analysis by Test Quality Sentinel

@github-actions

github-actions Bot commented Nov 9, 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.

Design Decision Gate 🏗️

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 Design Decision Gate 🏗️ · routed: haiku55 xhigh · ~1 AIC · ⌖ ~2 AIC · ◇ ~1 AIC · ⊞ 8.5K · ◷

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

github-actions Bot commented Nov 9, 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 from PR Specification Reviewer · gpt56 · ~3 AIC · ⌖ ~1 AIC · ◇ ~1 AIC · ⊞ 1.6K · ◷

Generated by PR Specification Reviewer for #76332

@github-actions

github-actions Bot commented Nov 9, 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 Nov 9, 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 · routed: gpt61 medium · ~4 AIC · ⌖ ~1 AIC · ◇ ~1 AIC · ⊞ 181 · ◷

Generated by Ponytail Reviewer for #76332

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (pr-code-quality-reviewer)
reviewed_at: 2026-11-09T22:52:16Z
review_event: REQUEST_CHANGES
top_themes: [unauthenticated GitHub API rate-limit exhaustion during fallback]
files_reviewed: [actions/setup/sh/install_awf_binary.sh, actions/setup/sh/install_awf_binary_test.sh, .changeset/patch-awf-release-api-fallback.md]
comment_count: 1

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 · ~5 AIC · ⌖ ~2 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.

Found one blocking reliability concern: the unauthenticated API fallback can exhaust GitHub API rate limits during the shared-runner outage scenario, because metadata is fetched repeatedly per asset. Please cache release metadata per install and/or use an available token safely, or otherwise make the rate-limit behavior explicit and robust. Static review only; no code or tests were executed per review policy.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~5 AIC · ⌖ ~2 AIC · ⊞ 1.6K
Comment /review to run again

Comment thread actions/setup/sh/install_awf_binary.sh Outdated
fi
# Public release metadata needs no token, including on enterprise runners.
if ! curl -fsSL "${options[@]}" --max-time 30 -H 'Accept: application/vnd.github+json' \
-o "${TEMP_DIR}/release.json" "https://api.github.com/repos/${AWF_REPO}/releases/tags/${AWF_VERSION}"; then

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.

This fallback re-fetches the release metadata for every asset and deliberately makes unauthenticated API requests. During a shared-runner 5xx incident, concurrent installs can exhaust api.github.com's 60-requests/hour/IP limit (and a single install can make multiple metadata calls), so the recovery path may fail precisely under the outage it is meant to mitigate. Please cache the metadata once per install and/or use an available GitHub token without logging it, or document/handle this rate-limit failure mode explicitly.

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.

Addressed in d41471b. Successful release metadata is cached once per install; multi-asset bundle and binary tests assert exactly one metadata request. Requests remain unauthenticated, with the shared-IP rate limit documented and explained in metadata-failure diagnostics.

@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, /diagnosing-bugs, and /codebase-design. No blocking issues; three small suggestions are posted inline.

📋 Key Themes & Highlights

Key Themes

  • Test gap: the new fallback depends on jq, but no test covers the jq-missing branch.
  • Error-path hygiene: a partial asset file can remain after a failed API transfer. verify_checksum still rejects it, so this is cleanup, not a security gap.
  • Rate limits: unauthenticated API calls share the 60 requests/hour limit, which can surface as a confusing 403.

Positive Highlights

  • ✅ Integrity stays anchored to the bundled CHECKSUMS_SHA256 pin, and the corrupt-manifest and unattested-bundle tests confirm that the API cannot bypass it.
  • ✅ Fallback is limited to HTTP 5xx with curl exit 22. 401, 403, and 404 do not trigger it, and tests cover that.
  • ✅ HTTPS-only, pinned tag, and an allowlisted URL check in the mock harness.
  • ✅ Verified locally: install_awf_binary_test.sh passes 38/38, and shellcheck -S warning is clean on both changed scripts.

@copilot please address the review comments above.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~8 AIC · ⌖ ~2 AIC · ⊞ 6.3K
Comment /matt to run again

download_release_asset_from_api() {
local asset="$1" asset_id
local -a options=(--proto '=https' --proto-redir '=https' --retry 2 --retry-max-time 30 --connect-timeout 15)
if ! command -v jq >/dev/null 2>&1; then

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 jq-missing branch (L170-173) has no test, but the 5xx fallback now depends on jq. Add a case that runs the installer with jq removed from PATH and asserts that the WARNING and the original HTTP 5xx diagnostics are reported and nothing is installed.

💡 Suggested test shape

In the harness, build a bin directory without jq (symlink only the tools the installer needs), point PATH at it for that run, and assert api_calls is 0 and the output contains both the WARNING and the original ERROR.

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

Addressed in d41471b. Added a restricted-PATH test with no jq that verifies zero API calls, the fallback warning, the jq prerequisite error, original HTTP 504/curl diagnostics, and no installed executable. All 41 installer tests pass.

awf-linux-*|awf-darwin-*) options+=(--speed-limit 1 --speed-time 60) ;;
*) options+=(--max-time 60) ;;
esac
if ! curl -fsSL "${options[@]}" -H 'Accept: application/octet-stream' \

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] If the asset transfer fails after a partial write, ${TEMP_DIR}/${asset} is left behind. verify_checksum would reject it, so this is not a security gap, but removing the partial file on failure keeps the error path deterministic.

💡 Suggested change
if ! curl ...; then
  rm -f "${TEMP_DIR}/${asset}"
  echo "ERROR: Release-assets API download failed for ${asset}." >&2
  return 1
fi

Add a test whose asset-download mock writes a partial file and then fails, and assert the file is absent afterwards.

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

Addressed in d41471b. Failed API asset transfers explicitly remove the output file. The partial-write regression test verifies removal before the EXIT trap cleans the staging directory; failed metadata transfers are also removed.

Comment thread actions/setup/sh/install_awf_binary.sh Outdated
return 1
fi
# Public release metadata needs no token, including on enterprise runners.
if ! curl -fsSL "${options[@]}" --max-time 30 -H 'Accept: application/vnd.github+json' \

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.

[/codebase-design] The metadata call is unauthenticated, so it shares GitHub's 60 requests/hour per-IP REST limit. On busy shared runners the fallback could fail with a 403 rate-limit, which then surfaces only as the original 5xx. Skipping the token for enterprise runners is a reasonable choice, but the fallback comment should name rate-limiting as a likely cause of a 403 here.

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

Addressed in d41471b. The fallback comment now identifies HTTP 403 as a possible shared-IP rate-limit failure (60 unauthenticated requests/hour/IP). Metadata-failure diagnostics explain the same limit, with regression coverage.

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

On runners with jq, the new API fallback request is rejected by the existing release-integrity mock and invalidates call-count assertions, breaking make test-scripts.

2 open issues
What changed in this PR

Improves AWF installation resilience in gh-aw’s setup action by recovering exhausted HTTP 5xx downloads through the public release-assets API while preserving existing integrity checks.

Changes:

  • Adds unauthenticated, HTTPS-only fallback requests for pinned release assets with bounded retries.
  • Extends installer tests for recovery, invalid metadata, integrity failures, and subprocess environment isolation.
  • Adds a patch-release changeset.
File Description
actions/​setup/​sh/​install_awf_binary.sh Adds the release-assets API fallback after exhausted HTTP 5xx failures.
actions/​setup/​sh/​install_awf_binary_test.sh Tests fallback behavior and rejection paths; isolates subprocess environment variables.
.changeset/​patch-awf-release-api-fallback.md Records the installer recovery improvement for a patch release.

Review effort: Max (auto)

fi
if [ "$curl_exit" -eq 22 ] && [[ "$http_status" =~ ^5[0-9]{2}$ ]]; then
echo "WARNING: Download of ${asset} returned HTTP ${http_status} after retries; trying the release-assets API." >&2
if download_release_asset_from_api "$asset"; then
Comment on lines +215 to +220
if [ "$curl_exit" -eq 22 ] && [[ "$http_status" =~ ^5[0-9]{2}$ ]]; then
echo "WARNING: Download of ${asset} returned HTTP ${http_status} after retries; trying the release-assets API." >&2
if download_release_asset_from_api "$asset"; then
return 0
fi
fi
@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 (actions/setup/sh/install_awf_binary.sh:176): address unresolved feedback - Review comment
  3. Review (actions/setup/sh/install_awf_binary.sh:170): address unresolved feedback - Review comment
  4. Review (actions/setup/sh/install_awf_binary.sh:190): address unresolved feedback - Review comment
  5. Review (actions/setup/sh/install_awf_binary.sh:175): 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": "779c5e2cca727dbf115de8611c3b294f8cba02ef",
  "kind": "requested",
  "schema_version": "1",
  "state": "cb1f69dbfc9dd8c0cd5c1f0b3aaa869e60f986ec413876f86b7e49eb6422bd57",
  "work": [
    "a6c94f4e8a278c24571eef08513808265f54a0d1c42fb6fe8fbdce0099ca7d24",
    "c08db61c5efd9ec3bc0a5886f3fbcf3d36e7b220844a1dc586d140ad80cf71f5",
    "e2dc90111c023b8ec6a7ea0b990cbe85610ac8f38aef74e076c5f694d382d608",
    "e466e4b76a68fda89d38a8861e0d912c85af023a41ecb3c4964dbcb293daaf0a"
  ],
  "workflow": "pr-sous-chef"
}

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

Copilot AI commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

@copilot

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

Updated from main using make merge-main (c4707b0) and addressed all four linked comments in d41471b. Both targeted shell harnesses and make agent-report-progress pass. Updated the coupled release-integrity API mock/counts. make test-scripts stops on unrelated USE-001 findings in three unchanged JavaScript files; CodeQL timed out. No PR merge, workflow dispatch, or CI rerun was performed.

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