Skip to content

feat(parlio): land c6 streaming diagnostics - #2682

Merged
zackees merged 3 commits into
masterfrom
feat/parlio-local-work
Jun 2, 2026
Merged

zackees merged 3 commits into
masterfrom
feat/parlio-local-work

Conversation

@zackees

@zackees zackees commented Jun 2, 2026 •

Copy link
Copy Markdown
Member

Summary

  • replay the locally checked-out PARLIO work onto current origin/master
  • add C6-aware PARLIO DMA/PSRAM sizing, underrun/debug metrics, and AutoResearch RPC reporting
  • extend AutoResearch PARLIO stream validation with strict explicit txPins handling and encode benchmark PSRAM availability fields
  • fix C6 hardware-loop support issues found during review: environment-aware port fallback, USB-Serial-JTAG RX availability buffering, exported PARLIO metrics, and ISR underrun/completion accounting

Validation

  • git diff --check
  • uv run pytest ci/tests/test_autoresearch_phases.py (44 passed)
  • PLATFORMIO_SRC_DIR=$PWD\examples\AutoResearch pio run -e esp32c6
  • uploaded AutoResearch to ESP32-C6 on COM9 with pio run -e esp32c6 -t upload --upload-port COM9
  • RPC smoke tests on COM9:
    • 1/2/4/8/16-lane parlioStreamValidate, 8 LEDs/lane: all completed; 16-lane case returned bytesTotal=24, bytesTransmitted=24, txDoneCount=1, ringError=false, hardwareIdle=false
    • repeated 16-lane, 128 LEDs/lane: completed with bytesTotal=384, bytesTransmitted=384, ringError=false
    • 16-lane, 256 LEDs/lane, 3 iterations: completed with bytesTotal=768, bytesTransmitted=768, txDoneCount=3, workerIsrCount=2, underrunCount=2, ringError=false, hardwareIdle=false
    • follow-up ping RPC succeeded after every large-frame stream test

Summary by CodeRabbit

  • New Features

    • Environment-aware upload-port detection for more accurate device selection
    • Expanded PARLIO diagnostics, streaming outputs and benchmark timing/PSRAM reporting
    • Shorter serial wait on recent ESP32 variants and improved startup logging
  • Bug Fixes

    • More reliable USB-serial availability and reads via improved RX caching
    • Better detection fallbacks when chip probing is inconclusive
  • Tests

    • Tightened and expanded auto-detection unit tests
  • Chores

    • Reduced ESP32-C6 CI flash/firmware size specs
    • Removed several noisy warning logs during serial/LCD transmit failures

@coderabbitai

coderabbitai Bot commented Jun 2, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: f7034e98-fb1d-4f61-896b-72bd5311e735

📥 Commits

Reviewing files that changed from the base of the PR and between ef4e40f and 24f0524.

📒 Files selected for processing (3)
  • ci/autoresearch/driver_sweep.py
  • ci/autoresearch/runner.py
  • ci/debug_attached.py
🚧 Files skipped from review as they are similar to previous changes (2)
  • ci/autoresearch/driver_sweep.py
  • ci/autoresearch/runner.py

📝 Walkthrough

Walkthrough

This PR enhances AutoResearch CI capabilities with environment-aware port detection, extends PARLIO driver debugging infrastructure with underrun tracking and PSRAM-aware memory allocation, integrates advanced benchmarking into AutoResearch examples, and refines serial communication backends for ESP32 variants.

Changes

PARLIO Benchmarking, Debugging, and Port Detection

