Skip to content

fix(mavlink): harden endpoint transport lifecycle - #2164

Merged
mbuckton merged 1 commit into
developmentfrom
agent/mavlink-endpoint-hardening
Aug 10, 2026
Merged

fix(mavlink): harden endpoint transport lifecycle#2164
mbuckton merged 1 commit into
developmentfrom
agent/mavlink-endpoint-hardening

Conversation

@mbuckton

@mbuckton mbuckton commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Scope

Consolidates the endpoint/network-layer fixes reviewed from:

  • agent/mavlink-runtime-hardening
  • feature/mavlink-transport-lifecycle-fixes

This branch starts from current development and deliberately excludes twin/state changes.

Required fixes retained

  • treat UDP facade close as logical session cleanup without closing the shared UDP endpoint
  • process forwarded MAVLink frames through the normal raw-frame pipeline and prevent forwarding loops
  • re-register selector reads in a finally block
  • clean up failed per-device facade/session creation
  • isolate serial input/output scratch buffers for full-duplex traffic
  • retain and cancel the heartbeat scheduled future
  • avoid parsing UDP socket addresses for serial outbound messages and heartbeats
  • track inbound sequence state per system/component
  • guarantee connection-manager removal when protocol close partially fails
  • replace broad Throwable handling/stack traces in the outbound path with bounded logging

MAVLink V1 correction

MAVLink V1 has four bytes after magic and payload length: sequence, system ID, component ID, and message ID. A complete V1 frame is therefore payload length + 8 bytes. The old serial parser and its test fixture both used a fabricated fifth header byte; both are corrected here. UDP extraction already used payload + 8.

Tests

  • corrected existing V1 serial fixtures
  • added back-to-back V1 extraction/truncation coverage
  • added concurrent serial input/output regression coverage
  • added UDP facade logical-close/idempotence coverage

Deliberately excluded

  • formatting/import-only churn
  • the broad runtime catch in MavlinkProtocolFactory, which logged but did not establish a complete cleanup contract
  • all state/mavlink and twin management changes (separate PR)

Validation note

Focused Maven execution was attempted, but this environment cannot resolve repository.mapsmessaging.io or Maven Central. GitHub Actions is the authoritative test run for this draft.

@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: cf5dea61-d3bf-421d-a761-8df841423e84

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

@mbuckton
mbuckton marked this pull request as ready for review August 10, 2026 00:07
@mbuckton
mbuckton merged commit d669e52 into development Aug 10, 2026
3 checks passed
@mbuckton
mbuckton deleted the agent/mavlink-endpoint-hardening branch August 10, 2026 00:09
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