feat: Docker isolation image and runtime controls (--volume/--mount/--env/--privileged)#133
Conversation
Adding .gitkeep for PR creation (default mode). This file will be removed when the task is complete. Issue: #132
Add --volume/-v, --mount, --env/-e, and --privileged options to the Docker isolation backend in both the JavaScript and Rust implementations. These flags are threaded into the underlying 'docker run' invocation and recorded in --status/--list metadata, so callers can mount tool credentials, inject environment variables, and run Docker-in-Docker images (e.g. konard/hive-mind-dind:latest) without wrapping 'docker run' themselves. Options are validated to be docker-only and forwarded across nested isolation levels. Closes #132
…add parity tests - Move docker runtime status/metadata + isolation options map helpers into rust/src/lib/isolation_metadata.rs (keeps isolation.rs and main.rs <1000 lines) - Extract buildDockerRuntimeStatusLines/buildDockerRuntimeMetadata in JS isolation.js and use them from cli.js (keeps cli.js <1000 lines) - Add Rust + JS unit tests for the new helpers to restore test parity (>=90%)
CI status: green ✅
Note on a transient Windows/Bun failureThe first JS CI run on
These are pre-existing, timing-flaky docker tests on the Windows runner — the same |
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost: $16.490728📊 Context and tokens usage:Claude Opus 4.8: (4 sub-sessions)
Total: (44.7K new + 462.6K cache writes + 20.3M cache reads) input tokens, 128.6K output tokens, $16.490728 cost 🤖 Models used:
📎 Log file uploaded as Gist (8480KB)Now working session is ended, feel free to review and add any feedback on the solution draft. |
✅ Ready to mergeThis pull request is now ready to be merged:
Monitored by hive-mind with --auto-restart-until-mergeable flag |
Summary
Closes #132.
Extends the Docker isolation backend so callers can configure the container runtime surface directly, instead of dropping out of
startto wrapdocker runby hand. Implemented with full parity across the JavaScript/Bun and Rust implementations.New isolation options (docker only)
--volume,-v <host:container[:mode]>--mount <mount-spec>docker run --mountspec (repeatable)--env,-e <KEY=VALUE>--privilegedThese are threaded into the internal
docker runargv (both detached and attached modes) and recorded in--status/--listmetadata. They are forwarded across nested isolation levels (JS) and rejected with a clear error when the isolation stack does not include docker.Motivating use case
Hive Mind needs
konard/hive-mind-dind:latestwith mounted tool credentials and a privileged container:start -i docker --image konard/hive-mind-dind:latest --privileged \ -v ~/.config/gh:/root/.config/gh -e TOKEN=abc -- solve ...How to reproduce / verify
Verified end-to-end with real Docker in both implementations: container output reflects the mounted file content and injected env var, and
--statusmetadata listsvolumes/env(withmounts/privilegednull when unset).Tests
js/test/docker-runtime-options.js— 21 tests covering parsing (repeatable +=form), docker-only validation,buildDockerRuntimeArgsordering, and thebuildDockerRuntimeStatusLines/buildDockerRuntimeMetadatahelpers.args_parser_cases.rs(parsing/validation),isolation_cases.rs(build_docker_runtime_argsordering), andisolation_metadata_cases.rs(status lines, metadata, options map).Refactor note
To keep
cli.js/main.rsunder the 1000-line CI file-size limit, the docker runtime status-line and metadata construction were extracted into reusable helpers (buildDockerRuntimeStatusLines/buildDockerRuntimeMetadatainjs/src/lib/isolation.js;docker_runtime_status_lines/docker_runtime_metadata/build_isolation_options_mapin the newrust/src/lib/isolation_metadata.rs).Release
js/.changeset/docker-runtime-controls.md(minor)rust/changelog.d/133.md(bump: minor)Docs
README.mdand bothusage/help outputs document the four options with examples.