Repository navigation
fix(autoresearch): arm WDT at top of setup() so boot hangs don't wedge COM port - #3552
Merged
Merged
Conversation
…e COM port Previously the unified WDT was armed lazily by FL_WATCHDOG_AUTO() at the top of loop(). If setup() hung (RPC bind null-deref, stalled static-init, wedged serial handshake), no WDT was armed and the COM port stayed owned by a dead sketch until manual power-cycle. Arm the WDT with a 20 s window at the very top of setup() so a hang here auto-reboots. Feed the WDT in the serial-monitor wait loop because on classic ESP32 (non-USB-CDC) that loop can span up to AUTORESEARCH_SERIAL_WAIT_MS = 120 s, well past the setup WDT window. FL_WATCHDOG_AUTO() at loop() top re-arms with the shorter loop-scoped timeout once setup() has finished. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe AutoResearch example is updated to arm the watchdog explicitly at the start of setup() with a new longer timeout constant, and the serial readiness wait loop is changed to periodically feed the watchdog while waiting, preventing hangs before loop() begins. ChangesAutoResearch Watchdog Setup Flow
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant Setup as setup()
participant Watchdog as fl::Watchdog
participant Serial as fl::serial_ready()
Setup->>Watchdog: begin(AUTORESEARCH_SETUP_WATCHDOG_TIMEOUT_MS)
loop Waiting for serial monitor
Setup->>Serial: check serial_ready()
Setup->>Watchdog: feed()
end
Setup->>Setup: continue initialization
Possibly related PRs
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
13 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Previously the unified WDT was armed lazily by
FL_WATCHDOG_AUTO()at the top ofloop(). Ifsetup()hung — e.g., a null-deref inside an RPC bind lambda, a stalled singleton static-init, or a wedged serial handshake — no WDT was armed and the COM port stayed owned by a dead sketch until manual power-cycle. This turned every setup-phase bug into a lost port.Change
setup()viafl::Watchdog::instance().begin(AUTORESEARCH_SETUP_WATCHDOG_TIMEOUT_MS).AUTORESEARCH_SERIAL_WAIT_MS = 120 s— far past the 20 s setup window.FL_WATCHDOG_AUTO()at the top ofloop()re-arms with the shorter loop-scoped timeout (5 s) oncesetup()has finished.20 s is generous enough for cold boot (RPC handler registration for ~65 binds, PSRAM RX-buffer allocation, FastLED singleton init, driver enumeration) yet short enough that host-side autoresearch RPC timeouts (default 30 s) surface the reboot cleanly.
The low-memory
autoResearchLowMemorySetup()path already arms the WDT viafl::Watchdog::instance().begin(3000), so that path is untouched.Test plan
bash compile esp32dev --examples AutoResearch --no-filter— SUCCESS{\"type\":\"status\",\"ready\":true,...}heartbeats after WDT-driven recovery from a first-boot panicStoreProhibitedpanic infl::json::json(const char*)— separate bug, WDT-recovery now unwedges the port🤖 Generated with Claude Code
Summary by CodeRabbit