Skip to content

CI: retry an ESP32 build whose ESP-IDF component fetch fails - #12375

Merged
jp-bennett merged 1 commit into
developfrom
claude/esp32-idf-fetch-retry
Nov 14, 2026
Merged

jp-bennett merged 1 commit into
developfrom
claude/esp32-idf-fetch-retry

Conversation

@jp-bennett

@jp-bennett jp-bennett commented Nov 14, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

ESP32 builds intermittently fail at CMake configure, before anything is compiled. Recent examples are chatter2 in run 43558959379, and heltec-vision-master-e213-inkhud and t-deck-tft on #12047. The error:

ERROR: 'git --git-dir=/root/.cache/Espressif/ComponentManager/b_git_a38114cd fetch origin' failed with exit code 128
fatal: unable to access 'https://github.com/espressif/esp32-arduino-lib-builder.git/': Recv failure: Connection reset by peer

pioarduino's IDF-libs pass builds a dummy project whose idf_component.yml (builder/build_lib/ in platform 55.03.312-1) requires espressif/fb_gfx from esp32-arduino-lib-builder at version: "master". ESP-IDF's component manager (idf_component_tools/git_client.py, 2.4.11) runs git fetch origin on its cached repo on every build, unless FETCH_HEAD is less than a minute old. Pinning a commit or providing a lock file doesn't avoid it; I checked both locally with git's network disabled. The component manager also has no retry or offline setting. #12360 added retries to pio pkg install for the other architectures, but left this fetch alone because it happens inside pio run.

Change

bin/build-esp32.sh reruns pio run when, and only when, its output contains that fetch failure. It retries up to ESP32_IDF_FETCH_ATTEMPTS times (default 3), waiting 15 s, then 30 s. CMake wraps the message across lines, so the match folds whitespace first. Any other failure exits at once with pio's own status. A rerun after the failed configure starts the IDF-libs pass again, because esp32_pre.py already drops the sdkconfig.defaults that an aborted pass leaves behind.

The fetch still happens on every build, so fb_gfx keeps resolving from upstream master. Only a reset connection is retried.

Testing

I ran bin/build-esp32.sh with a stub pio that replays the error block from the failed chatter2 job:

Stub pio sequence Runs Result
success 1 continues to the copy step
fetch failure, then success 2 logs one retry, continues
other error 1 exits with that status, no retry
fetch failure every time 3 gives up, exits with pio's status
fetch failure, then success, with pipefail inherited 2 same as without
ESP32_IDF_FETCH_ATTEMPTS = 0, -1, abc 0 exits 2 before building

The raw CI log doesn't match the pattern until whitespace is folded, which confirms the folding is needed.

🤝 Attestations

  • I have tested that my proposed changes behave as described.
  • I have tested that my proposed changes do not cause any obvious regressions on the following devices:
    • Heltec (Lora32) V3
    • LilyGo T-Deck
    • LilyGo T-Beam
    • RAK WisBlock 4631
    • Seeed Studio T-1000E tracker card
    • Other (please specify below)

This is a CI script change with no firmware change. The ESP32 builds in this PR's CI run through the new loop.


Generated by Claude Code

Summary by CodeRabbit

  • Chores
    • ESP32 builds now automatically retry when fetching ESP-IDF components fails, with increasing delays between attempts. Other build failures continue to stop immediately. The retry count is configurable, defaults to three attempts, and invalid settings are reported as errors.

ESP32 builds fail at CMake configure, before anything is compiled, when
GitHub resets one git fetch:

    ERROR: 'git --git-dir=/root/.cache/Espressif/ComponentManager/b_git_a38114cd
    fetch origin' failed with exit code 128
    fatal: unable to access
    'https://github.com/espressif/esp32-arduino-lib-builder.git/': Recv
    failure: Connection reset by peer

pioarduino's IDF-libs pass builds a dummy project whose idf_component.yml
(builder/build_lib/ in platform 55.03.312-1) requires espressif/fb_gfx from
esp32-arduino-lib-builder at version "master". ESP-IDF's component manager
(idf_component_tools/git_client.py, 2.4.11) runs `git fetch origin` on its
cached bare repo every time unless FETCH_HEAD is under a minute old; pinning
a commit or providing a lock file does not avoid it, and it has no retry or
offline setting. The CI image already holds that cache, so the fetch only
re-resolves master, but every ESP32 job depends on it succeeding.

#12360 retries `pio pkg install` for the other architectures and leaves this
fetch alone because it happens inside `pio run`. build-esp32.sh now reruns
`pio run` when, and only when, its output carries that fetch failure (CMake
wraps the message across lines, so the match folds whitespace first), up to
ESP32_IDF_FETCH_ATTEMPTS times (default 3) with 15 s, 30 s backoff. Any other
failure exits at once with pio's own status. A rerun after the failed
configure starts the IDF-libs pass again: esp32_pre.py already drops the
sdkconfig.defaults an aborted pass leaves behind.

