From 1a2fa89972388f8b057c505ecb1c7dc3d1bdf702 Mon Sep 17 00:00:00 2001 From: "devin-ai-integration[bot]" <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Wed, 29 Jul 2026 08:05:42 -0700 Subject: [PATCH] fix(runtime): label docker sandbox containers with the run id for teardown (#933) Co-authored-by: Ahmed Allam --- strix/runtime/docker_client.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/strix/runtime/docker_client.py b/strix/runtime/docker_client.py index 11cdff57..5aa4f7c7 100644 --- a/strix/runtime/docker_client.py +++ b/strix/runtime/docker_client.py @@ -110,6 +110,19 @@ def _apply_log_limits(create_kwargs: dict[str, Any]) -> None: ) +def _apply_run_labels(create_kwargs: dict[str, Any]) -> None: + run_id = os.getenv("STRIX_RUN_ID") + if not run_id: + return + labels = create_kwargs.setdefault("labels", {}) + if not isinstance(labels, dict): + return + labels["strix-run-id"] = run_id + run_type = os.getenv("STRIX_RUN_TYPE") + if run_type: + labels["strix-run-type"] = run_type + + class StrixDockerSandboxSession(DockerSandboxSession): sandbox_network: str = "" @@ -222,6 +235,7 @@ class StrixDockerSandboxClient(DockerSandboxClient): _apply_sandbox_network(create_kwargs) _apply_resource_limits(create_kwargs) _apply_log_limits(create_kwargs) + _apply_run_labels(create_kwargs) # Strix injection: host bind mounts (e.g. large repos passed via --mount) # that bypass the SDK's file-by-file LocalDir copy.