Skip to content

fleet-proxy: colocated UDS dialing in direct mode (#6219) - #8388

Merged
dezren39 merged 2 commits into
mainfrom
queue/11385-6219-uds-dial
Nov 11, 2026
Merged

dezren39 merged 2 commits into
mainfrom
queue/11385-6219-uds-dial

Conversation

@dezren39

@dezren39 dezren39 commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

Closes #6219.

Implements colocated fleet-proxy port-to-socket UDS dialing in direct mode (from the #5699 design):

  • fleet-config: Config::service_socket(port) and Config::service_transport_choice(port) — port-to-socket resolution beside Config::services(), derived from the same port-keyed table. Broker-role ports (4800 secrets-broker, 4801 queue-broker) resolve to their role sockets; the laptop-agent port and unrouted ports resolve to None. The hello/services wire contract is unchanged (port-keyed map, byte-identical).
  • fleet-proxy HttpConn: generalized over a ConnStream (TCP tunnel stream or Unix socket) so the same HTTP exchange rides either transport.
  • fleet-proxy serve open_conn_raw: in direct mode only, when the port's service transport choice is a socket, dial the Unix socket (with the tunnel read/write timeouts); a socket that does not answer falls back to the TCP dial in the same attempt. Non-direct (tunnel/egress) path and non-colocated ports are unchanged — no configuration changes needed.

Tests (oracle: the #6219 acceptance criteria):

  • fleet-config: service_socket_resolves_broker_ports_only — broker ports resolve, laptop-agent/unrouted ports do not.
  • fleet-proxy: unix_socket_round_trips_and_stays_reusable — a full HTTP exchange over a real Unix socket.
  • Full suites on the laptop: cargo test -p fleet-config -p fleet-proxy — 38 + 80 + 14 passed, 0 failed.

Queue: task 11385, lane code-w.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@dezren39
dezren39 requested a review from a team as a code owner November 11, 2026 01:25
@coderabbitai

coderabbitai Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

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

Next included review available in 9 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 69599cb5-8479-4f4d-bd7b-3d4b9bebed13
Commits

Reviewing files that changed from the base of the PR and between 327e5de and 28f1625.

Files selected for processing: 3

  • pkgs/fleet/crates/fleet-config/src/lib.rs
  • pkgs/fleet/crates/fleet-proxy/src/http.rs
  • pkgs/fleet/crates/fleet-proxy/src/serve.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-11T01:35:00.625099Z 28f1625 New commits
ℹ️ 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 01c39367fd

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +463 to +466
if let Some(fleet_config::RoleTransport::Socket(socket)) =
self.config.service_transport_choice(port)
{
if let Ok(stream) = UnixStream::connect(&socket) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Bound the Unix-socket probe and dial by the setup deadline

In direct mode, if a broker's Unix listener stops accepting and its backlog fills, this path can block indefinitely instead of falling back to TCP. Both the probe inside service_transport_choice() and the subsequent UnixStream::connect() use blocking connects without a deadline; the read/write timeouts installed afterward cannot bound connection establishment. Previously, direct connections went through connect_tunnel(), which enforces the two-second TRANSPORT_DEADLINE. Bound both the probe and actual socket dial, and reach the TCP fallback when that budget expires.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 28f1625 — thank you, the point stands on both connects.

  • The dial path no longer calls service_transport_choice() (whose probe connect was unbounded). It now uses the new probe-free Config::service_socket_resolution(port) (socket path + configured transport preference; a tcp preference still skips the socket).
  • The dial itself is the probe, and it is bounded: connect_unix_bounded runs UnixStream::connect on a scratch thread and waits only TRANSPORT_DEADLINE (the same 2s budget connect_tunnel enforces). On expiry or error the caller falls back to the TCP dial within the same attempt; the read/write timeouts are then installed on the connected stream as before.

Re-verified: cargo test -p fleet-config -p fleet-proxy — all suites pass (38 + 80 + 14).

@dezren39
dezren39 merged commit 6c7622d into main Nov 11, 2026
1 of 6 checks passed
@dezren39
dezren39 deleted the queue/11385-6219-uds-dial branch November 11, 2026 01:33
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.

fleet proxy: colocated port-to-socket UDS dialing in direct mode (from #5699)

1 participant