Tested with a stub pio replaying the error block from a failed CI job
(chatter2, run 43558959379): fetch failure then success runs twice and
continues; another error runs once and fails with its status; the fetch
failure every time gives up after 3 runs; an inherited pipefail does not
change that; 0, -1 and "abc" for the attempt count exit 2 before building.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011C7D9bnioSkAoyRPicEV1C
@jp-bennett jp-bennett added the github_actions Pull requests that update GitHub Actions code label Nov 14, 2026 — with Claude
@github-actions

Copy link
Copy Markdown
Contributor

⚡ Try this PR in the Web Flasher

Note

Building this pull request… the flash button, badges and supported-board
list will appear here automatically once CI finishes.

@coderabbitai

coderabbitai Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The ESP32 build script now retries component-fetch failures up to a configurable attempt limit. It validates the limit, preserves the build status for non-retryable or final failures, and increases the delay between attempts.

Changes: ESP32 build retry behavior

Layer / File(s) Summary
Validate and retry ESP32 builds
bin/build-esp32.sh
The script defaults ESP32_IDF_FETCH_ATTEMPTS to 3 and exits with status 2 if the value is not a positive integer. It retries failures only when captured output matches the component-fetch error and attempts remain. Retry delays increase by 15 seconds per attempt.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: vidplace7

Merge Risk: Minimal · up to b1621

The ESP32 build script now retries transient component-fetch failures with increasing delays and fails fast on other errors. The change is limited to build tooling, and a missed match falls back to the previous failure behavior, so merge risk is minimal.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "CI: retry an ESP32 build whose ESP-IDF component fetch fails" names the main change: the ESP32 build script now retries a build when the ESP-IDF component fetch fails. It matches the raw su…
Description check Passed The description covers the required intent and testing. It explains the problem, the change to bin/build-esp32.sh, the retry limits and delays, and the matching behavior. It includes a testing table a…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "CI: retry an ESP32 build whose ESP-IDF component fetch fails" names the main change: the ESP32 build script now retries a build when the ESP-IDF component fetch fails. It matches the raw summary and the PR objectives. The title is specific and concise, and it follows the conventional prefix style.

Full details: Description check

Explanation

The description covers the required intent and testing. It explains the problem, the change to bin/build-esp32.sh, the retry limits and delays, and the matching behavior. It includes a testing table and marks the testing attestation. It does not complete the device regression checklist, and it does not state a device-specific reason for leaving those boxes unchecked. The template's optional tips were removed, which is acceptable. The description is mostly complete.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between d062220 and b162104.

Files selected for processing: 1

  • bin/build-esp32.sh

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

@jp-bennett
jp-bennett requested a review from vidplace7 November 14, 2026 15:50
@github-actions

Copy link
Copy Markdown
Contributor

@jp-bennett

Copy link
Copy Markdown
Collaborator Author

It worked on this CI run, merging it.

@jp-bennett
jp-bennett added this pull request to the merge queue Nov 14, 2026
Merged via the queue into develop with commit 564ea89 Nov 14, 2026
103 of 104 checks passed
Slankydudl pushed a commit to Slankydudl/firmware that referenced this pull request Nov 23, 2026
…tic#12375)

ESP32 builds fail at CMake configure, before anything is compiled, when
GitHub resets one git fetch:

    ERROR: 'git --git-dir=/root/.cache/Espressif/ComponentManager/b_git_a38114cd
    fetch origin' failed with exit code 128
    fatal: unable to access
    'https://github.com/espressif/esp32-arduino-lib-builder.git/': Recv
    failure: Connection reset by peer

pioarduino's IDF-libs pass builds a dummy project whose idf_component.yml
(builder/build_lib/ in platform 55.03.312-1) requires espressif/fb_gfx from
esp32-arduino-lib-builder at version "master". ESP-IDF's component manager
(idf_component_tools/git_client.py, 2.4.11) runs `git fetch origin` on its
cached bare repo every time unless FETCH_HEAD is under a minute old; pinning
a commit or providing a lock file does not avoid it, and it has no retry or
offline setting. The CI image already holds that cache, so the fetch only
re-resolves master, but every ESP32 job depends on it succeeding.

meshtastic#12360 retries `pio pkg install` for the other architectures and leaves this
fetch alone because it happens inside `pio run`. build-esp32.sh now reruns
`pio run` when, and only when, its output carries that fetch failure (CMake
wraps the message across lines, so the match folds whitespace first), up to
ESP32_IDF_FETCH_ATTEMPTS times (default 3) with 15 s, 30 s backoff. Any other
failure exits at once with pio's own status. A rerun after the failed
configure starts the IDF-libs pass again: esp32_pre.py already drops the
sdkconfig.defaults an aborted pass leaves behind.

Tested with a stub pio replaying the error block from a failed CI job
(chatter2, run 43558959379): fetch failure then success runs twice and
continues; another error runs once and fails with its status; the fetch
failure every time gives up after 3 runs; an inherited pipefail does not
change that; 0, -1 and "abc" for the attempt count exit 2 before building.


Claude-Session: https://claude.ai/code/session_011C7D9bnioSkAoyRPicEV1C

Co-authored-by: Claude <noreply@anthropic.com>
@jp-bennett jp-bennett added this to the 2.8.3 milestone Nov 26, 2026 — with Claude
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

github_actions Pull requests that update GitHub Actions code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants