Repository navigation
fix(shell): stop trickle output from bypassing the command timeout - #116
Closed
cursor[bot] wants to merge 1 commit into
Closed
cursor[bot] wants to merge 1 commit into
cursor[bot] wants to merge 1 commit into
Conversation
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>
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A shell command that keeps stdout readable can ignore
shell_timeout_secandsandbox_exec's timeout. The wait loops only advanced their deadline whilepollwas idle, so a writer faster than the poll slice never tripped it.handle_messageholds 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_shellandmake test_sandbox. New cases runwhile true; do echo x; sleep 0.05; doneand require a timeout near the configured limit. The previous output-cap andsleeptimeout cases still pass.