Repository navigation
fix(rpc_client): restart wait after async ACK so Phase 3 RPCs aren't timed out by the pre-ACK budget (#3060) - #3062
Conversation
…timed out by the pre-ACK budget (#3060) The async (Phase 3) RPCs — runSingleTest, runParallelTest, every testCoroutine*, the net/ble runners — emit '{"acknowledged": true}' as an immediate ACK and ship the actual result via sendAsyncResponse once the test finishes. RpcClient.send already knew to skip the ACK and keep waiting, but it kept reading inside the original timeout window that started when the request was sent. For runSingleTest with 100 LEDs on Teensy 4 the device-side work takes 70-90s; the default 60s timeout fires before sendAsyncResponse lands, surfacing as RpcTimeoutError('No response with ID N within 60s') even though the device is faithfully running the test. Now, when the ACK arrives, the client returns from _wait_for_response into a fresh _wait_for_response call with a post-ACK budget of max(caller_timeout, ASYNC_POST_ACK_TIMEOUT=600s). Synchronous calls are unchanged because they never receive an ACK; async calls get a budget large enough for any reasonable HIL test. Callers that explicitly bump the timeout above 600s still win. Verified live on Teensy 4 (COM20): runSingleTest with default timeout=10s now completes against OBJECT_FLED with the verbose log [RPC] ACK received for request 1, restarting wait for final response (post-ACK timeout=600.0s)... FINAL: 4 Pre-fix, the same call returned RpcTimeoutError at 60s with no result. Closes #3060
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds ChangesAsync ACK post-response timeout restart
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
✨ 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 |
Summary
RpcClient.send()already skipped{"acknowledged": true}ACKs from async (Phase 3) RPCs, but it kept reading inside the original caller-supplied timeout window. The runSingleTest path through 100 LEDs × 4 patterns on Teensy 4 takes 70-90 s of device-side work; the default 60 s budget fired beforesendAsyncResponselanded, and surfaced asRpcTimeoutError('No response with ID N within 60s')even though the device was faithfully running the test.After this PR, when the ACK arrives the client returns into a fresh
_wait_for_responsecall withmax(caller_timeout, ASYNC_POST_ACK_TIMEOUT=600s). Synchronous calls are unchanged (they never see an ACK); async calls get a budget large enough for any reasonable HIL test.Why this didn't need a streaming-envelope rewrite
The investigation in #3060 hypothesised a missing
{"streamMode": true}handler. Walking the firmware (src/fl/remote/rpc/rpc.cpp.hpp:115-117) and the existing client (ci/rpc_client.py:636-646), the actual envelope is{"acknowledged": true}and the client already skips it correctly. The bug was that the second wait (for the real result) still ran on the original ACK-budget clock, so any test taking longer thantimeoutpost-ACK appeared identical to a hung device.That made the fix narrower: keep the existing protocol handling, but restart the wait once the ACK proves the device is alive and running the test.
Live validation
Tested on the Teensy 4 attached to this workstation (COM20,
OBJECT_FLEDdriver):Pre-fix, the identical call with
timeout=10raisedRpcTimeoutError. Post-fix, the call returns the full test result (totalTests=4) without the caller having to manually bump the timeout.Test plan
runSingleTestviaRpcClient(timeout=10)against attached Teensy 4 returns the expected result (was timing out pre-fix).RpcClient.ASYNC_POST_ACK_TIMEOUTis reachable as a class constant; module imports cleanly.ping,status,drivers) — unchanged code path, no behaviour change.Closes #3060
Summary by CodeRabbit