fix(mosaic): stop yolo runtime from leaking runtime name as first user message #455

Merged
jason.woltje merged 1 commits from fix/yolo-runtime-initial-arg into main 2026-04-11 16:57:44 +00:00

1 Commits

Author SHA1 Message Date
1dd4f5996f fix(mosaic): stop yolo runtime from leaking runtime name as first user message
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
ci/woodpecker/pr/ci Pipeline was successful
`mosaic yolo <runtime>` forwarded `cmd.args` (which Commander populates with
the declared `<runtime>` positional) to the underlying CLI. For the claude
runtime that meant argv included the literal string "claude" as an initial
positional argument, which Claude Code interpreted as the first user message.
As a secondary consequence, the mission-auto-prompt path was also bypassed
because `hasMissionNoArgs` saw a non-empty args list.

Refactor the runtime subcommand wiring into an exported
`registerRuntimeLaunchers(program, handler)` factory with a
`RuntimeLaunchHandler` type so the commander integration is unit-testable
without spawning subprocesses. Slice the declared positional off `cmd.args`
in the yolo action before forwarding.

Adds `packages/mosaic/src/commands/launch.spec.ts` with 11 regression tests
covering all four runtimes (claude, codex, opencode, pi) for both `<runtime>`
and `yolo <runtime>` paths, excess-args forwarding, and invalid-runtime
rejection. The critical assertion blocks the regression: yolo parses must
forward `extraArgs = []`, not `[runtime]`.

Fixes mosaicstack/stack#454

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-11 11:53:22 -05:00