Skip to content

uds: add async Unix socket crate#18254

Merged
euroelessar merged 4 commits into
mainfrom
ruslan/uds-stdio-to-uds
Apr 20, 2026
Merged

uds: add async Unix socket crate#18254
euroelessar merged 4 commits into
mainfrom
ruslan/uds-stdio-to-uds

Conversation

@euroelessar

@euroelessar euroelessar commented Apr 17, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • add a codex-uds crate with async UnixListener and UnixStream wrappers
  • expose helpers for private socket directory setup and stale socket path checks
  • migrate codex-stdio-to-uds onto codex-uds and Tokio-based stdio/socket relaying
  • update the CLI stdio-to-uds command path for the async runner

Tests

  • cargo test -p codex-uds -p codex-stdio-to-uds
  • cargo test -p codex-cli
  • just fmt
  • just fix -p codex-uds
  • just fix -p codex-stdio-to-uds
  • just fix -p codex-cli
  • just bazel-lock-check
  • git diff --check

## Summary
- add a codex-uds crate with async UnixListener and UnixStream wrappers
- expose helpers for private socket directory setup and stale socket path checks
- migrate codex-stdio-to-uds onto codex-uds and Tokio-based stdio/socket relaying
- update the CLI stdio-to-uds command path for the async runner

## Tests
- cargo test -p codex-uds -p codex-stdio-to-uds
- cargo test -p codex-cli
- just fmt
- just fix -p codex-uds
- just fix -p codex-stdio-to-uds
- just fix -p codex-cli
- just bazel-lock-check
- git diff --check
@euroelessar euroelessar force-pushed the ruslan/uds-stdio-to-uds branch from 7d60a42 to 32adbbe Compare April 17, 2026 03:35
@euroelessar euroelessar marked this pull request as ready for review April 17, 2026 22:44

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

Copy link
Copy Markdown
Contributor

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: 32adbbe5c1

ℹ️ 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 thread codex-rs/uds/src/lib.rs Outdated
use tokio_util::compat::Compat;
use tokio_util::compat::FuturesAsyncReadCompatExt;

pub(super) type Stream = Compat<Async<WindowsUnixStream>>;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Badge Preserve write-half shutdown on Windows UDS streams

platform::Stream on Windows is Compat<Async<WindowsUnixStream>> (codex-rs/uds/src/lib.rs:168). UnixStream::poll_shutdown forwards to this adapter, whose shutdown path maps to poll_close; for async_io::Async, poll_close only flushes. As a result, socket_writer.shutdown().await in stdio-to-uds::run no longer sends a real write-half close on Windows, so peers waiting for EOF can hang.

Useful? React with 👍 / 👎.

@viyatb-oai viyatb-oai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewing in the context of SSH remote control over Unix sockets.

Comment thread codex-rs/uds/src/lib.rs
));
}

let permissions = metadata.permissions();

@viyatb-oai viyatb-oai Apr 17, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

In the SSH-over-UDS remote-control model, the directory contract should be exactly 0700, not only "no group/other bits". As written, an existing $CODEX_HOME/app-server-control with mode 0600 passes this check even though the owner cannot traverse it. I would compare (mode & 0o777) != SOCKET_DIR_MODE and set it to 0700, maybe also add a regression test for an existing 0600 directory.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@euroelessar seems worth capturing this in a comment with this code?

@bolinfest bolinfest left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can you check on the P1 reported by Codex?

Comment thread codex-rs/stdio-to-uds/tests/stdio_to_uds.rs Outdated
Comment thread codex-rs/stdio-to-uds/tests/stdio_to_uds.rs Outdated
Comment thread codex-rs/uds/src/lib.rs Outdated
Comment thread codex-rs/uds/src/lib.rs
Comment thread codex-rs/uds/src/lib.rs Outdated
Comment thread codex-rs/uds/src/lib.rs Outdated
Comment thread codex-rs/uds/src/lib.rs
));
}

let permissions = metadata.permissions();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@euroelessar seems worth capturing this in a comment with this code?

@euroelessar euroelessar merged commit 97d4b42 into main Apr 20, 2026
38 of 39 checks passed
@euroelessar euroelessar deleted the ruslan/uds-stdio-to-uds branch April 20, 2026 22:59
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 20, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants