fix: reduce container timeout to 30 min and fix orphaned containers on timeout#86
Merged
Conversation
…aned containers on timeout The effective container timeout was 7200 s (2 hours) despite SandboxConfig advertising 1800 s — that class was dead code. Containers that hit the Python-level asyncio.wait_for TimeoutError also leaked: process.kill() only terminated the podman run client, leaving the container running in the Podman daemon. - Set Settings.container_timeout and ContainerConfig.timeout_seconds to 1800 s (30 minutes) — overridable via FORGE_SANDBOX_TIMEOUT env var - Extract _stop_timed_out_container() and use it for both TimeoutError and CancelledError paths: podman stop → podman kill on non-zero exit or wait timeout → process.wait() with force-kill fallback Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
37c515a to
e139e7d
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.
Summary
Settings.container_timeoutdefaulted to 7200 s (2 hours). TheSandboxConfigclass with 1800 s was dead code — never imported or used.asyncio.wait_forfired aTimeoutError, the handler calledprocess.kill()which only killed thepodman runclient process, leaving the container running orphaned in the Podman daemon.Changes
container_timeoutdefault to 1800 s (30 minutes) inSettingsandContainerConfig— still overridable viaFORGE_SANDBOX_TIMEOUT_stop_timed_out_container()helper:podman stop→ escalate topodman killon non-zero exit or wait timeout → wait for thepodman runprocess to exit with a force-kill fallbackTimeoutErrorandCancelledErrorpaths (previouslyCancelledErrorhad the correct logic inline; now both paths share it)Test plan
uv run pytest tests/unit/ -q)🤖 Generated with Claude Code