Skip to content

ci(avr8js): restart fbuild daemon + cap step at 8 min (fixes #2645) - #2646

Merged
zackees merged 1 commit into
masterfrom
ci/avr8js-daemon-restart-and-timeout-2645
May 31, 2026
Merged

zackees merged 1 commit into
masterfrom
ci/avr8js-daemon-restart-and-timeout-2645

Conversation

@zackees

@zackees zackees commented May 31, 2026 •

Copy link
Copy Markdown
Member

Summary

  • After ci-compile.py invokes fbuild build, the daemon is left in whatever state the build ended in. On the avr8js path that state has been making /api/test-emu hang silently for 30 minutes before failing with daemon error: request failed: error sending request for url (http://127.0.0.1:8765/api/test-emu). Restart the daemon between ci-compile.py and fbuild test-emu to start the avr8js request from a known-clean daemon.
  • Add timeout-minutes: 8 so the step fails fast instead of burning a 30 min runner minute floor per push.
  • On failure, dump fbuild daemon status and tail the daemon log into the existing avr8js_output.log artifact so the next iteration has real evidence (today's failures upload a single 104-byte error line).

Closes #2645. Refs FastLED/fbuild#291, #292, #130.

Scope

  • Only .github/workflows/avr8js_docker_template.yml is touched. The QEMU templates use the same fbuild test-emu pipeline but are green today (run 26700714508) — leave them alone to avoid regression risk.

Test plan

  • uno_avr8js_test workflow goes green on this PR (or, if the daemon-restart doesn't unblock the upstream hang, fails inside 8 min with daemon-status + daemon-log evidence attached for the next iteration).
  • No QEMU workflows touched / regressed.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Enhanced test automation workflow with added timeout protection for emulator tests.
    • Improved diagnostic logging to capture daemon status and logs when emulator tests fail, aiding troubleshooting efforts.

…ang (#2645)

After ci-compile.py invokes `fbuild build`, the daemon is left in whatever
state the build ended in. On the avr8js path that state has been making
`/api/test-emu` hang silently for 30 minutes before failing with
`daemon error: request failed`. Restarting brings up a fresh daemon for
the avr8js request, and the 8-min step timeout caps the bleed while
the upstream fbuild regression is being tracked.

Also dumps daemon status + log tail on failure so the next debugging
cycle has real evidence of what the daemon was doing during the hang
(currently the run produces a single 104-byte error line).

Scope: only the avr8js template — QEMU templates use the same `fbuild
test-emu` pipeline but are green today (run 26700714508), so leave
them untouched.

Refs FastLED/fbuild#291, #292, #130.
@coderabbitai

coderabbitai Bot commented May 31, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR hardens the fbuild test-emu CI step by introducing an 8-minute timeout and daemon restart/status checks after sketch compilation. It also adds a failure diagnostics step that captures daemon status and logs for debugging when the test step fails.

Changes

fbuild test-emu reliability and diagnostics

Layer / File(s) Summary
Step timeout and daemon restart before test-emu
.github/workflows/avr8js_docker_template.yml
The fbuild test-emu step now has an 8-minute timeout. After ci/ci-compile.py completes, a grouped sequence restarts and checks the fbuild daemon status before running the emulator test.
Failure diagnostics collection
.github/workflows/avr8js_docker_template.yml
A new conditional step runs when test-emu fails, using fbuild show daemon to append daemon status and daemon log tail to avr8js_output.log for post-failure analysis.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related issues

  • FastLED/FastLED#2645: Both changes modify the avr8js workflow by adding step timeout, daemon restart, and failure diagnostics to the fbuild test-emu step.

Possibly related PRs

  • FastLED/FastLED#2296: Both PRs modify the AVR8JS CI workflow to enhance fbuild test-emu execution, with this PR adding daemon restart/status/diagnostics around the test-emu step.

Poem

🐰 A daemon wakes and checks its health,
Before the emulator tests its wealth,
When failures come, we log and see—
What made the test-emu disagree! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main changes: restarting the fbuild daemon and capping the step at 8 minutes, with a direct reference to the issue being fixed.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ci/avr8js-daemon-restart-and-timeout-2645

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
.github/workflows/avr8js_docker_template.yml (2)

106-109: ⚡ Quick win

Consider adding a brief wait after daemon restart.

The daemon restart is followed immediately by fbuild test-emu on line 110. Depending on daemon startup time, there might be a race condition where test-emu attempts to connect before the daemon is fully initialized.

⏱️ Proposed fix to add startup verification
 echo "::group::fbuild daemon restart (FastLED#2645)"
 uv run fbuild daemon restart || true
+sleep 2
 uv run fbuild daemon status || true
 echo "::endgroup::"

Alternatively, poll the status until ready (if fbuild supports it):

 echo "::group::fbuild daemon restart (FastLED#2645)"
 uv run fbuild daemon restart || true
+for i in {1..5}; do
+  if uv run fbuild daemon status; then break; fi
+  sleep 1
+done
-uv run fbuild daemon status || true
 echo "::endgroup::"
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/avr8js_docker_template.yml around lines 106 - 109, After
restarting the fbuild daemon (the "uv run fbuild daemon restart" invocation) add
a short wait-and-verify step before running "uv run fbuild test-emu": either
insert a small sleep (e.g., a few seconds) after "uv run fbuild daemon restart"
or poll "uv run fbuild daemon status" in a loop until it reports ready (with a
timeout) so that "fbuild test-emu" does not race with daemon startup; update the
block containing "uv run fbuild daemon restart", "uv run fbuild daemon status",
and the subsequent "fbuild test-emu" invocation accordingly.

103-104: ⚡ Quick win

Reduce hardening priority: current callers don’t allow command injection; quote template vars anyway

inputs.platform / inputs.sketch are unquoted in .github/workflows/avr8js_docker_template.yml (around lines 103-104). However, in this repo the reusable workflow is only called by .github/workflows/avr8js_uno_test.yml, with hardcoded platform: uno and sketch: Test, so PR/workflow_dispatch metadata can’t supply attacker-controlled values to these shell arguments.

Low-cost hardening still recommended: quote the template variables defensively, and consider whether the immediate fbuild daemon restart/status || true followed by fbuild test-emu needs an explicit readiness wait/retry if fbuild’s restart isn’t synchronous.

🔒 Proposed fix to quote template variables
-          uv run ci/ci-compile.py ${{ inputs.platform }} \
-            --examples ${{ inputs.sketch }} \
+          uv run ci/ci-compile.py "${{ inputs.platform }}" \
+            --examples "${{ inputs.sketch }}" \
             --verbose
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/avr8js_docker_template.yml around lines 103 - 104, Quote
the template variables passed to the shell command in the reusable workflow:
change the invocation of uv run ci/ci-compile.py to pass "${{ inputs.platform
}}" and "${{ inputs.sketch }}" (i.e., wrap inputs.platform and inputs.sketch in
quotes) so the shell receives safely quoted arguments; while editing, review the
sequence around the fbuild daemon restart/status and fbuild test-emu calls and,
if restart isn't synchronous, add a simple readiness wait/retry (e.g., loop with
sleep and status check) to ensure fbuild is ready before running fbuild
test-emu.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In @.github/workflows/avr8js_docker_template.yml:
- Around line 106-109: After restarting the fbuild daemon (the "uv run fbuild
daemon restart" invocation) add a short wait-and-verify step before running "uv
run fbuild test-emu": either insert a small sleep (e.g., a few seconds) after
"uv run fbuild daemon restart" or poll "uv run fbuild daemon status" in a loop
until it reports ready (with a timeout) so that "fbuild test-emu" does not race
with daemon startup; update the block containing "uv run fbuild daemon restart",
"uv run fbuild daemon status", and the subsequent "fbuild test-emu" invocation
accordingly.
- Around line 103-104: Quote the template variables passed to the shell command
in the reusable workflow: change the invocation of uv run ci/ci-compile.py to
pass "${{ inputs.platform }}" and "${{ inputs.sketch }}" (i.e., wrap
inputs.platform and inputs.sketch in quotes) so the shell receives safely quoted
arguments; while editing, review the sequence around the fbuild daemon
restart/status and fbuild test-emu calls and, if restart isn't synchronous, add
a simple readiness wait/retry (e.g., loop with sleep and status check) to ensure
fbuild is ready before running fbuild test-emu.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: e3436abb-309c-45f2-ba14-93678f1fccc3

📥 Commits

Reviewing files that changed from the base of the PR and between 47e95d8 and 8a4716e.

📒 Files selected for processing (1)
  • .github/workflows/avr8js_docker_template.yml

@zackees
zackees merged commit 10752c2 into master May 31, 2026
2 of 4 checks passed
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.

ci(avr8js): uno_avr8js_test hangs 30 min then 'daemon error: request failed' on every master push

1 participant