Layer / File(s) Summary
CI port detection with environment-aware probing
ci/util/port_utils.py, ci/autoresearch/phases.py, ci/tests/test_autoresearch_phases.py
auto_detect_upload_port() accepts optional expected_environment parameter; new environment_to_chip() maps PlatformIO environments to ESP chip types; port-resolution phase threads expected environment through detection attempts and retry loops with validation assertions in test cases.
PARLIO debug metrics and underrun tracking contracts
src/platforms/esp/32/drivers/parlio/parlio_debug.h, src/platforms/esp/32/drivers/parlio/parlio_isr_context.h, src/platforms/esp/32/drivers/parlio/channel_driver_parlio.cpp.hpp
ParlioDebugMetrics extended with TX-done/worker-ISR/underrun/ring counters and ring-error/hardware-idle flags; ParlioIsrContext adds volatile mUnderrunCount field initialized to zero; public getter bridges engine metrics into the metrics struct.
PARLIO engine PSRAM-aware ring allocation and underrun tracking
src/platforms/esp/32/drivers/parlio/parlio_engine.cpp.hpp
Heap-capability helpers detect DMA-capable PSRAM availability; ring allocation uses PSRAM-sized capacities only when DMA heap exists, with SRAM fallback on failure; ISR increments underrun counter when ring empties before transmission completes; getDebugMetrics() populates all extended debug fields.
PARLIO streaming validation with debug metrics and TX pin support
examples/AutoResearch/AutoResearchParlioStream.h, examples/AutoResearch/AutoResearchRemote.cpp
ValidateResult expanded with per-lane TX pins, explicit-pin flag, base pin, and PARLIO debug metrics; validateParlioStreaming() accepts optional tx_pins array and derives base pin; RPC interface supports baseTxPin/txPins arguments and returns expanded diagnostics including TX-done/ISR/underrun/ring/byte counters and pin mappings.
PARLIO encode benchmark with BF1 pipe4 and PSRAM tracking
examples/AutoResearch/AutoResearchParlioEncode.h, examples/AutoResearch/AutoResearchRemote.cpp
Benchmark hotpath replaced with BF1 pipe4 four-byte-position and single-byte helpers; allocation workflow allocates SRAM first, then conditionally allocates PSRAM with fallback, setting scratch_psram_ok/output_psram_ok flags; RPC response includes PSRAM flags and computed per-frame timing fields when iterations available.
AutoResearch sketch watchdog, serial readiness, and board configuration
examples/AutoResearch/AutoResearch.ino, ci/boards/esp32-c6-devkitc-1.json
Added ESP32 watchdog include and fl::watchdog_setup() call; replaced SERIAL_TIMEOUT_MS macro with static constexpr and introduced platform-specific AUTORESEARCH_SERIAL_WAIT_MS shorter value for ESP32-S3/C3/C6/H2/ESP32P4; updated serial wait to use fl::serial_ready() with new timing; reduced ESP32-C6 flash size from 8MB to 4MB.
USB Serial JTAG one-byte peek caching for non-blocking availability
src/platforms/esp/32/drivers/usb_serial_jtag_esp32.h, src/platforms/esp/32/drivers/usb_serial_jtag_esp32_idf.hpp
Added mHasPeek flag and mPeekByte field for caching; constructor, move constructor, and move-assignment operator now initialize/transfer peek state; available() implements non-blocking single-byte read with caching instead of returning zero; read() consumes cached byte when present.
Serial backend selection refinement and logging cleanup
src/platforms/esp/32/io_esp.cpp.hpp, src/platforms/esp/32/drivers/lcd_spi/channel_driver_lcd_clockless.cpp.hpp, src/platforms/esp/32/drivers/lcd_spi/lcd_spi_peripheral_esp.cpp.hpp, src/platforms/esp/32/drivers/_build.cpp.hpp
Refined FL_ESP_USE_IDF_SERIAL preprocessor condition to select ESP-IDF UART backend based on chip variant and Arduino USB configuration; removed warning logs from LCD SPI transmit failures and semaphore timeouts while preserving error handling; added ESP32 UART IDF and USB Serial JTAG IDF driver headers to unity-build root includes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related issues

Possibly related PRs

  • FastLED/FastLED#2561: Modifies AutoResearchParlioStream.h and is related to PARLIO streaming validation changes.
  • FastLED/FastLED#2547: Introduced/overlaps with PARLIO encode benchmark and RPC wiring changes touched here.
  • FastLED/FastLED#2564: Also extends PARLIO streaming validation interfaces and may overlap at shared interfaces.

Poem

🐰 I hopped through ports and PSRAM night,
Probed chips by moon and debug light,
Peeked a byte and warmed the ring,
Benchmarks hum while metrics sing,
The rabbit stamps the merge with delight.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 34.78% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: landing C6 streaming diagnostics for PARLIO, which aligns with the PR's focus on adding C6-aware PARLIO metrics, underrun tracking, and AutoResearch RPC reporting.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/parlio-local-work

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Jun 2, 2026
coderabbitai[bot]
coderabbitai Bot previously requested changes Jun 2, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
src/platforms/esp/32/drivers/usb_serial_jtag_esp32_idf.hpp (1)

