Repository navigation
Description
Symptom
bash autoresearch rp2350w --rp-spi-loopback fails before reaching the device:
FAIL — rpc.discover did not return a schema object (got NoneType)
The same script, same board, same code path, run standalone, works:
uv run python -m ci.autoresearch.test_rp_spi_loopback --port /dev/ttyACM0 --spi-index 0
rpSpiLoopback(SPI0, 1,000,000 Hz)
FAIL — RP SPI loopback failed.
capture: {'driver': 'SPI0', 'sckPin': 2, 'misoPin': 0, 'mosiPin': 3,
'expected': [0, 255, 85, 170, ...],
'received': [0, 0, 0, 0, ...], 'wireIdle': True, ...}
(That standalone failure is a separate, physical matter — an unfitted GPIO3->GPIO0 jumper. The point here is that it reached the device and executed, which the harness-invoked run never does.)
What is different
_run_rp_spi_loopback_tests in ci/autoresearch/phases.py spawns the script as a subprocess:
cmd = ["uv", "run", "python", "-m", "ci.autoresearch.test_rp_spi_loopback",
"--port", upload_port, ...]
result = RunningProcess.run(cmd, check=False, timeout=ctx.remaining_seconds())while the parent harness still holds its own RpcBench/serial connection to that port. The parent's own schema fetch succeeds in the same run, immediately before:
🔍 Validating RPC commands against device schema...
✅ Fetched schema: 71 methods
✅ All 0 RPC commands validated against schema
...
FAIL — rpc.discover did not return a schema object (got NoneType)
So one connection to the port works and the second gets nothing back.
What I have NOT established
The mechanism inside fbuild's serial daemon. SerialManager::attach_reader() hands out a broadcast::Receiver and reader_client_ids is a set, so reads look like they should fan out to both clients. I did not verify whether a second client's writes reach the device, which is the obvious next thing to check but which I have no evidence for either way.
I am deliberately not naming a cause. I proposed three for the NoneType before comparing harness-vs-standalone — a short discover timeout, the call_flat frame shape, and payload size — and each was refuted by the next run. The harness/standalone difference is the only thing I have actually demonstrated.
Possibly related but distinct: FastLED/fbuild#1427 (approved, unmerged) concerns a leaked reader left after deploy's post-flash monitor. This is concurrent readers by design, so I would not assume one fixes the other.
Scope
This is not SPI-specific. Any ci/autoresearch/test_*.py the harness spawns as a subprocess against a port it still holds should hit the same thing. Worth checking the other test_* runners.
Why it matters beyond the failure itself
Until PR #4206 the failure printed as:
FAIL — deployed firmware schema does not contain rpSpiLoopback
on a board that does expose the method (a direct query returns both rpSpiLoopback and rpSpiPublicApiLoopback). That asserts a firmware build gap and sends the reader hunting for a missing FASTLED_AUTORESEARCH_LOW_MEMORY branch. #4206 makes the message honest about not knowing; it does not fix this.
Reproduction
# fails
bash autoresearch rp2350w --rp-spi-loopback --rp-spi-index 0 --upload-port /dev/ttyACM0
# works (reaches device, runs the test)
uv run python -m ci.autoresearch.test_rp_spi_loopback --port /dev/ttyACM0 --spi-index 0Bench: RP2350W 2DCB876B587EA334, 2E8A:F00F, /dev/ttyACM0.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
zackees commentedon Sep 7, 2026
Minimal reproduction — no harness, no SPI, no subprocess. Two
RpcBenchclients on one port, in a single process:RP2350W on
/dev/ttyACM0:Three things this pins down that the harness-vs-standalone comparison did not:
RpcBench.__init__runsconnect(boot_wait=3.0, drain_boot=True)to completion and raises nothing. There is no error to notice.None. It looks like a healthy client and answers nothing.So this is not subprocess-specific, not SPI-specific, and not a teardown-ordering problem. Any code path that opens a second
RpcBenchagainst a port another client already holds gets a silently useless client.The silence is the dangerous part. A dead-but-connected client makes every downstream call return
None, and callers then interpretNoneas a statement about the device. That is exactly how this surfaced originally:FAIL — deployed firmware schema does not contain rpSpiLoopbackon a board that does expose the method. The transport had failed; the message blamed the firmware.Still not claiming the mechanism.
SerialManager::attach_reader()returns abroadcast::Receiverandreader_client_idsis a set, so reads look like they should fan out. Whether B's writes reach the device is the remaining question, and I have not instrumented that. What is now established is the observable contract violation: a second attach appears to succeed and does not work.Two directions a fix could take, for whoever picks this up:
Nonepropagates._run_rp_spi_loopback_testsand any siblingtest_*runner).Reproduction script is 20 lines; happy to attach it if useful.
fix(autoresearch): release the serial port before the SPI public-api …
fix(autoresearch): release the harness serial port before spawning th…
zackees commentedon Sep 8, 2026
Status after #4208 merged: the workflow is fixed, the contract problem is not. Recording this so the issue is not closed on the strength of the PR.
#4208 stopped both SPI phases from spawning a device script against a port the harness still holds, and that half is confirmed on master (
ci/autoresearch/phases.pynow releasesctx.serial_ifaceat both spawn sites). The harness-invoked loopback reaches the device and fails only on the unfitted jumper, which is the correct outcome.But the underlying behaviour is unchanged. Re-ran the minimal repro against merged master (
3ee4009a83) on the RP2350W:Identical to the pre-merge result: B connects without raising and is then completely inert, every call returning
None, while A is unaffected before and after.So #4208 removed the two places in the harness that tripped over this; it did not change what happens when something opens a second client. Any future code path that does so gets the same silently useless object, and the
Nonewill again read to its caller as a statement about the device — which is how this first surfaced asdeployed firmware schema does not contain rpSpiLoopbackagainst a board that exposes the method.I would suggest keeping this open for the contract fix: a second attach should either work or fail loudly. Silent success is the property that makes it expensive, not the fact that two callers can collide.
Still not claiming a mechanism.
SerialManager::attach_reader()hands out abroadcast::Receiverandreader_client_idsis a set, so reads look like they should fan out; whether B's writes reach the device is the open question and I have not instrumented it.docs(lessons): record RP2350W HIL diagnosis lessons
fix(autoresearch): a failed write is not an error reply (#4207)
fix(autoresearch): refuse a connected-but-inert RpcBench (FastLED#4207)…
fix(autoresearch): LPC845 RX-DMA loopback builds fit and get the port (…
fix(lpc): interrupt-driven USART0 RX ends LPC845 RPC loss; SCT RX cap…