Repository navigation
feat: add command_code as a runtime - #154
Conversation
AC-14 asserts that `git diff HEAD` modifies no swe_af/ file outside swe_af/fast/. That guard predates this work and fails for any runtime change, because the runtime set is declared as a pydantic Literal in the config-schema modules rather than in swe_af/runtime/ alone. Permit swe_af/runtime/** and the two schema modules that declare the runtime Literal. Reasoner and coding-loop files stay disallowed.
…provider Register a new AgentField harness provider, "command-code", by wrapping the SDK's provider factory from swe_af/runtime (the same technique codex_harness_patch already uses), and add "command_code" to RUNTIME_VALUES with its aliases and provider/adapter mappings. CommandCodeProvider drives `cmd -p --output-format json` headlessly: models and #variant reasoning effort, permission modes, max turns, session resume, cwd and extra directories, system prompt inlining, plus mapping of the CLI's NDJSON result line and documented exit codes onto RawResult. No model ids are baked in - a blank model omits -m so Command Code uses its own configured default, and any id it supports passes through verbatim. Token usage is read from the CLI's camelCase fields, which the SDK's snake_case extract_token_usage does not recognise.
Widen the runtime Literal on BuildConfig, ExecutionConfig, FastBuildConfig and IssueBuildConfig, and give the runtime an all-empty base-model entry so model resolution defers to Command Code's own default rather than pinning an id. Caller-supplied models still win verbatim.
…ocument the runtime Install command-code in the image, and mount the host's ~/.commandcode into the agent containers the same way ~/.codex is mounted, so a host `cmd login` is the only auth step. Cover it with a compose assertion and document the runtime in the README, the deployment guide and .env.example.
|
Just to add, I manually tested this PR branch by using it to make a simple web project - throwball. |
ZeroPoint95
left a comment
There was a problem hiding this comment.
@devparanjay, thanks for adding the Command Code runtime. Two issues still need fixing:
-
High — the Docker image cannot start the installed CLI. Dockerfile:23 installs current Command Code 1.82.2, which requires Node 22+, while the image’s Debian package supplies Node 20.19.2. I inspected the published entry point and reproduced its startup rejection using an isolated version-guard test. Please install a supported Node version and add a credential-free startup smoke test.
-
Medium — configured executable paths are ignored. Provider construction:380 always creates
CommandCodeProvider()without using_resolve_bin. SDK-runner probes confirm thatSWE_COMMANDCODE_BINand per-call binary overrides still launchcmd. On Windows, that also selects the system command shell. Please connect the resolver to execution, use a portable default, and test the overrides through the public runner.
make check passed: 1,311 tests passed and 1 skipped. These reproductions used mocked dispatch and the isolated startup guard; no Docker image build, real CLI execution or provider authentication was performed.
Copy Node and npm from the official Node 22 image, install runtime libraries, pin Command Code to verified 1.82.2, and fail builds if its credential-free startup check fails. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Resolve per-call executable options and SWE_COMMANDCODE_BIN in the factory used by HarnessRunner, default to the non-colliding command-code npm alias, and cover dispatch, structured output, Windows stdin, and a real custom subprocess. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Include the SDK runner transient marker for exit code 6. Exercise retries for all transient exit codes through HarnessRunner and ensure auth, permissions, and credits do not retry. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Replace automatic writable home-directory mounts with opt-in read-only auth.json overlays. Keep CLI session storage writable inside containers, verify all mount definitions, and document credential visibility and the Python-only runtime. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The currently published Claude Code package declares Node >=22 for npm installation. Supply official Node 22 in the Go runtime image too and smoke-test the actual claude executable at build time; Command Code remains a Python-only runtime. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
@devparanjay thanks for this, and sorry it sat. Since it had been open a while, I've taken it over and pushed the fixes on top of your branch (no history rewritten). @ZeroPoint95, both of your points are addressed: Node / Docker startup. The image now copies Node and npm from the official Executable overrides. Provider construction now goes through the resolver: Two more things came up while verifying:
|
AbirAbbas
left a comment
There was a problem hiding this comment.
Verified at c44db10: Command Code 1.82.2 starts under Node 22 and refuses Node 20 with the original error, executable overrides reach the public runner, exit 6 retries, and host credentials are now an opt-in read-only auth.json mount. make check (3.12) and the Go job are green.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Cover all five public build stages for each runtime, plus aliases and the legacy unknown-runtime fallback. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
AbirAbbas
left a comment
There was a problem hiding this comment.
One more round before merging. A second, independent review turned up a few things, now fixed:
- Fast builds ignored the runtime.
swe-fastacceptedcommand_code, but its own runtime-to-provider mapper only knew Claude and Codex, so every stage quietly ran on OpenCode. It now goes through the shared mapper, which keeps the old unknown-runtime fallback. A new test drives the real fast build and checks all five stages for each of the four runtimes; it fails on the previous head. - QA synthesizer coverage. The synthesizer's runtime table from #155 now has a
command_coderow. - Image compat. Both images add the
nodejs → nodealias that Debian's package provided. The changelog and deployment docs note that npm's global config moved from/etc/npmrcto/usr/local/etc/npmrc, with the override. - Docs. The runtime tables and lists include Command Code, marked Python-node only.
I merged current main in as well. make check (1,441 passed) and the Go job are green. Thanks again @devparanjay!
|
@ZeroPoint95 thanks for the review and apologies, has been difficult to find time to work on this recently. |
Summary
command_codeas a runtime, backed by a new AgentField command-code harness provider that drives the Command Code CLI (cmd -p) headlessly. The provider is registered by wrapping the SDK's provider factory from swe_af/runtime/ — the same technique the existing codex patch uses — so upstream AgentField stays untouched. Also adds command_code to the runtime Literals in the build/execution/fast/issue configs, installs the CLI in the image, and mounts the host's ~/.commandcode into the agent containers.Validation
Behavior Impact
Notes
remain disallowed.
command_code. The user's configuration of Command Code on their machine is inherited by default, requiring minimal or no further configuration for SWE-AF or AgentField.