Skip to content

Phase 1: ConnectionSupervisor, saved profiles, auto-reconnect - #20

Merged
hardcoreerik merged 1 commit into
mainfrom
feat/connection-supervisor-profiles
Aug 6, 2026
Merged

Phase 1: ConnectionSupervisor, saved profiles, auto-reconnect#20
hardcoreerik merged 1 commit into
mainfrom
feat/connection-supervisor-profiles

Conversation

@hardcoreerik

Copy link
Copy Markdown
Owner

Summary

  • ConnectionProfile dataclass — transport + host/port/address/serial fields, with a connection_target property for display
  • ConnectionSupervisor — watches the controller for CONNECTION_LOST and schedules exponential-backoff retries ([2, 5, 15, 30, 60] s). Only fires after the radio was successfully connected at least once this session (prevents retry loops on a mistyped host or unpaired device)
  • RECONNECTING state activated — was defined in the enum and UI tables but never emitted; now set via a new enter_reconnecting() slot on MeshtasticWorker, and the connect guards accept it as a valid starting state for reconnect attempts
  • Profile persistenceget_setting/set_setting wired to the existing app_settings table (was in schema since Phase 0 but never read or written); profile saved on every successful connect, restored into ConnectionBar on next launch
  • NetworkSession stampingtransport and connection_target now updated on first connect and written to the DB
  • MainWindow wiring — four intercepting handlers (_on_connect_tcp/ble/serial_requested, _on_disconnect_requested) call supervisor.set_profile() / supervisor.cancel() before delegating to the controller

Test plan

  • tests/test_monitor_store_settings.py — 8 cases: missing key, round-trip, overwrite, empty string, numeric string, independent keys, persistence across restart
  • tests/test_connection_supervisor.py — 17 cases: load_profile (None/tcp/invalid port), set/save profile, cancel, _on_connected, _on_error (lost→retry, no prior connect, wrong code, active retry increment), _attempt_reconnect (tcp/ble/serial/inactive)
  • Full suite: 391/392 pass; the one pre-existing failure is pyqtgraph not installed in CI

🤖 Generated with Claude Code

- Add ConnectionProfile dataclass (transport, host/port/address/serial)
- Add ConnectionSupervisor: watches for CONNECTION_LOST, schedules
  exponential-backoff retries ([2, 5, 15, 30, 60] s), only fires after
  the radio was successfully connected at least once this session
- Activate the RECONNECTING state (was defined but never emitted before)
  via a new enter_reconnecting() slot on MeshtasticWorker; allow
  RECONNECTING in connect_* state guards so supervisor-initiated retries
  can proceed
- Add get_setting / set_setting to MonitorStore backed by the existing
  app_settings table (was in schema but never read/written)
- Persist last-used connection profile on every successful connect;
  restore it into ConnectionBar on next launch
- Stamp NetworkSession.transport / connection_target on first connect
- Add intercepting handlers in MainWindow (_on_connect_tcp/ble/serial
  and _on_disconnect) that update the supervisor before calling the
  controller
- Tests: test_monitor_store_settings (8 cases), test_connection_supervisor
  (17 cases); 391/392 suite-wide pass (pre-existing pyqtgraph gap)

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@hardcoreerik, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 9 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: acf99f41-23b0-4550-832c-4fbbbdf38685

📥 Commits

Reviewing files that changed from the base of the PR and between 8455a48 and 25ca8a1.

📒 Files selected for processing (8)
  • src/meshchat/controllers/meshtastic_controller.py
  • src/meshchat/models/connection_profile.py
  • src/meshchat/services/connection_supervisor.py
  • src/meshchat/services/monitor_store.py
  • src/meshchat/ui/main_window.py
  • src/meshchat/ui/widgets/connection_bar.py
  • tests/test_connection_supervisor.py
  • tests/test_monitor_store_settings.py

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@hardcoreerik
hardcoreerik merged commit 271a9f5 into main Aug 6, 2026
1 of 3 checks passed
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