Repository navigation
Description
Symptom
runSingleTest is documented as a streaming, async-response RPC (Phase 3 in agents/docs/hardware-autoresearch.md):
REMOTE: {"success":true,"streamMode":true}
RESULT: {"type":"test_start", ...}
RESULT: {"type":"test_complete", ...}
The Python client (ci/rpc_client.py::RpcClient.send) treats it as a synchronous JSON-RPC call and times out at 60 s by default. With a moderate-sized strip (e.g. 100 LEDs × 4 patterns on Teensy 4) the device finishes the test in ~80–90 s but the client has already raised RpcTimeoutError and dropped the connection.
Reproducer
Live (today, 2026-06-14):
from ci.rpc_client import RpcClient
from ci.util.serial_interface import create_serial_interface
import asyncio
async def main():
si = create_serial_interface("COM20", use_pyserial=True)
c = RpcClient("COM20", timeout=60, serial_interface=si)
await c.connect(boot_wait=2.0, drain_boot=True)
r = await c.send("runSingleTest", args={
"driver": "OBJECT_FLED",
"laneSizes": [10],
"pattern": "MSB_LSB_A",
"iterations": 1,
})
print(r.data)
asyncio.run(main())Output:
FAIL: RpcTimeoutError RpcTimeoutError('No response with ID 3 within 60.0s')
Bumping timeout= to 120 s lets the call complete and the device produces a valid RpcResponse — confirming the device is running the test, the client just isn't waiting long enough or isn't subscribing to the streaming RESULT: lane.
Where the seam is
RpcClient.send is built around request/response correlation by id. The async Phase 3 RPCs (runSingleTest, runParallelTest, all coroutine tests) instead emit:
- An immediate
REMOTE:ack containing{"success": true, "streamMode": true}. Theidhere matches the request, so the current client sees a response and returns too early — but the test isn't actually finished. - A sequence of
RESULT:JSONL events fortest_start, per-frame updates, andtest_complete. - (Only at the very end) a final
REMOTE:reply viasendAsyncResponse(id=<original>)carrying the actual pass/fail payload.
The client today doesn't know about (1) being an ack vs (3) being the final answer — so it either:
- Returns on (1) and the caller never sees the test result (silent green when device crashed mid-test), OR
- Hangs on (1) when (1) is missing, and times out before (3) arrives.
In practice the synchronous path through await c.send("runSingleTest", ...) blocks on the final REMOTE: and times out because the test takes longer than the default 60 s for any non-trivial strip.
Asks
- Recognise the streaming envelope. When the first
REMOTE:reply for a request carriesstreamMode: true, treat it as an ack and keep the requestidarmed. Only resolve the future when the matchingsendAsyncResponse(or fail event) arrives. - Per-method default timeout. Lift the per-call timeout for the Phase 3 RPCs (
runSingleTest,runParallelTest,runNetClientTest,runNetLoopback, alltestCoroutine*) from the global 60 s default to something matched to their actual upper bound (e.g. 600 s — these are HIL tests by design). - Surface streaming events. Optionally expose
RESULT:events to the caller via a callback (on_event=) so a host script can render progress instead of staring at a silent socket for two minutes.
Why this matters
Today the autoresearch host scripts paper over this by either:
- Calling the lower-level
bash autoresearchwrapper (which has its own monitor loop with a separate timeout), or - Bypassing the broker and reading the streaming JSONL directly with pyserial (
ci/autoresearch/driver_sweep.py:214—use_pyserial=True).
Both are workarounds. Fixing RpcClient to natively understand the streaming envelope removes the need for either, and lets agents call runSingleTest from any Python harness without rebuilding the timeout / streaming logic.
Related: FastLED/fbuild#592 §3.4 (singleton broker) is the long-term path that would also let multiple clients subscribe to the same RESULT: stream; this issue is the short-term fix that makes a single client work today.
Repro environment
- Host: Windows 10, fbuild 2.2.28 (with feat(daemon): install running-process fbuild.servicedef on startup (#592 prerequisite) fbuild#593 servicedef install)
ci/rpc_client.py::RpcClient.send(currentmaster)- Device: Teensy 4.0,
OBJECT_FLEDdriver, 10–100 LEDs, MSB_LSB_A / B / C / D patterns - Symptom is the same on ESP32-S3 with the same RPCs
Investigated as a follow-up to FastLED/fbuild#592 / FastLED/fbuild#593 / #3059 (the decoder-tolerance issue this RPC timeout was masking).
🤖 Investigated with Claude Code
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
fix(rpc_client): restart wait after async ACK so Phase 3 RPCs aren't …