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.