fix(runtime): label docker sandbox containers with the run id for teardown - #933
Conversation
…rdown The managed backends stamp each sandbox with the run's correlation id so an external control plane can find and stop it by run id. The docker backend did not, so an abrupt teardown of the parent process (cancel / relaunch / restart) left the container orphaned and running. Stamp strix-run-id (and strix-run-type when set) from the environment on container create; no-op when STRIX_RUN_ID is unset.
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Greptile SummaryAdds Docker sandbox container labels derived from
Confidence Score: 5/5The PR appears safe to merge with no concrete defects identified in the changed container-labeling path. The helper preserves dictionary-based labels, adds run metadata only when configured, and passes the resulting creation arguments through the existing Docker container creation flow. Important Files Changed
Reviews (1): Last reviewed commit: "fix(runtime): label docker sandbox conta..." | Re-trigger Greptile |
Summary
The docker runtime backend never labeled the sandbox container with the run's correlation id, so an external control plane could not find and stop it by run id — an abrupt teardown of the parent process (cancel / relaunch / restart) left the container orphaned and running. The managed backends already stamp this metadata on their sandboxes (which is why they tear down cleanly); this brings the docker backend to parity.
Stamp the label on container create from the environment (no-op when unset), factored into a small helper alongside the existing
_apply_sandbox_network/_apply_resource_limits/_apply_log_limits:A caller can then
dockerlistContainers(filters={label: ["strix-run-id=<id>"]})and stop the sandbox as part of tearing the run down. Behavior is unchanged whenSTRIX_RUN_IDis not set in the environment.Link to Devin session: https://app.devin.ai/sessions/54414ea3ecb34ade9189534e5c690969
Requested by: @0xallam