Skip to content

fix(ipc): use named FIFOs for task communication on Unix - #569

Draft
wan9chi wants to merge 1 commit into
fspy-sparse-file-shmfrom
agent/reapply-runner-fifo
Draft

fix(ipc): use named FIFOs for task communication on Unix#569
wan9chi wants to merge 1 commit into
fspy-sparse-file-shmfrom
agent/reapply-runner-fifo

Conversation

@wan9chi

@wan9chi wan9chi commented Jul 24, 2026

Copy link
Copy Markdown
Member

Motivation

Codex CLI's and Claude Code's default sandboxes block Unix domain sockets, so vp run fails while setting up task communication before any task code runs (#562). Named FIFOs are plain files, and both sandboxes allow them.

This PR reapplies the FIFO transport from #565 with a rename, a review pass, and new coverage:

  • The crate is pipe_socket: socket-style server-client IPC, implemented on named pipes rather than Unix domain sockets. It carries no task-runner specifics, so it sits outside the vite_* prefix, like fspy and pty_terminal. It exposes Server::bind, Server::name, Server::accept, and Client::connect; FIFOs on Unix and named pipes on Windows stay implementation details.
  • Client::connect now fails instead of hanging when the server is gone. The rendezvous open is nonblocking, so a missing reader turns into a connection-refused error at once. While waiting for the server's ready byte, the client watches the rendezvous write end and probes the server every 100ms; a dead server turns into an error within one probe interval. macOS needs the probe because its poll does not always report FIFO events; Linux reports the death at once. The module documents the handshake step by step.
  • A new integration test pins the no-hang behavior for both cases: server gone before the connection attempt, and server dying in the middle of one.
  • The Codex sandbox snapshot now records the end state this PR and fix(fspy): unify shared memory on a sparse temp file across all platforms #576 were built for: the task runs inside the sandbox, fspy traces its reads, and editing the traced file causes a cache miss on the next run. Regenerated against the real codex CLI on macOS. The Claude sandbox snapshot is carried over from fix(ipc): use named FIFOs on Unix #565 unchanged; it needs an srt binary to regenerate, and the recorded behavior does not depend on the shared-memory backend that changed underneath it.

Closes #562.

🤖 Generated with Claude Code

wan9chi commented Jul 24, 2026

Copy link
Copy Markdown
Member Author

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@wan9chi
wan9chi changed the base branch from main to graphite-base/569 July 30, 2026 06:12
@wan9chi
wan9chi force-pushed the agent/reapply-runner-fifo branch from d546ad9 to 6499a5c Compare July 30, 2026 06:12
@wan9chi
wan9chi changed the base branch from graphite-base/569 to fspy-sparse-file-shm July 30, 2026 06:12
@wan9chi wan9chi changed the title fix(ipc): use named FIFOs on Unix fix(ipc): use named FIFOs for task communication on Unix Jul 30, 2026
@github-actions

github-actions Bot commented Jul 30, 2026

Copy link
Copy Markdown

fspy benchmark

linux

dynamic/launch             change  +1.83%  [ -5.39% .. +10.42%]  overhead   +54.53%
dynamic/access             change  +0.54%  [ -5.20% ..  +7.01%]  overhead   +49.93%
static/launch              change  +1.86%  [-11.53% .. +13.77%]  overhead  +167.30%
static/access              change  -1.14%  [-14.09% ..  +6.09%]  overhead  +827.60%

macos

dynamic/launch             change  +0.16%  [ -5.32% ..  +5.64%]  overhead  +224.73%
dynamic/access             change  +0.00%  [ -6.27% ..  +9.40%]  overhead   +22.99%

windows

dynamic/launch             change  -0.17%  [ -4.72% ..  +4.12%]  overhead   +28.81%
dynamic/access             change  +0.17%  [ -1.42% ..  +1.23%]  overhead    +8.23%

wan9chi commented Jul 30, 2026

Copy link
Copy Markdown
Member Author

@codex review

@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: 6499a5c73c

ℹ️ 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 crates/vite_task_ipc/src/unix.rs Outdated
Comment thread crates/vite_task_ipc/tests/integration.rs Outdated
@wan9chi
wan9chi force-pushed the agent/reapply-runner-fifo branch 11 times, most recently from b8e273e to 03e6984 Compare July 31, 2026 07:09
@wan9chi
wan9chi force-pushed the fspy-sparse-file-shm branch from c86913c to 8622417 Compare August 4, 2026 10:17
@wan9chi
wan9chi force-pushed the agent/reapply-runner-fifo branch from 03e6984 to 3c21bcc Compare August 4, 2026 10:17
Default Codex CLI and Claude Code sandboxes block Unix domain sockets, so
`vp run` failed while setting up task communication inside them. Replace the
Unix transport with named FIFOs, which those sandboxes allow.

The transport lives in the new `socket_ipc` crate: socket-style server-client
IPC that carries no task-runner specifics. Windows keeps using named pipes.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
@wan9chi
wan9chi force-pushed the agent/reapply-runner-fifo branch from 3c21bcc to 833d8e6 Compare August 4, 2026 10:21
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.

Runner IPC fails in AI harness sandboxes

1 participant