Skip to content

exoharness: fix find_running_warm_sandbox to work on Docker (Linux)#43

Open
akrentsel wants to merge 1 commit into
adaptersfrom
linux-docker-warm-sandbox
Open

exoharness: fix find_running_warm_sandbox to work on Docker (Linux)#43
akrentsel wants to merge 1 commit into
adaptersfrom
linux-docker-warm-sandbox

Conversation

@akrentsel
Copy link
Copy Markdown
Collaborator

@akrentsel akrentsel commented Jun 3, 2026

find_running_warm_sandbox unconditionally called

<bin> list --format json

which is Apple Container CLI syntax. On Docker (the Linux default), list isn't a subcommand and the call fails with unknown flag: --format, which surfaces as failed to list warm sandboxes on the first sandbox provision attempt. Linux Docker users can't run agents that touch a sandbox without working around it.

Fix

Dispatch find_running_warm_sandbox on ContainerCliFlavor:

  • Apple path — unchanged, extracted into find_running_warm_sandbox_apple.
  • Docker pathfind_running_warm_sandbox_docker uses docker ps with three server-side filters (status=running, key label, spec-hash label) plus --format '{{json .}}'. Each output line is a JSON object; we deserialize into a 1-field DockerPsItem { names } and return the first. No client-side label parsing required.
  • Uses the existing run_container_admin_command helper for the subprocess spawn + timeout, matching the Apple sibling.

Test plan

  • cargo check --all-targets
  • cargo clippy --all-targets -- -D warnings
  • cargo fmt --check
  • End-to-end verified locally on Linux: with sandbox_provider: docker on an agent, sending a message triggers docker run for a fresh warm sandbox, the shell tool executes inside it (echo linux-docker-fixed), and the result returns through to the assistant. Before this change the same flow erroored with failed to list warm sandboxes: unknown flag: --format before any container was provisioned.

find_running_warm_sandbox unconditionally called

    <bin> list --format json

which is Apple Container CLI syntax. On Docker (the Linux default), the
`list` subcommand doesn't exist and the call failed with "unknown flag:
--format", which surfaced as `failed to list warm sandboxes` on the
first sandbox provision attempt. Linux Docker users couldn't run agents
that touch a sandbox without working around it.

Fix: dispatch on cli flavor.

- AppleContainer path = existing implementation, unchanged.
- Docker path uses `docker ps --filter label=KEY=VALUE --format
  '{{json .}}'`, parses one JSON object per line, decodes the
  comma-separated Labels field, and matches on spec_hash. The
  server-side label filter narrows results; `docker ps` (without
  `-a`) only returns running containers, matching the existing
  Apple semantics.
- Adds a small DockerPsItem + parse_docker_labels helper, plus a
  unit test for the label parser.

End-to-end verified locally: with `sandbox_provider: docker` on
Linux, the agent now provisions a container, executes a shell tool
call, and returns the result.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.

1 participant