Skip to content

Fix Docker sandbox timeout handling#14

Merged
Yunnglin merged 1 commit into
mainfrom
agent/docker-timeout-handling
Jul 9, 2026
Merged

Fix Docker sandbox timeout handling#14
Yunnglin merged 1 commit into
mainfrom
agent/docker-timeout-handling

Conversation

@Yunnglin

@Yunnglin Yunnglin commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

What changed

  • Add in-container timeout wrapping for Docker sandbox commands so timed-out processes and child processes are terminated.
  • Propagate timeout status through shell, Python, and multi-code executor tools.
  • Add regression coverage for shell and Python executor timeout cleanup.

Why

Docker exec timeouts could leave child processes running after the caller reported a timeout. This made timeout handling incomplete and could leave work continuing inside the sandbox.

Validation

  • git diff --check
  • DOCKER_HOST=unix:///Users/yunlin/.colima/default/docker.sock conda run -n eval pytest tests/test_tool.py -k 'timeout' -q
  • DOCKER_HOST=unix:///Users/yunlin/.colima/default/docker.sock conda run -n eval pytest tests/test_tool.py -q

@Yunnglin Yunnglin marked this pull request as ready for review July 9, 2026 03:54
Copilot AI review requested due to automatic review settings July 9, 2026 03:55

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a mechanism to handle command timeouts inside the Docker sandbox using GNU timeout, along with robust process-tree termination when a timeout occurs. It also updates the Python, Shell, and Multi-Code executors to correctly propagate and report timeout statuses, and adds corresponding integration tests. The review feedback identifies two critical issues: first, the recursive kill_tree shell function fails to pass the signal argument down to recursive calls, preventing descendant processes from being terminated; second, if the timeout is zero or negative, _outer_timeout returns a non-positive value, which will cause asyncio.wait_for to immediately raise a TimeoutError and block execution.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread ms_enclave/sandbox/boxes/docker_sandbox.py
Comment thread ms_enclave/sandbox/boxes/docker_sandbox.py Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

@Yunnglin Yunnglin force-pushed the agent/docker-timeout-handling branch 3 times, most recently from b89c2cd to dea033e Compare July 9, 2026 06:29
@Yunnglin Yunnglin force-pushed the agent/docker-timeout-handling branch from dea033e to abc0b49 Compare July 9, 2026 06:40
@Yunnglin Yunnglin merged commit 61ce09f into main Jul 9, 2026
1 check passed
Yunnglin added a commit that referenced this pull request Jul 9, 2026
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