Skip to content

Restore MQTT communication after broker restarts - #103

Merged
BenCodez merged 1 commit into
mainfrom
codex/mqtt-broker-recovery
Oct 1, 2026
Merged

BenCodez merged 1 commit into
mainfrom
codex/mqtt-broker-recovery

Conversation

@BenCodez

@BenCodez BenCodez commented Oct 1, 2026

Copy link
Copy Markdown
Owner

Problem

A broker restart leaves the existing MQTT client disconnected indefinitely: the four-string constructor disabled Paho automatic reconnect and registered no recovery callback. Restarting a service manually is not recovery.

Change

Own one cancellable recovery task with 1–60 second backoff. Restore bounded desired subscriptions (topic, QoS, original listener) after connection or SUBACK failure. Explicit disconnect stops recovery; reconnect permits reuse; terminal close releases Paho and the owned executor. MqttHandler's terminal disconnect closes both executors. A late CONNECT cannot resurrect a stopped transport.

Existing constructors, publish APIs, clean-session behavior, topic and payload formats remain compatible. Disconnected publishes still fail: existing durable owners retry them. MQTT/QoS is not transactional exactly-once reward execution; VotingPlugin's stable vote IDs and receipts retain that responsibility.

Validation

  • Seven focused tests passed, including a real ephemeral loopback Mosquitto restart with bidirectional restoration and no manual reconnect/resubscription.
  • Deterministic cancellation, delayed CONNECT completion, failed SUBACK, bounded exponential retry and subscription capacity coverage.
  • mvn -B -f SimpleAPI/pom.xml clean package: 430 tests plus two full-artifact and one shared-artifact checks passed, 2m18s.
  • Diff check and fresh independent read-only review: No findings.

MCHT finding: 20261001T013742829677Z-8713aa34d655. Focused exact-candidate MCHT verification remains pending active-run coordination; no full matrix or exactly-once integration result is claimed.

Release order: publish SimpleAPI, rebuild AdvancedCore and VotingPlugin so the shaded MQTT implementation is actually updated.

@coderabbitai

coderabbitai Bot commented Oct 1, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 5cd92757-3ade-4016-9e79-34057cc209b7

  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review ✅ Completed 2026-10-01T03:44:58.303491Z 285e0af PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@BenCodez
BenCodez merged commit 56baad0 into main Oct 1, 2026
5 checks passed
@BenCodez
BenCodez deleted the codex/mqtt-broker-recovery branch October 1, 2026 22:20
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