302-320: ⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

available() no longer reports the buffered byte count.

Both src/platforms/esp/32/drivers/usb_serial_jtag_esp32.h and src/fl/system/serial.h document available() as a byte count, but this implementation can only return 0 or 1. That breaks the serial contract for any caller that gates on available() >= n and underreports queued RX data once more than one byte is buffered.

🤖 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 `@src/platforms/esp/32/drivers/usb_serial_jtag_esp32_idf.hpp` around lines 302
- 320, UsbSerialJtagEsp32::available currently returns only 0/1 because it only
checks mHasPeek or reads one byte with usb_serial_jtag_read_bytes; change it to
return the full buffered RX byte count per the serial contract: query the
driver's buffered byte count API (e.g., a function like
usb_serial_jtag_get_buffered_data_len or usb_serial_jtag_get_buffered_bytes) and
return that count plus (mHasPeek ? 1 : 0) while preserving mPeekByte/mHasPeek,
and if no such driver API exists, read all currently-available bytes
non-blocking into the class RX buffer (or stash them starting with mPeekByte)
and return the total buffered length; update UsbSerialJtagEsp32::available,
keeping references to mBuffered, mHasPeek, mPeekByte and
usb_serial_jtag_read_bytes to locate the logic to modify.
src/platforms/esp/32/drivers/parlio/parlio_engine.cpp.hpp (1)

611-618: ⚠️ Potential issue | 🔴 Critical | 🏗️ Heavy lift

Underruns currently drop the engine into a false READY state.

Line 613 clears mTransmitting before any buffer is re-submitted. workerIsrCallback() only refills the ring, and poll() later short-circuits to READY on Line 2144 when mTransmitting is false. That means the first underrun can make chunked frames larger than the ring stop draining with buffered data still pending.

🤖 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 `@src/platforms/esp/32/drivers/parlio/parlio_engine.cpp.hpp` around lines 611 -
618, Underrun handling clears ctx->mTransmitting too early (before
workerIsrCallback repopulates the ring), causing poll() to treat the engine as
READY while buffered data remains; to fix, do not clear ctx->mTransmitting
before attempting to refill—either move the ctx->mTransmitting = false
assignment to after workerIsrCallback returns and only clear it if the worker
did not re-submit any buffers (or check the ring/queue emptiness), or call
workerIsrCallback first and then update ctx->mTransmitting based on whether new
buffers were queued; keep the underrun counter (ctx->mUnderrunCount) and
mHardwareIdle update as-is but ensure mTransmitting reflects actual pending work
so poll() won’t short-circuit.
🧹 Nitpick comments (1)
ci/tests/test_autoresearch_phases.py (1)

332-373: ⚡ Quick win

Add a regression case for an inconclusive probe.

These assertions cover the happy path, but not the case where auto_detect_upload_port(expected_environment=...) gets only probe failures and should still keep the port usable via fallback selection. A test for that path would catch the current hard-fail regression before it reaches the hardware loop.

🤖 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/tests/test_autoresearch_phases.py` around lines 332 - 373, Add a
regression test that mocks auto_detect_upload_port to return an inconclusive
probe (e.g., MagicMock(ok=False, selected_port="COMx")) and verifies
_resolve_port_and_environment still accepts the selected_port as a usable
fallback; patch f"{_PATCH_MOD}.auto_detect_upload_port" and
f"{_PATCH_MOD}.select_build_driver" and keep get_default_environment patched as
in the existing tests, then assert rc is None, ctx.upload_port equals the mocked
selected_port and auto_detect_upload_port was called with the
expected_environment (use _resolve_port_and_environment, select_build_driver and
expected_environment strings like "esp32s3"/"esp32c6" to locate the code paths).
🤖 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/util/port_utils.py`:
- Line 69: The public helper auto_detect_upload_port currently defines a
defaulted parameter expected_environment: str | None = None which violates the
repo rule forbidding default parameter values; change the function signature to
expected_environment: str | None (no default) in auto_detect_upload_port and
update every call site to pass an explicit value (use None where callers relied
on the old default). Ensure the type annotation remains and adjust any tests or
usages that call auto_detect_upload_port() with no arguments to call
auto_detect_upload_port(None) instead.
- Around line 134-165: The code currently aborts port resolution if every
detect_attached_chip() call fails; instead only produce a
ComportResult(ok=False, ...) when you have positive detection evidence that none
match the expected environment. Modify the loop in
_resolve_port_and_environment: collect probe_notes as before but track whether
any detect_attached_chip() returned ok (e.g., saw_positive_detection) and
whether any detected_env was present but different; if at least one probe
succeeded but none matched expected_env, return the ComportResult failure (use
environment_to_chip(expected_env) or expected_environment in the message); if no
probes succeeded at all, do not return here — allow the function to fall through
to the existing USB descriptor-based selection heuristic.

