Skip to content

fix(shell): stop trickle output from bypassing the command timeout - #116

Closed
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/high-severity-issues-afb6
Closed

cursor[bot] wants to merge 1 commit into
mainfrom
cursor/high-severity-issues-afb6

Conversation

@cursor

@cursor cursor Bot commented Oct 12, 2026

Copy link
Copy Markdown

A shell command that keeps stdout readable can ignore shell_timeout_sec and sandbox_exec's timeout. The wait loops only advanced their deadline while poll was idle, so a writer faster than the poll slice never tripped it. handle_message holds the agent lock for the whole turn, so every channel stays stuck until the output buffer finally fills (minutes for a slow trickle).

Both the default unsandboxed shell path and the sandboxed drain path now measure monotonic wall time. The sandbox path still records a timeout when the child dies from the closed pipe instead of from the later reap.

Validation: make test_shell and make test_sandbox. New cases run while true; do echo x; sleep 0.05; done and require a timeout near the configured limit. The previous output-cap and sleep timeout cases still pass.

Open in Web聽View Automation聽

The shell and sandbox wait loops only advanced elapsed time when poll
returned idle. A command that wrote faster than the poll slice never
hit shell_timeout_sec or sandbox_exec's timeout, so the agent lock
stayed held until the output buffer filled.

Count monotonic wall time in both loops and still report the deadline
when the child exits because the pipe was closed.

Co-authored-by: esadrianno <esadrianno@gmail.com>
@adriannoes

Copy link
Copy Markdown
Collaborator

Superseded by #125: consolidated into the operator-authored branch fix/sandbox-shell-hardening (same fixes, re-validated with make test_sandbox, make test_shell, CI=true make test, make static). Closing in favor of the consolidation.

@adriannoes adriannoes closed this Oct 16, 2026
@adriannoes
adriannoes deleted the cursor/high-severity-issues-afb6 branch October 16, 2026 03:16
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.

2 participants