Repository navigation
fix(sandbox): keep the Docker worker when a command exits 124 by itself - #796
Open
thecorporatetractor wants to merge 1 commit into
Open
thecorporatetractor wants to merge 1 commit into
thecorporatetractor wants to merge 1 commit into
Conversation
the timeout by exit code 124. artex-exec-wrap returns 124 when it enforces timeout_ms, but the command can also exit 124 itself: coreutils `timeout 1 sleep 5` does. The runner then removed the worker and stopped the task's background jobs after an ordinary inner timeout. Count an exit 124 as the runner's timeout only when the exec ran for at least timeout_ms, which is the only way the wrapper can return it.
thecorporatetractor
force-pushed
the
fix/sandbox-exit-124
branch
from
December 2, 2026 11:31
a853d3b to
8070ff4
Compare
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.
Problem
Since #764, the Docker backend removes the worker container when an exec times out. It detects the timeout by exit code 124 (
sandbox/docker.go,timedOut := exitCode == 124).artex-exec-wrapreturns 124 when it enforcestimeout_ms, but a command can also exit 124 by itself. coreutilstimeoutdoes, and agents usetimeout N <tool>a lot. Such a command now removes the task's worker, and every background job and service in it stops. This was reported in the #764 review.Repro on
main, live Docker:Change
An exit 124 counts as the runner's timeout only when the exec ran for at least
timeout_ms. The wrapper returns 124 only after its timer fires, so a genuine timeout always takes that long, and a shorter 124 is the command's own exit code. The fix needs no worker image change, so it works with any wrapper version.Tests
TestExecCommandExit124BeforeTimeoutKeepsWorker(fake Engine): exit 124 well beforetimeout_msis reported withExitCode: 124,TimedOut: false, and the worker is kept. It fails onmainand passes here.timeout_ms, as a real timeout does.TestDockerCommandExit124KeepsWorker(ARTEX_SANDBOX_DOCKER_TEST=1):timeout 1 sleep 5withtimeout_ms30000. It fails onmain(TimedOut:true, worker removed) and passes here. The existingTestDockerTimeoutRemovesDetachedChildstill passes, so a real timeout still removes the worker and its detached children.go vet ./sandbox/andgo test -race ./sandbox/: pass.