In `@examples/AutoResearch/AutoResearchRemote.cpp`:
- Around line 1762-1779: The txPins parsing currently silently skips
non-integers and compacts entries; instead validate strictly in the txPins
handling: if config["txPins"] is an array, ensure its size equals numLanes (or
reject if numLanes not provided) and verify every element is an integer within
allowed range (and within autoresearch::parlio_stream::kMaxLanes); on any
invalid element or length mismatch, return InvalidArgs rather than compacting
(do not modify tx_pins, parsed_lanes, has_tx_pins, num_lanes, or base_tx_pin);
apply the same strict validation and rejection logic to the rxPins parsing block
(the code around the rx_pins parsing at lines 1783-1794) so malformed arrays are
refused instead of being truncated or packed.

In `@src/platforms/esp/32/drivers/parlio/parlio_debug.h`:
- Around line 26-32: The public debug contract is out of sync: extend the
exported ParlioDebugMetrics struct and its getParlioDebugMetrics() mapper to
include the new fields (mTxDoneCount, mWorkerIsrCount, mUnderrunCount,
mRingCount, mErrorCode, mRingError, mHardwareIdle) so callers can observe the
new counters and flags; update the ParlioDebugMetrics definition and the
function that assembles/returns it (getParlioDebugMetrics) to map the new
members from the driver-side representation to the public struct and adjust any
serialization or consumers that assume the old shape.

---

Outside diff comments:
In `@src/platforms/esp/32/drivers/parlio/parlio_engine.cpp.hpp`:
- Around line 611-618: Underrun handling clears ctx->mTransmitting too early
(before workerIsrCallback repopulates the ring), causing poll() to treat the
engine as READY while buffered data remains; to fix, do not clear
ctx->mTransmitting before attempting to refill—either move the
ctx->mTransmitting = false assignment to after workerIsrCallback returns and
only clear it if the worker did not re-submit any buffers (or check the
ring/queue emptiness), or call workerIsrCallback first and then update
ctx->mTransmitting based on whether new buffers were queued; keep the underrun
counter (ctx->mUnderrunCount) and mHardwareIdle update as-is but ensure
mTransmitting reflects actual pending work so poll() won’t short-circuit.

In `@src/platforms/esp/32/drivers/usb_serial_jtag_esp32_idf.hpp`:
- Around line 302-320: UsbSerialJtagEsp32::available currently returns only 0/1
because it only checks mHasPeek or reads one byte with
usb_serial_jtag_read_bytes; change it to return the full buffered RX byte count
per the serial contract: query the driver's buffered byte count API (e.g., a
function like usb_serial_jtag_get_buffered_data_len or
usb_serial_jtag_get_buffered_bytes) and return that count plus (mHasPeek ? 1 :
0) while preserving mPeekByte/mHasPeek, and if no such driver API exists, read
all currently-available bytes non-blocking into the class RX buffer (or stash
them starting with mPeekByte) and return the total buffered length; update
UsbSerialJtagEsp32::available, keeping references to mBuffered, mHasPeek,
mPeekByte and usb_serial_jtag_read_bytes to locate the logic to modify.

---

