Skip to content

[autoresearch] Make --auto-discover-pins the default; sweep docs so agents don't get stuck #3296

Closed

Description

@zackees

Problem

bash autoresearch <board> does not auto-discover the wired loopback pins by default. Today the agent must remember to pass --auto-discover-pins, and if it forgets, the harness uses hard-coded default pin numbers that may not match the board's actual wiring -- the bench validation silently runs against the wrong pins and either fails confusingly or worse, "succeeds" because the wrong pins happen to also be wired somewhere.

This bit a /clud-fix session on #3102: the agent ran bash autoresearch lpc845brk (no flag), did not know about --auto-discover-pins, and could not derive the right invocation from the in-tree docs. The README that documents the four validation phases (src/platforms/arm/lpc/README.md) does not mention --auto-discover-pins at all, so reading the docs first does not surface the flag.

Proposed work

1. Flip the default

  • --auto-discover-pins becomes the default behavior of bash autoresearch <board>.
  • Add --no-auto-discover-pins as the opt-out for callers that want to pin the tx/rx explicitly (e.g. for a known-bad wiring debug session, or for CI determinism).
  • The existing --tx-pin / --rx-pin flags continue to work and implicitly override the auto-discovery for those specific pins.

Acceptance:

  • bash autoresearch lpc845brk (no flags) runs the discovery sweep on its own.
  • bash autoresearch lpc845brk --no-auto-discover-pins falls back to the hard-coded default tx/rx pins (current behavior of the unflagged invocation).
  • bash autoresearch lpc845brk --tx-pin P0_10 --rx-pin P0_11 (no other flags) uses the provided pins without running discovery -- explicit overrides win.

2. Documentation sweep

The flag's absence from the docs is what trapped the agent. Sweep these surfaces so future agents (and humans) cannot get stuck:

  • src/platforms/arm/lpc/README.md -- the "Hardware verification via AutoResearch loopback (hardware: bring up LPC845 + WS2812 + AutoResearch UART (Stages 3.5, 3.6 from #2845) #2880)" section. Mention the default + opt-out flag explicitly. Update the four-phase example commands so the canonical form reflects post-flip behavior.
  • agents/docs/hardware-autoresearch.md -- the agent-facing autoresearch guide. Add a "Pin discovery" subsection documenting the default + opt-out + override precedence. Add an "Agent should know" callout.
  • examples/AutoResearch/AutoResearch.ino header comment -- if it mentions tx/rx pin conventions, link to the autoresearch doc instead of restating fixed numbers.
  • ci/autoresearch/__main__.py argparse --auto-discover-pins / --no-auto-discover-pins help strings -- mention "default: enabled" and "use this to disable" so --help is the source of truth.
  • CLAUDE.md -- the project rules list bash autoresearch --parlio as an example. Add a note that pin discovery is automatic by default, so future agents reading CLAUDE.md know.

3. Related: serial-port access errors

Adjacent (not strictly part of this issue, but related to the same "agent gets stuck on autoresearch" failure mode): when COM<N> is held by another process (VS Code's serial monitor, leftover PuTTY, the previous autoresearch run that didn't release cleanly), autoresearch prints a clear error but doesn't suggest the fix. A one-line "is another monitor open on this port?" hint after the PermissionError(13) would help. Optional but worth bundling.

Acceptance criteria

  • Default-on behavior implemented + tested via unit-test mock of pin-discovery sweep.
  • --no-auto-discover-pins opt-out wired and tested.
  • Docs sweep complete: every surface listed above mentions the new default.
  • bash autoresearch lpc845brk --bring-up (if --bring-up doesn't exist, document the actual default-phase invocation) works first-try without any pin-flag for an agent who reads only the README.
  • CLAUDE.md's autoresearch line gets a "pin discovery is automatic" note.

Out of scope

  • Changing the pin-discovery algorithm itself (just changing default + docs).
  • The COM-port-busy error message improvement (separable; file a sub-issue if not bundled).
  • AutoResearch RPC schema changes.

Refs

Filed during /clud-fix burn-down on #3208 -- ran into the missing default + missing docs while attempting to validate #3102. Future agents reading this should be able to invoke bash autoresearch <board> and have it Just Work, with the README pointing at the opt-out for the edge cases.

Activity

  1. zackees commented on Jun 19, 2026

    @zackees
    MemberAuthor

    Adding requirement: user-facing notification on LED-driver runs

    When the script enters a phase that tests an LED driver (e.g. --ws2812-loopback, --parlio, --rmt, --spi, --lcd-spi, --lcd-rgb, --object-fled, --flex-io, --lpuart -- any phase whose purpose is driving real LEDs and reading them back), and auto-discover-pins is active (default per the proposal above), emit a green stdout line:

    ```
    [green] auto discover pins is ACTIVE for LED-driver testing — pass --no-auto-discover-pins if this is not desired
    ```

    Rationale: when you're hooking up a real LED strip on specific pins, you usually want explicit pin control (you wired what you wired); auto-discovery scanning unrelated pins during an LED test is at best confusing and at worst could drive an unintended GPIO into output mode mid-test. The user should see the discovery banner BEFORE the LED test starts so they have a chance to abort and rerun with --no-auto-discover-pins if discovery isn't appropriate for their setup.

    Color: green per the user spec. Suggested implementation: use whatever colorized-stdout helper autoresearch already uses (fl_emit_color / print(termcolor.colored(..., 'green')) / similar) -- consistent with the rest of the harness's success-banner style.

    Adds to the acceptance criteria above:

    • When --auto-discover-pins is active AND the selected phase is an LED-driver test (list the qualifying phase flags in the implementation), the harness prints the green banner above stdout before phase work begins.
    • The banner is suppressed when --no-auto-discover-pins is passed (no point telling the user about a thing they disabled).
    • The banner is suppressed when --quiet is passed (consistent with existing harness banner suppression).
  2. zackees commented on Jun 23, 2026

    @zackees
    MemberAuthor

    Tracking this under the new LPC845-BRK / LPC8xx AutoResearch coordination meta: #3348.

    Keeping this issue open because the implementation appears only partial: pin auto-discovery defaults exist, but the docs sweep and green LED-driver banner acceptance still need closeout.

  3. added a commit that references this issue on Jun 27, 2026
    fbc8857
  4. moved this from Triage to Done in FastLED Trackeron Jun 27, 2026
  5. added a commit that references this issue on Jun 27, 2026
    91d25e4
  6. added a commit that references this issue on Jun 27, 2026
    bc083a1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions