Skip to content

fix(toolchain): avoid expired GitHub download redirects and retain errors - #8456

Merged
mohanchen merged 3 commits into
deepmodeling:developfrom
cheerly-pku:fix/toolchain-download-diagnostics
Dec 2, 2026
Merged

mohanchen merged 3 commits into
deepmodeling:developfrom
cheerly-pku:fix/toolchain-download-diagnostics

Conversation

@cheerly-pku

@cheerly-pku cheerly-pku commented Dec 1, 2026 •

Copy link
Copy Markdown

Dependency setup failed before compilation in #8454 and #8264. Wget's quiet mode hid the cause and the installer mislabeled every failure as a certificate error. With diagnostics enabled, the first hosted run of this PR exposed the actual failure: a stale GitHub 302 redirect followed by HTTP 618 jwt:expired from the release-asset server. The redirect Date was about eleven minutes older than the request; its signed download token had expired. Those logs do not identify which cache served the stale redirect.

The download helper now adds a fresh query parameter to canonical GitHub release entry points, preserving existing query parameters and leaving the signed target URL untouched. This avoids cached redirects whose short-lived tokens have expired. General requests also send cache-revalidation headers. Local archive reuse and SHA256 checks remain unchanged.

Revalidation headers alone were tested in f7f543f6d and proved insufficient: this Intel job still received 618 jwt:expired. The fresh entry-point cache key in 9b19695a0 addresses that observed limitation.

The helper keeps Wget errors/HTTP headers and its final exit code, and allows three attempts for transient network errors and HTTP 429/500/502/503/504. DNS/connect/idle-read waits are limited to 30 seconds each, with retry backoff capped at two seconds. These are per-operation limits, not a whole-download deadline. HTTP 404 remains an immediate failure.

Behavior and scope

  • Existing strict, smart, and skip certificate policies remain available. Only Wget exit 5 (certificate verification failure) triggers the existing smart fallback; network/HTTP failures no longer weaken TLS verification or get mislabeled as certificate errors.
  • Exhausted downloads remove the partial file and return the Wget failure status, also in pack mode. Checksum validation remains mandatory; a mismatch removes the file and fails.
  • Add real-Wget tests against local HTTP/HTTPS fault servers, run as a required step before the existing pre-commit action. Tests need no external download service. The README documents the behavior and test dependencies.
  • No solver, numerical thresholds, package versions, download origins, INPUT or application references change. This is separate from ci: retry transient APT downloads and stop on index failures #8453, which changes APT behavior.

Verification

All 13 regression tests passed with GNU Wget 1.21.4:

python3 toolchain/tests/test_download.py
bash -n toolchain/scripts/tool_kit.sh
python3 tools/03_code_analysis/agent_governance_check.py --staged --format text
git diff --cached --check

A GitHub-entry-point test models a cache that ignores revalidation headers: the ordinary URL fails with HTTP 618, while fresh query keys succeed and preserve existing parameters. A second cached-redirect test first confirms that ordinary Wget receives HTTP 618, then verifies that the modified helper requests a fresh redirect and downloads the checksum-valid archive. The other tests exercise transient 429/500/502/503/504 recovery, persistent 503 exhaustion, 404 without retries under all three policies and pack mode, connection refusal, a real 30-second read timeout followed by recovery, checksum rejection, trusted HTTPS, strict rejection of a self-signed certificate, smart fallback and explicit skip. They verify that failure prevents the next installation command. Wget 1.21.4 returns exit 4 when retryable HTTP errors exhaust the retry budget; response headers preserve the HTTP cause.

Both actual DFT-D4 4.3.0 and nlohmann-json 3.12.0 archives were downloaded with the final 9b19695a0 helper in strict mode and passed the repository's SHA256 checks. The intermediate no-cache-only probe had a network failure on nlohmann-json; its failed log is retained. Hosted integration verification of the final patch is pending.

Actionlint v1.7.12 passed for the changed workflow (ShellCheck/Pyflakes integrations disabled). Bash syntax, whitespace and staged governance checks passed; shfmt was run with the repository's two-space/case indentation and space-redirect style. Full ABACUS builds were not repeated locally for this shell-only runtime change; hosted checks will provide integration coverage.

Remaining limits

Retries cannot guarantee recovery from persistent outages or arbitrary intermediary behavior. The GitHub-specific fresh query key changes each download invocation, not each internal Wget retry. Smart mode still permits an unverified TLS fallback specifically for certificate errors, as before; strict mode avoids that fallback. The old silent runs cannot be retroactively diagnosed individually; the new CI logs directly establish the expired-token failure for the reproduced nlohmann-json downloads.

Governance notes

Linked issue: observed in #8454 and #8264; no separate issue. INPUT changes: none. Core-module impact: none. Exceptions requested: none.

@cheerly-pku cheerly-pku changed the title fix(toolchain): retain download errors and retry transient failures fix(toolchain): refresh cached download redirects and retain errors Dec 1, 2026
@cheerly-pku cheerly-pku changed the title fix(toolchain): refresh cached download redirects and retain errors fix(toolchain): avoid expired GitHub download redirects and retain errors Dec 1, 2026
@mohanchen
mohanchen requested a review from Critsium-xy December 1, 2026 07:40
@mohanchen mohanchen added Refactor Refactor ABACUS codes Compile & CICD & Docs & Dependencies Issues related to compiling ABACUS labels Dec 1, 2026

@ABACUS-PR-BOT ABACUS-PR-BOT left a comment

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.

Static inspection of 9b19695 found no actionable defect in the downloader status propagation, TLS fallback, retry/cache handling or the inspected installer path. Live redirect recovery and the test outcomes remain unverified.

Static review only; no builds or runtime tests were run.

@mohanchen
mohanchen merged commit a8fc8c0 into deepmodeling:develop Dec 2, 2026
26 checks passed
cheerly-pku added a commit to cheerly-pku/abacus-develop that referenced this pull request Dec 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Compile & CICD & Docs & Dependencies Issues related to compiling ABACUS Refactor Refactor ABACUS codes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants