Skip to content

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

Merged
wan9chi merged 1 commit into
mainfrom
agent/reapply-runner-fifo
Aug 10, 2026
Merged

fix(ipc): use named FIFOs for task communication on Unix#569
wan9chi merged 1 commit into
mainfrom
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
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  +0.18%  [ -5.43% ..  +7.19%]  overhead   +47.15%
dynamic/access             change  -1.10%  [ -6.42% ..  +4.96%]  overhead    +4.98%
dynamic/access-relative    change  +1.01%  [ -3.18% ..  +6.83%]  overhead   +51.79%
static/launch              change  +0.96%  [ -6.08% ..  +7.69%]  overhead  +157.09%
static/access              change  +0.93%  [ -4.92% ..  +6.71%]  overhead  +723.95%
static/access-relative     change  +0.29%  [ -6.97% ..  +5.41%]  overhead +1021.09%

macos

dynamic/launch             change  -0.16%  [ -5.56% ..  +4.83%]  overhead  +240.53%
dynamic/access             change  -1.30%  [-60.29% .. +128.57%]  overhead    +4.54%
dynamic/access-relative    change  +1.83%  [ -7.97% .. +113.28%]  overhead  +251.70%

windows

dynamic/launch             change  -0.42%  [ -8.75% ..  +8.42%]  overhead   +24.56%
dynamic/access             change  -0.36%  [ -4.98% ..  +1.80%]  overhead    +1.50%
dynamic/access-relative    change  -0.18%  [ -1.79% ..  +1.47%]  overhead    +1.64%

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 agent/reapply-runner-fifo branch 2 times, most recently from 3c21bcc to 833d8e6 Compare August 4, 2026 10:21
@wan9chi
wan9chi force-pushed the agent/reapply-runner-fifo branch from 833d8e6 to 7f7752f Compare August 10, 2026 06:59
Base automatically changed from fspy-sparse-file-shm to main August 10, 2026 07:06
@wan9chi
wan9chi force-pushed the agent/reapply-runner-fifo branch 2 times, most recently from 491477e to ef59189 Compare August 10, 2026 07:07
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 ef59189 to 511b5cc Compare August 10, 2026 07:26
@wan9chi
wan9chi merged commit f591907 into main Aug 10, 2026
20 checks passed
@wan9chi
wan9chi deleted the agent/reapply-runner-fifo branch August 10, 2026 07:32
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