code run --workdir and MCP code_run workdir: the CLI counterpart of StartBoxRun's workdir
Problem
#3551 adds StartBoxRunRequest.workdir on the daemon API. The CLI counterpart of StartBoxRun's run options is containarium code run (the SSH path, as docs/BOX-RUN-API.md notes for --command), and the platform MCP code_run tool runs over the same path. Neither can choose the directory a run starts in today: both call agent-box's process_start with an empty cwd, and session discovery assumes the home.
Proposal
containarium code run <box> --workdir <dir>(prompt and--commandruns) and aworkdirargument on MCPcode_run, the MCP tool a thin wrapper over the same client function.- Same rule as #3551: canonical home-relative path (the
WriteBoxFilerule, moved tointernal/coderunso the CLI can share it), and the directory must exist before anything on the box changes (agent-box'sprocess_startrotates a finished run and truncates its log before it fails on a badcwd, so the check comes first). Never created, no fallback. - Session discovery (CLI
snapshotSessionDirectory/startSessionDiscovery, and the MCP twins) uses the workdir as the cwd.
Acceptance
code run <box> --command pwd --workdir projectprints~/project; a missing directory, a file, and..or absolute values are refused before a run starts.- MCP
code_runwithworkdirbehaves the same through the same function.
Found while implementing #3551 (split out to keep that PR to the daemon API the issue's acceptance names).
Blocked by: #3551
Starting on this: code run --workdir (prompt and --command runs, SSH and --run-token-file paths) and a workdir argument on MCP code_run, with the path rule and the existence check shared from internal/coderun.