Repository navigation
Conversation
…ault) fbuild 2.2.13 ships the compile-many stage-2 framework-archive share (FastLED/fbuild#337). That fix is what closes the gap that originally forced the gate to default-off in #2662 — stage-2 sketches used to rebuild the framework from scratch in their own per-sketch project dirs, which on uno took ~7 min vs ~3.5 min serial and on teensy41/esp32s3 blew past the 30 min batch timeout. With the share in place, locally that's a ~19x cold-cache speedup on uno (200ms per stage-2 sketch vs ~3.7s prior). Flip the polarity: Before: opt-in via FASTLED_USE_FBUILD_CI=1; default = legacy serial. After: default = compile-many (or 'fbuild ci' when supported); opt-out via FASTLED_USE_FBUILD_CI in {0,false,no,off}. Any non-falsy value (including unset) selects compile-many. Existing opt-in setters (=1/true/yes/on) keep working — the env-var name and its truthy values are preserved. Test update: existing test_pio_compiler_build_prefers_ci_results still sets FASTLED_USE_FBUILD_CI=1 explicitly. Under the new logic that's redundant but harmless, and it guards against a future regression that flips the polarity back — a CI environment that inherits FASTLED_USE_FBUILD_CI=0 from a parent shell would otherwise silently disable the path the test means to exercise. Refs FastLED/fbuild#337, #2662
📝 WalkthroughWalkthroughfbuild selection in PioCompiler._build_fbuild now prefers Changesfbuild compile-many default behavior
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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.
Inline comments:
In `@ci/compiler/pio.py`:
- Around line 451-453: The env parsing for FASTLED_USE_FBUILD_CI uses
raw.lower() but doesn't strip whitespace, so values like "0 " won't match;
update the parsing to strip whitespace before lowercasing (e.g., use
raw.strip().lower()) and keep the existing opt_out check (opt_out = raw in ("0",
"false", "no", "off")) so that raw is normalized for comparison; ensure you
update the variable `raw` or apply strip when computing `opt_out` where
`FASTLED_USE_FBUILD_CI`, `raw`, and `opt_out` are referenced in
ci/compiler/pio.py.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 92ecee0d-66a7-4cd0-9281-b1315f87cad6
📒 Files selected for processing (2)
ci/compiler/pio.pyci/tests/test_fbuild_compile_many.py
| raw = os.environ.get("FASTLED_USE_FBUILD_CI", "").lower() | ||
| opt_out = raw in ("0", "false", "no", "off") | ||
| if not opt_out: |
There was a problem hiding this comment.
Strip whitespace before matching the opt-out values.
The raw value is lowercased but not stripped, so an inherited env value with surrounding whitespace (e.g. FASTLED_USE_FBUILD_CI="0 ") would not match the opt-out set and would silently enable compile-many — defeating the very "hostile inherited environment value" scenario the companion test comment cites as the rollback safety lever.
🛡️ Proposed fix
- raw = os.environ.get("FASTLED_USE_FBUILD_CI", "").lower()
+ raw = os.environ.get("FASTLED_USE_FBUILD_CI", "").strip().lower()
opt_out = raw in ("0", "false", "no", "off")🤖 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 `@ci/compiler/pio.py` around lines 451 - 453, The env parsing for
FASTLED_USE_FBUILD_CI uses raw.lower() but doesn't strip whitespace, so values
like "0 " won't match; update the parsing to strip whitespace before lowercasing
(e.g., use raw.strip().lower()) and keep the existing opt_out check (opt_out =
raw in ("0", "false", "no", "off")) so that raw is normalized for comparison;
ensure you update the variable `raw` or apply strip when computing `opt_out`
where `FASTLED_USE_FBUILD_CI`, `raw`, and `opt_out` are referenced in
ci/compiler/pio.py.
The first esp32s3 / teensy41 CI runs on #2672 (gate flip merge candidate) all timed out at the 1800s batch deadline. The log shows zero "stage2" or "[stage" mentions — `fbuild ci` ran past 30 min while still in stage 1. Root cause: default_fbuild_framework_jobs returned a hardcoded 1, so `--framework-jobs 1` made stage-1 framework compilation single-threaded on the 2-core GitHub Actions runners. With ~150 framework files for esp32-arduino at a few seconds each on a single core, stage 1 alone outlasts the batch timeout — the framework-archive seed from FastLED/fbuild#337 never gets a chance to fan stage 2 out across multiple sketches. Switch to the same shape as default_fbuild_sketch_jobs: respect the FASTLED_FRAMEWORK_JOBS env override when set; otherwise use min(cpu_count, 2). The cap at 2 mirrors the fbuild orchestrator's own default in crates/fbuild-build/src/compile_many.rs because framework compilation is memory-heavy and we don't want to OOM a 2-core runner trying to compile 16 framework objects in parallel. This is intended to unblock the gate-flip in this branch by letting stage 1 finish within the batch timeout on the platforms that originally timed out. Refs FastLED/fbuild#337
|
Pushed a follow-up commit ( Why: the first esp32s3 / teensy41 runs on this branch timed out at the 1800s batch deadline. The log has zero Cap at 2 mirrors the fbuild orchestrator's own Re-running CI. |
After bumping framework_jobs to 2 in b71843c, esp32s3 / teensy41 still timed out at 1800s on this branch. The previous timeout was sized for the per-sketch serial path; for the batched compile-many path the same number has to cover stage-1 framework build + stage-2 fanout of every sketch, which on 2-core GitHub Actions runners with a cold esp32-arduino framework cache outlasts 30 min even with framework_jobs=2. Switch to a 60 min default, tunable via FASTLED_FBUILD_BATCH_TIMEOUT_SECS for workflows that need to override either direction (CI runner with frozen caches → lower it; fresh runner on a beefier board → raise it). Updated the timeout assertion in test_pio_compiler_build_prefers_ci_results to match the new default with a comment explaining the rationale. Refs FastLED/fbuild#337
|
Pushed third commit Where the previous one fell short: even with 60 min should be plenty for any board's cold-cache batch. Workflows that get faster (warm cache after first save, or once we figure out a way to keep the daemon's framework artifacts across runs) can tune it lower. |
There was a problem hiding this comment.
Actionable comments posted: 2
♻️ Duplicate comments (1)
ci/compiler/pio.py (1)
451-453:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winStrip whitespace before matching opt-out values.
The past review comment on these lines is still valid: the raw value is lowercased but not stripped, so an inherited env value with surrounding whitespace (e.g.,
FASTLED_USE_FBUILD_CI="0 ") would not match the opt-out set and would silently enable compile-many.🛡️ Proposed fix
- raw = os.environ.get("FASTLED_USE_FBUILD_CI", "").lower() + raw = os.environ.get("FASTLED_USE_FBUILD_CI", "").strip().lower() opt_out = raw in ("0", "false", "no", "off")🤖 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 `@ci/compiler/pio.py` around lines 451 - 453, The opt-out check uses raw = os.environ.get("FASTLED_USE_FBUILD_CI", "").lower() but doesn't strip surrounding whitespace, so values like "0 " won't match; update the handling of FASTLED_USE_FBUILD_CI (the raw variable and opt_out logic) to strip whitespace before lowercasing (e.g., call .strip() then .lower() or strip raw before membership test) so opt_out = raw in ("0","false","no","off") reliably detects opt-out values.
🤖 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.
Inline comments:
In `@ci/compiler/pio.py`:
- Around line 575-577: The batch_timeout assignment converts
FASTLED_FBUILD_BATCH_TIMEOUT_SECS to float without validation; wrap the
conversion of os.environ.get("FASTLED_FBUILD_BATCH_TIMEOUT_SECS", "3600") in a
try/except around float() for the variable batch_timeout and raise a clear
ValueError if parsing fails (include the env var name and the invalid value in
the message) so failures are descriptive and fail fast instead of propagating a
generic exception.
- Around line 562-563: Remove the local imports "import os" and "import time"
from the middle of the module and instead ensure "os" (and not a duplicate
"time") is present in the file's top-level imports with the standard ordering
(standard library first, then third-party, then local); also remove any
duplicate top-level "time" import if it already exists and eliminate the
redundant local import at the later location (the other occurrence of a local
"os" import should be consolidated to the single top-level "os").
---
Duplicate comments:
In `@ci/compiler/pio.py`:
- Around line 451-453: The opt-out check uses raw =
os.environ.get("FASTLED_USE_FBUILD_CI", "").lower() but doesn't strip
surrounding whitespace, so values like "0 " won't match; update the handling of
FASTLED_USE_FBUILD_CI (the raw variable and opt_out logic) to strip whitespace
before lowercasing (e.g., call .strip() then .lower() or strip raw before
membership test) so opt_out = raw in ("0","false","no","off") reliably detects
opt-out values.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 3975258e-86c1-440e-b628-20f6fa0b1f1b
📒 Files selected for processing (2)
ci/compiler/pio.pyci/tests/test_fbuild_compile_many.py
🚧 Files skipped from review as they are similar to previous changes (1)
- ci/tests/test_fbuild_compile_many.py
| import os | ||
| import time |
There was a problem hiding this comment.
Move imports to the top of the file.
These imports violate the coding guideline requiring all system imports to be at the top of the file in proper order (standard library, then third-party, then local). The time module is already imported at line 18, and os should be moved to the top-level imports as well (it's also locally imported at line 444).
♻️ Proposed fix
Remove the local imports here:
- import os
- import time
-
from ci.util.fbuild_runner import _parse_size_info_from_logAnd ensure os is added to the top-level imports (around line 11-23) if not already present.
As per coding guidelines: "All system imports must be at the top of the file in proper order: standard library, third-party, local".
🤖 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 `@ci/compiler/pio.py` around lines 562 - 563, Remove the local imports "import
os" and "import time" from the middle of the module and instead ensure "os" (and
not a duplicate "time") is present in the file's top-level imports with the
standard ordering (standard library first, then third-party, then local); also
remove any duplicate top-level "time" import if it already exists and eliminate
the redundant local import at the later location (the other occurrence of a
local "os" import should be consolidated to the single top-level "os").
| batch_timeout = float( | ||
| os.environ.get("FASTLED_FBUILD_BATCH_TIMEOUT_SECS", "3600") | ||
| ) |
There was a problem hiding this comment.
Validate environment variable before float conversion.
The code converts FASTLED_FBUILD_BATCH_TIMEOUT_SECS to float without validation. If the environment contains an invalid value (e.g., "abc", "30.5.2"), float() will raise a generic ValueError at runtime. As per coding guidelines, critical configuration should fail fast with descriptive errors rather than silently propagating exceptions.
🛡️ Proposed fix
- batch_timeout = float(
- os.environ.get("FASTLED_FBUILD_BATCH_TIMEOUT_SECS", "3600")
- )
+ batch_timeout_str = os.environ.get("FASTLED_FBUILD_BATCH_TIMEOUT_SECS", "3600")
+ try:
+ batch_timeout = float(batch_timeout_str)
+ if batch_timeout <= 0:
+ raise ValueError("Timeout must be positive")
+ except ValueError as e:
+ raise RuntimeError(
+ f"Invalid FASTLED_FBUILD_BATCH_TIMEOUT_SECS='{batch_timeout_str}': "
+ f"must be a positive number. {e}"
+ ) from eAs per coding guidelines: "Never use silent fallbacks for missing critical resources - always fail fast with descriptive errors".
🤖 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 `@ci/compiler/pio.py` around lines 575 - 577, The batch_timeout assignment
converts FASTLED_FBUILD_BATCH_TIMEOUT_SECS to float without validation; wrap the
conversion of os.environ.get("FASTLED_FBUILD_BATCH_TIMEOUT_SECS", "3600") in a
try/except around float() for the variable batch_timeout and raise a clear
ValueError if parsing fails (include the env var name and the invalid value in
the message) so failures are descriptive and fail fast instead of propagating a
generic exception.
|
Closing without merge — the compile-many gate flip is a net regression on the big-framework boards. What we observedThree CI attempts on this branch (with
Comparison against master (serial loop,
What didn't help
What needs to ship before re-trying this gate flipTwo follow-up fbuild issues filed:
Once #361 and #362 ship, we can re-attempt this gate with confidence on all boards. |
With #2671 on master, FastLED is now on fbuild 2.2.13 — which ships the compile-many stage-2 framework-archive share (FastLED/fbuild#337). That fix is what closes the gap that originally forced the gate to default-off in #2662: stage-2 sketches used to rebuild the framework from scratch in their own per-sketch project dirs, which on uno took ~7 min vs ~3.5 min serial and on teensy41/esp32s3 blew past the 30 min batch timeout. With the share in place, locally that's a ~19× cold-cache speedup on uno (200ms per stage-2 sketch vs ~3.7s prior).
Polarity flip
The env var name and its truthy values (`1`/`true`/`yes`/`on`) are preserved — anyone who has the opt-in baked into a wrapper script keeps working.
Safety / rollback
If anything goes sideways post-merge, set `FASTLED_USE_FBUILD_CI=0` in the affected workflow's env block — that immediately puts the path back on the legacy serial loop without touching code. The whole gate-flip is a polarity change in one method (`PioCompiler._build_fbuild`) plus a clarifying comment in the existing test; nothing else changes.
Risk evaluation
The original #2662 break happened because compile-many with the framework-rebuild-per-sketch regression was unconditionally enabled — there was no escape valve. This PR has two key differences:
🤖 Generated with Claude Code
Summary by CodeRabbit
Performance
Documentation