Nitpick comments:
In `@ci/tests/test_autoresearch_phases.py`:
- Around line 332-373: Add a regression test that mocks auto_detect_upload_port
to return an inconclusive probe (e.g., MagicMock(ok=False,
selected_port="COMx")) and verifies _resolve_port_and_environment still accepts
the selected_port as a usable fallback; patch
f"{_PATCH_MOD}.auto_detect_upload_port" and f"{_PATCH_MOD}.select_build_driver"
and keep get_default_environment patched as in the existing tests, then assert
rc is None, ctx.upload_port equals the mocked selected_port and
auto_detect_upload_port was called with the expected_environment (use
_resolve_port_and_environment, select_build_driver and expected_environment
strings like "esp32s3"/"esp32c6" to locate the code paths).
🪄 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: d30d4331-1060-4be2-8705-7bd4a4a36021

📥 Commits

Reviewing files that changed from the base of the PR and between 0255432 and 2206908.

📒 Files selected for processing (17)
  • ci/autoresearch/phases.py
  • ci/boards/esp32-c6-devkitc-1.json
  • ci/tests/test_autoresearch_phases.py
  • ci/util/port_utils.py
  • examples/AutoResearch/AutoResearch.ino
  • examples/AutoResearch/AutoResearchParlioEncode.h
  • examples/AutoResearch/AutoResearchParlioStream.h
  • examples/AutoResearch/AutoResearchRemote.cpp
  • src/platforms/esp/32/drivers/_build.cpp.hpp
  • src/platforms/esp/32/drivers/lcd_spi/channel_driver_lcd_clockless.cpp.hpp
  • src/platforms/esp/32/drivers/lcd_spi/lcd_spi_peripheral_esp.cpp.hpp
  • src/platforms/esp/32/drivers/parlio/parlio_debug.h
  • src/platforms/esp/32/drivers/parlio/parlio_engine.cpp.hpp
  • src/platforms/esp/32/drivers/parlio/parlio_isr_context.h
  • src/platforms/esp/32/drivers/usb_serial_jtag_esp32.h
  • src/platforms/esp/32/drivers/usb_serial_jtag_esp32_idf.hpp
  • src/platforms/esp/32/io_esp.cpp.hpp
💤 Files with no reviewable changes (2)
  • src/platforms/esp/32/drivers/lcd_spi/channel_driver_lcd_clockless.cpp.hpp
  • src/platforms/esp/32/drivers/lcd_spi/lcd_spi_peripheral_esp.cpp.hpp

