Skip to content

Refuse sandbox /write and /read of a workspace FIFO without hanging - #329

Merged
tylerreckart merged 5 commits into
mainfrom
fix/sandbox-fifo-nonblock
Sep 21, 2026
Merged

tylerreckart merged 5 commits into
mainfrom
fix/sandbox-fifo-nonblock

Conversation

@cursor

@cursor cursor Bot commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

Problem

write_to_workspace and read_from_workspace called open() without O_NONBLOCK. A workspace named pipe (mkfifo hang.txt) blocks that open() until a peer attaches.

/write holds the per-tenant sandbox mutex across the open, so one FIFO stalled every same-tenant /exec and /write until process restart. /read hung only the requesting turn.

Fix

Open with O_NONBLOCK. Writer-only FIFOs return ENXIO; a successful open of a non-regular file is still rejected by the existing fstat + S_ISREG check.

Tests

unit_sandbox_quota — /write and /read of a mkfifo target return an error within 1s (watchdog fails the test if open() hangs).

Independently mergeable against main. Touches sandbox.cpp write/read open() flags (same file as #325/#326's read_check_hook near the read path, different hunks) plus CHANGELOG [Unreleased]. Rebase after whichever sibling merges first.

Open in Web View Automation 

open() on a named pipe blocked forever; write_to_workspace holds the
per-tenant mutex across that open, so mkfifo stalled every same-tenant
/exec and /write until restart. Open O_NONBLOCK and reject non-regular
files.

Co-authored-by: Tyler Reckart <tylerreckart@users.noreply.github.com>
@tylerreckart
tylerreckart marked this pull request as ready for review September 21, 2026 13:23
@tylerreckart
tylerreckart enabled auto-merge (squash) September 21, 2026 13:23
Keep both Unreleased changelog entries.

Co-authored-by: Cursor <cursoragent@cursor.com>
Keep both Unreleased changelog entries.

Co-authored-by: Cursor <cursoragent@cursor.com>
Keep both Unreleased changelog entries.

Co-authored-by: Cursor <cursoragent@cursor.com>
@tylerreckart
tylerreckart merged commit 3ca8179 into main Sep 21, 2026
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.

3 participants