Skip to content

test: have the local stack remove only the sandboxes its own process made - #584

Merged
andrewpark-scaleai merged 1 commit into
mainfrom
andrew-park/ci-slow-tier-own-sandboxes
Nov 10, 2026
Merged

andrewpark-scaleai merged 1 commit into
mainfrom
andrew-park/ci-slow-tier-own-sandboxes

Conversation

@andrewpark-scaleai

@andrewpark-scaleai andrewpark-scaleai commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Why

The goal is a slow tier that can run two tests at a time on each runner, which is the most promising remaining speedup on the same 12 runners. Draft #582 tried -n 2 once. Its only failures were three multi_env_computers_test.py tests on shard 3, which failed with Gateway container not running. When the test failed, docker ps showed no gateway at all.

The other worker on that shard had just finished local_parallel_deploy_test.py. Its local_stack_at teardown, which eight other test files share, force-removes every container named agent-env-local-*. Every local sandbox's compose project is named after its work dir, agent-env-<sandbox id>-…, so the teardown removed the other worker's gateway as it deployed.

What changes

While the stack is up, local_stack_at records the id of each LocalSandbox its own process makes. At teardown it removes only the containers named for those ids. Pytest workers are separate processes, so another worker's sandboxes are never recorded.

Verification

  • With a stand-in container named for another sandbox, agent-env-local-0therw0r-abc-gateway-1, and one named for a sandbox made inside the stack, the teardown removed the stack's container and kept the other one.
  • When tests run one at a time, as on main today, nothing else changes: the stack still removes every sandbox it made.
  • ruff check passes.

I'll rerun #582 with this change to check whether any other test collides.

RetriggerView in GreptileConfidence Score: 5/5

This PR appears safe to merge.

Summary

local_stack_at now records sandbox IDs in the test process and removes only matching Compose containers at teardown.

  • Local test stacks remove only containers for sandboxes their process created.

Reviews (1) · Last reviewed commit: "test: have the local stack remove only t..." · Reviewed by Greptile

…made

local_stack_at's teardown force-removed every container named agent-env-local-*, which is every local
sandbox's compose containers on this machine's Docker. Run two tests at a time and it removed the other
worker's gateway mid-deploy (PR #582: multi_env_computers_test's three tests, 'Gateway container not
running'). It now records the ids of the LocalSandboxes made while the stack is up and removes only theirs.

Co-Authored-By: Claude <[email protected]>
@andrewpark-scaleai
andrewpark-scaleai merged commit e090662 into main Nov 10, 2026
34 checks passed
@andrewpark-scaleai
andrewpark-scaleai deleted the andrew-park/ci-slow-tier-own-sandboxes branch November 10, 2026 00:38
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