fix: raise ContainerNotRunning when container dies after timeout#807
Open
GopalGB wants to merge 1 commit intoSWE-agent:mainfrom
Open
fix: raise ContainerNotRunning when container dies after timeout#807GopalGB wants to merge 1 commit intoSWE-agent:mainfrom
GopalGB wants to merge 1 commit intoSWE-agent:mainfrom
Conversation
When a Docker container exits after container_timeout, subsequent docker exec calls fail silently and the agent wastes API calls until step_limit or cost_limit is exhausted. This detects container-dead markers in both the subprocess output and exception messages, raising ContainerNotRunning (an InterruptAgentFlow subclass) so the agent's run loop terminates cleanly and saves the trajectory. Fixes SWE-agent#803
Author
|
Friendly ping — this PR has been clean (mergeStateStatus: CLEAN, pre-commit.ci passed) for a month. The fix raises |
Member
|
Hi, thanks for opening this, I'm currently catching up with issues & PRs, we were in a big grind to release programbench. Will take a look soon. |
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.
Summary
ContainerNotRunningexception (subclass ofInterruptAgentFlow) that terminates the agent loop cleanly when the Docker container dies aftercontainer_timeoutexpires"No such container","is not running") in both subprocess output and exception messagesProblem
When
container_timeoutexpires, the container'ssleepprocess exits and Docker removes it (--rm). Subsequentdocker execcalls fail, butexecute()catches the exception and returns it as a normal observation. The model keeps issuing commands untilstep_limitorcost_limitis exhausted, wasting API calls and cost.Solution
ContainerNotRunningextendsInterruptAgentFlow, so the agent's existingrun()loop handles it identically toLimitsExceededorSubmitted: it adds the exit message, saves the trajectory, and stops.Test plan
ContainerNotRunningraised when subprocess returns dead-container output (non-zero returncode)ContainerNotRunningraised when subprocess raises exception with dead-container messageContainerNotRunningraised after realcontainer_timeoutexpires (requires Docker, marked@pytest.mark.slow)Fixes #803