Description
When evaluating coding agents with DockerSandbox, an agent's code could consume excessive memory or CPU (e.g., through infinite loops, recursion, or memory leaks). DockerSandbox should enforce configurable resource quotas.
Proposed Solution
- Add
DOCKER_MEMORY_LIMIT (default "2g") and DOCKER_CPU_QUOTA (default 1.0) settings to backend/app/config/settings.py.
- Update
backend/app/sandbox/docker_sandbox.py to pass mem_limit and nano_cpus parameters when spawning Docker containers via docker.containers.run().
- Add a unit test verifying container creation arguments.
Relevant Files
backend/app/sandbox/docker_sandbox.py
backend/app/config/settings.py
Acceptance Criteria
Description
When evaluating coding agents with
DockerSandbox, an agent's code could consume excessive memory or CPU (e.g., through infinite loops, recursion, or memory leaks).DockerSandboxshould enforce configurable resource quotas.Proposed Solution
DOCKER_MEMORY_LIMIT(default"2g") andDOCKER_CPU_QUOTA(default1.0) settings tobackend/app/config/settings.py.backend/app/sandbox/docker_sandbox.pyto passmem_limitandnano_cpusparameters when spawning Docker containers viadocker.containers.run().Relevant Files
backend/app/sandbox/docker_sandbox.pybackend/app/config/settings.pyAcceptance Criteria
DockerSandboxenforce configured memory and CPU limits..envenvironment variables.python -m pytest.