You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug(autoresearch): FbuildSerialAdapter drops RPC ping responses during GPIO pre-test #2261
The autoresearch GPIO pre-test fails when using FbuildSerialAdapter for RPC communication. The adapter's short read timeout (50ms) and early loop exit on buffer drain cause JSON-RPC ping responses to be lost, resulting in consistent ping timeouts.
Root Cause
FbuildSerialAdapter has timing characteristics that are incompatible with the RPC ping/response protocol:
50ms read timeout per iteration — too short for RPC round-trip on ESP32-S3
Early exit on buffer drain timeout — stops reading before the response arrives
Async/sync boundary crossing via ThreadPoolExecutor adds latency
In contrast, PySerialAdapter with reset_input_buffer() works reliably — the schema validation phase (which uses pyserial directly) succeeds while the GPIO pre-test (which conditionally used FbuildSerialAdapter) fails.
Affected Code
ci/autoresearch/phases.py lines 909-915 — serial interface creation in _run_schema_and_pin_setup().
Previously, when use_fbuild=True, ctx.serial_iface was set to None, causing downstream code to fall back to FbuildSerialAdapter for RPC communication.
Fix Applied
Always use PySerialAdapter for RPC communication regardless of the build system:
# Create serial interface - always use pyserial for RPC communication# (fbuild serial adapter has timing issues with RPC ping/response)fromci.util.serial_interfaceimportcreate_serial_interfacectx.serial_iface=create_serial_interface(port=upload_port, use_pyserial=True)
Reproduction
Connect ESP32-S3 with jumper on GPIO 1-2 (RPC TX/RX pins)
Separately, a jumper wire on GPIO 0-1 (instead of 1-2) causes the ESP32-S3 to enter ROM bootloader mode on every reset, since GPIO 0 is the BOOT strapping pin. This is a hardware setup issue, not a software bug, but worth documenting for autoresearch users.
fbuild's native read_lines() returns the first batch of lines (typically 1-2 lines), NOT all lines within the timeout window. The old _producer iterated over that single list and exited immediately. RPC responses arriving after the first batch were lost.
Fix: Loop over multiple read_lines() calls until the overall deadline expires. Also replaced silent except Exception: pass with a warning.
The native write() reads exactly one WebSocket message expecting a WriteAck. If a Data message arrives first (serial output during write), the ack is consumed and write() returns 0.
Bug #3: fbuild native write_json_rpc has no ID correlation (UPSTREAM — FastLED/fbuild#49)
The native write_json_rpc() returns the first REMOTE:-prefixed line regardless of JSON-RPC request ID. Out-of-order responses could match the wrong request.
Resolution
Bug support TLS3001 #1 fixed in ci/util/serial_interface.py — FbuildSerialAdapter now loops correctly
ci/autoresearch/phases.py reverted to use FbuildSerialAdapter (centralized daemon) instead of PySerialAdapter workaround
Activity
zackees commentedon Apr 16, 2026
Upstream root cause filed as FastLED/fbuild#49 — FbuildSerialAdapter's 50ms read timeout and early exit behavior drops RPC responses.
zackees commentedon Apr 16, 2026
Root Cause Analysis — Full Bug Catalogue
Bug #1: FbuildSerialAdapter.read_lines terminates after first batch (FIXED)
Location:
ci/util/serial_interface.py—FbuildSerialAdapter._producer()fbuild's native
read_lines()returns the first batch of lines (typically 1-2 lines), NOT all lines within the timeout window. The old_produceriterated over that single list and exited immediately. RPC responses arriving after the first batch were lost.Fix: Loop over multiple
read_lines()calls until the overall deadline expires. Also replaced silentexcept Exception: passwith a warning.Bug #2: fbuild native
write()ack race condition (UPSTREAM — FastLED/fbuild#49)The native
write()reads exactly one WebSocket message expecting aWriteAck. If aDatamessage arrives first (serial output during write), the ack is consumed andwrite()returns 0.Bug #3: fbuild native
write_json_rpchas no ID correlation (UPSTREAM — FastLED/fbuild#49)The native
write_json_rpc()returns the firstREMOTE:-prefixed line regardless of JSON-RPC request ID. Out-of-order responses could match the wrong request.Resolution
ci/util/serial_interface.py— FbuildSerialAdapter now loops correctlyci/autoresearch/phases.pyreverted to use FbuildSerialAdapter (centralized daemon) instead of PySerialAdapter workaroundfix(autoresearch): FbuildSerialAdapter read_lines loop + I2S stress t…
fix(autoresearch): FbuildSerialAdapter read_lines loop + I2S stress t…