Skip to content

feat(serial): detect crash/reset events in board output - #27

Merged
mixelpixx merged 1 commit into
mainfrom
feat-serial-events
Jul 27, 2026
Merged

feat(serial): detect crash/reset events in board output#27
mixelpixx merged 1 commit into
mainfrom
feat-serial-events

Conversation

@mixelpixx

Copy link
Copy Markdown
Owner

Third of the v0.6.0 series (pain point 3: the tooling watched a board crash-loop five times and said nothing).

What changed

The serial line scanner (from #26) now classifies crash signatures:

Event Signature Detail captured
reset rst:0x… (REASON) reset reason
panic Guru Meditation Error following Backtrace: line
watchdog Task watchdog got triggered / AVR wdt reset
brownout Brownout detector was triggered
abort abort() was called backtrace
  • Events come back on every read/wait_for response (paged reads only return events newer than since); get_config adds event_count/last_event.
  • A reset/panic/brownout/abort ends a pending wait_for early with the event attached — the awaited output isn't coming from a board that just crashed. Watchdog warnings only record (can be transient).

Verified on hardware (ESP32-S3, crash-on-command sketch driven over MCP)

  • esp_restart() → pending wait ended with {type: reset, detail: RTC_SW_CPU_RST}
  • Null-pointer store → {type: panic, line: "Guru Meditation Error: Core 1 panic'ed (StoreProhibited)…"} with the real backtrace attached as detail
  • abort() → recorded + reboot reset tracked (event_count: 6)
  • Watchdog signature matches the actual task_wdt lines this board printed during its real crash-loop; benign lines containing "reset" do not false-positive

🤖 Generated with Claude Code
EOF

The tooling used to watch a board crash-loop and say nothing: during the
first hardware session the chip panicked and rebooted five times while
serial reads cheerfully returned lines as if nothing happened - the only
tell was a duplicated boot banner the caller had to notice themselves. An
agent cannot distinguish "board is quiet" from "board is dead" without
this.

The line scanner now classifies crash signatures as it assembles lines:

  reset     rst:0x.. (REASON)            reason captured as detail
  panic     Guru Meditation Error        following Backtrace: attached as detail
  watchdog  Task watchdog got triggered / AVR "wdt reset"
  brownout  Brownout detector was triggered
  abort     abort() was called

Events (capped at 50) come back on every read/wait_for response - paged
reads only return events newer than `since` - and get_config reports
event_count/last_event. A reset, panic, brownout or abort also resolves any
pending wait_for early with the event attached: the output being waited for
is not coming from a board that just crashed. Watchdog warnings only record,
since they can be transient. clear() drops events; cursors stay monotonic.

Verified on the ESP32-S3 with a crash-on-command sketch driven over MCP:
esp_restart() ended a pending wait with {type:reset, detail:RTC_SW_CPU_RST};
a null-pointer store produced {type:panic, line:"Guru Meditation Error:
Core 1 panic'ed (StoreProhibited)..."} with the real backtrace attached as
detail; abort() recorded and rebooted; the watchdog signature matches the
task_wdt lines captured from this board's actual crash-loop, and benign
lines containing the word "reset" do not false-positive.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@mixelpixx
mixelpixx merged commit 087d86a into main Jul 27, 2026
@mixelpixx
mixelpixx deleted the feat-serial-events branch July 27, 2026 19:25
@mixelpixx
mixelpixx restored the feat-serial-events branch July 27, 2026 23:54
@mixelpixx
mixelpixx deleted the feat-serial-events branch July 27, 2026 23:54
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