feat(stability): startup-grace fast reconnect for Passive Mode (#3122)#3128
Conversation
Follow-up to #3125 / #3126. Closes the third item from the reporter's feedback on #3122. On large/fragile TCP nodes the *first* config-sync session frequently closes mid-stream but the second attempt works cleanly. Under normal exponential backoff that recovery would wait 8–16s before retrying; this short startup-grace window cuts that gap. * TcpTransport.setStartupGraceReconnect(graceMs, fastDelayMs): for the next graceMs after the call, scheduleReconnect uses fastDelayMs instead of the exponential backoff. After the window expires, normal backoff resumes automatically. Disabled by default (graceMs=0). * MeshtasticManager opt-in: passive-mode sources get a 2-minute grace window with a 3-second reconnect delay during initial startup. Other sources keep the legacy backoff. Tests: 6 new tcpTransport tests cover default-disabled, in-window fast delay regardless of attempt count, post-window exponential fallback, explicit disable, sanity, and that the reconnect fires after the configured delay. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Claude finished @Yeraze's task —— View job Pull Request ReviewReviewing the startup-grace fast reconnect implementation for Passive Mode... Todo List:
Code Quality & Best Practices ✅The implementation follows excellent coding practices:
Implementation Analysis ✅TcpTransport Changes (
MeshtasticManager Integration (
Bug Analysis ✅No bugs identified. The implementation is solid:
Performance Considerations ✅Positive impacts:
No performance concerns:
Security Assessment ✅No security concerns:
Test Coverage Analysis ✅Excellent test coverage with 6 comprehensive tests (
Tests use proper mocking and time manipulation, covering all code paths. Minor Suggestions
SummaryThis is a high-quality implementation that addresses a real user pain point. The code is well-structured, thoroughly tested, and follows established patterns. The feature is appropriately scoped to passive-mode sources where the issue was observed, and the auto-expiring grace window ensures it doesn't affect long-term behavior. Recommendation: APPROVE ✅ The PR successfully implements the requested fast reconnect feature with excellent code quality, comprehensive testing, and no identified issues. |
#3122) (#3129) Follow-up to #3125 / #3126 / #3128. Closes item 2 of the reporter's feedback on #3122 (advanced per-source setting for the staleness window). * SourceConfig gains optional passiveResyncStaleMs (ms). Falls back to the 4h class default when absent. * MeshtasticManager.effectivePassiveResyncStaleMs() resolves the active threshold, clamping out-of-range overrides ([1 min, 7 days]) so a 0 or astronomical value can't disable the safeguard. * Plumbed through all 5 MeshtasticManager construction sites in sourceRoutes; a change in the value triggers a transport restart alongside the existing passiveMode toggle. * UI: numeric "Resync staleness window (hours)" input appears under the Passive Mode toggle when enabled. Blank = use 4h default. Tests: 9 new tests cover default, constructor override, configureSource override + clear, below-floor / above-ceiling rejection, exact boundary acceptance, and NaN rejection. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Follow-up to #3125 / #3126. Closes item 3 of the reporter's feedback on #3122 (fast initial reconnect during the startup window).
Why
The reporter observed that a large infrastructure node consistently closes the first config-sync session — but recovers cleanly on the very next attempt. Under normal exponential backoff, MeshMonitor would wait 8–16 s before retrying, which translates to a long user-visible "stuck reconnecting" gap right at app start. The grace window collapses that gap on the path the reporter actually walks (passive-mode sources, fresh process start, first reconnect after the initial sync drops).
What
Constants live as class statics on `MeshtasticManager` (`STARTUP_GRACE_WINDOW_MS`, `STARTUP_GRACE_FAST_DELAY_MS`) — picked the reporter's exact recommended values: 2 min window, 3 s delay.
What's not in this PR
Test plan
🤖 Generated with Claude Code