Comment thread ci/util/port_utils.py Resolved
Comment thread ci/util/port_utils.py Resolved
Comment on lines +1762 to +1779
if (config.contains("txPins") && config["txPins"].is_array()) {
int parsed_lanes = 0;
const fl::json pins = config["txPins"];
for (size_t i = 0;
i < pins.size() && i < autoresearch::parlio_stream::kMaxLanes;
++i) {
if (!pins[i].is_int()) {
continue;
}
tx_pins[parsed_lanes++] = static_cast<int>(pins[i].as_int().value());
}
if (parsed_lanes > 0) {
has_tx_pins = true;
if (!(config.contains("numLanes") && config["numLanes"].is_int())) {
num_lanes = parsed_lanes;
}
base_tx_pin = tx_pins[0];
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Reject malformed txPins instead of compacting them.

This parser silently skips non-integer entries and packs later pins leftward, so a request like [0, "bad", 2] is executed as a different lane map while the RPC still reports success. For a hardware-diagnostics command, that makes the result misleading. Return InvalidArgs when any txPins[i] is invalid, and reject arrays whose length does not match numLanes instead of truncating/clamping.

Also applies to: 1783-1794

🤖 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 `@examples/AutoResearch/AutoResearchRemote.cpp` around lines 1762 - 1779, The
txPins parsing currently silently skips non-integers and compacts entries;
instead validate strictly in the txPins handling: if config["txPins"] is an
array, ensure its size equals numLanes (or reject if numLanes not provided) and
verify every element is an integer within allowed range (and within
autoresearch::parlio_stream::kMaxLanes); on any invalid element or length
mismatch, return InvalidArgs rather than compacting (do not modify tx_pins,
parsed_lanes, has_tx_pins, num_lanes, or base_tx_pin); apply the same strict
validation and rejection logic to the rxPins parsing block (the code around the
rx_pins parsing at lines 1783-1794) so malformed arrays are refused instead of
being truncated or packed.

coderabbitai[bot]
coderabbitai Bot previously requested changes Jun 2, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
ci/autoresearch/runner.py (1)

99-104: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Use final_environment when resolving the decode port.

This branch already knows the expected environment, but Line 103 passes None and skips the new chip probe. If several boards are connected, decode mode can attach to the wrong device.

Suggested fix
-                port_result = auto_detect_upload_port(None)
+                port_result = auto_detect_upload_port(final_environment)
🤖 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/autoresearch/runner.py` around lines 99 - 104, The code is passing None to
auto_detect_upload_port when resolving the decode/upload port, which ignores the
known ctx.final_environment and can attach to the wrong board; change the call
in the final_environment branch to pass final_environment (or
ctx.final_environment) instead of None so auto_detect_upload_port receives the
expected environment and can probe the correct chip when upload_port is not
provided.
ci/autoresearch/driver_sweep.py (1)

518-523: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Pass the target environment into port auto-detection.

This path builds/uploads esp32c6, but Line 522 passes None and disables the new environment-aware probe. With more than one board attached, the sweep can bind to the wrong device.

Suggested fix
-        result = auto_detect_upload_port(None)
+        result = auto_detect_upload_port("esp32c6")
🤖 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/autoresearch/driver_sweep.py` around lines 518 - 523, The port
auto-detection call currently passes None to auto_detect_upload_port, which
disables environment-aware probing; update the call in driver_sweep.py (where
port is set and auto_detect_upload_port is invoked) to pass the target
environment (e.g., args.env or the variable holding the build target like
"esp32c6") instead of None so the probe filters by board type; ensure the
argument you pass matches the auto_detect_upload_port signature used elsewhere
(adjust the call to auto_detect_upload_port(args.env) or the appropriate target
variable).
🤖 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/debug_attached.py`:
- Around line 1255-1259: The upload port auto-detection is being called with
None which bypasses the environment-aware ESP probe; change the call to
auto_detect_upload_port to pass the resolved environment (args.environment)
instead of None so auto_detect_upload_port(args.environment) uses the correct
target environment when selecting among multiple USB devices (refer to
args.upload_port, args.environment, and auto_detect_upload_port).

---

Outside diff comments:
In `@ci/autoresearch/driver_sweep.py`:
- Around line 518-523: The port auto-detection call currently passes None to
auto_detect_upload_port, which disables environment-aware probing; update the
call in driver_sweep.py (where port is set and auto_detect_upload_port is
invoked) to pass the target environment (e.g., args.env or the variable holding
the build target like "esp32c6") instead of None so the probe filters by board
type; ensure the argument you pass matches the auto_detect_upload_port signature
used elsewhere (adjust the call to auto_detect_upload_port(args.env) or the
appropriate target variable).

In `@ci/autoresearch/runner.py`:
- Around line 99-104: The code is passing None to auto_detect_upload_port when
resolving the decode/upload port, which ignores the known ctx.final_environment
and can attach to the wrong board; change the call in the final_environment
branch to pass final_environment (or ctx.final_environment) instead of None so
auto_detect_upload_port receives the expected environment and can probe the
correct chip when upload_port is not provided.
🪄 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: ee465d98-7aa8-42c3-82f2-330695807708

📥 Commits

Reviewing files that changed from the base of the PR and between 2206908 and ef4e40f.

📒 Files selected for processing (12)
  • ci/autoresearch/driver_sweep.py
  • ci/autoresearch/runner.py
  • ci/debug/validate_port_kill.py
  • ci/debug_attached.py
  • ci/tests/test_autoresearch_phases.py
  • ci/util/port_utils.py
  • examples/AutoResearch/AutoResearchRemote.cpp
  • src/platforms/esp/32/drivers/parlio/channel_driver_parlio.cpp.hpp
  • src/platforms/esp/32/drivers/parlio/channel_driver_parlio.h
  • src/platforms/esp/32/drivers/parlio/parlio_engine.cpp.hpp
  • src/platforms/esp/32/drivers/usb_serial_jtag_esp32.h
  • src/platforms/esp/32/drivers/usb_serial_jtag_esp32_idf.hpp
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/platforms/esp/32/drivers/parlio/parlio_engine.cpp.hpp
  • examples/AutoResearch/AutoResearchRemote.cpp

Comment thread ci/debug_attached.py Resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant