Skip to content

feat(mcp): explain upload failures, attach explanations to failed tasks - #28

Merged
mixelpixx merged 1 commit into
mainfrom
feat-upload-explanations
Jul 27, 2026
Merged

feat(mcp): explain upload failures, attach explanations to failed tasks#28
mixelpixx merged 1 commit into
mainfrom
feat-upload-explanations

Conversation

@mixelpixx

Copy link
Copy Markdown
Owner

Fourth of the v0.6.0 series (pain point 4: upload errors got raw esptool text while compile errors got explanations).

What changed

  • Upload-failure signature table: esptool no-serial-data (native-USB vs UART port + BOOT-button recovery), wrong boot mode, chip/FQBN mismatch, port busy-or-missing, Linux dialout, vanished ports (native-USB re-enumeration), avrdude not-in-sync, brownout, mid-transfer timeout, generic esptool fallback last. Upload failures also consult the compile table (an upload can fail in its compile phase).
  • extractErrors keeps esptool/avrdude lines — previously a failed upload reported zero errors because esptool never prints error:.
  • Failed tasks carry result.explained directly — where agents actually look, no follow-up call needed. Never empty (falls back through structured errors → stderr → the task error string).
  • Tool-aware fallback fixes the "Compilation error occurred" mislabel on flashing failures.

Verified on hardware (ESP32-S3)

  • Upload to nonexistent COM99 → explained names the busy-or-missing cause honestly (esptool's own message is ambiguous between the two)
  • Upload to COM6 while the serial monitor held it → suggestion names the exact fix: arduino_serial disconnect
  • arduino_build_output format=explained after a failed upload no longer claims a compilation error

🤖 Generated with Claude Code
EOF

Compile failures had beginner-friendly explanations; upload failures - which
are MORE confusing because they are about hardware, ports and bootloaders -
returned raw esptool/avrdude text. Worse, extractErrors only kept lines
containing 'error:', which esptool never prints, so a failed upload reported
zero errors; and the explainError fallback hardcoded "Compilation error
occurred" even for flashing failures.

- Patterns move to module-level tables keyed by tool. The upload table covers
  the failures a real board actually produces: esptool no-serial-data (native
  USB vs UART-bridge port + BOOT-button guidance), wrong boot mode, chip/FQBN
  mismatch, port busy-or-missing, Linux dialout permissions, vanished ports
  (native-USB re-enumeration), avrdude not-in-sync, brownout, mid-transfer
  timeout, and a generic esptool fallback ordered last. Upload failures also
  consult the compile table, since an upload can fail in its compile phase.
- extractErrors now keeps esptool/avrdude failure lines.
- Failed tasks carry result.explained directly - the place agents actually
  look - via explainTaskFailure, which falls back through structured errors,
  stderr extraction, and the task error string, so it is never empty.
- arduino_build_output format=explained passes lastBuild.tool, and the
  fallback explanation is tool-aware.

Verified on hardware: upload to a nonexistent port and upload to a port held
by the serial monitor both returned failed tasks whose explained entries name
the real cause and the fix (including "disconnect the serial monitor");
build_output format=explained after a failed upload no longer claims a
compilation error.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@mixelpixx
mixelpixx merged commit 20d4eb0 into main Jul 27, 2026
@mixelpixx
mixelpixx deleted the feat-upload-explanations branch July 27, 2026 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant