fix(launcher): mosaic yolo runtime passes runtime name as initial user message #454
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
mosaic yolo claude (and yolo codex / opencode / pi) passes the literal runtime name "claude" as the initial user message to the underlying CLI. The agent then receives a bare "claude" as its first prompt and has no idea what it means.
Root cause
packages/mosaic/src/commands/launch.ts:779 — the yolo runtime subcommand action calls launchRuntime(runtime, cmd.args, true). Commander.js includes declared positional arguments in cmd.args, so when you run mosaic yolo claude, cmd.args is ["claude"] — the same value as the already-destructured runtime parameter. launchRuntime then treats ["claude"] as excess args and forwards them to the underlying CLI as positional arguments. For the claude runtime, positional args become the initial user message.
Secondary consequence: because args.length is greater than zero, the hasMissionNoArgs mission-auto-prompt path is also bypassed, so mosaic yolo claude loses the mission-context auto-prompt that mosaic claude normally gets.
Live reproduction
Running mosaic yolo claude with an intercepted claude binary shows argv[4] is the literal string "claude" in addition to the expected --dangerously-skip-permissions and --append-system-prompt arguments.
Fix
Slice off the already-destructured runtime positional before forwarding: launchRuntime(runtime, cmd.args.slice(1), true).
Scope
The non-yolo launchers (mosaic claude, mosaic codex, mosaic opencode, mosaic pi) are unaffected — they do not declare a positional argument so cmd.args is empty. Only the four mosaic yolo variants are broken.
Tests
TDD reproducer required. Refactor to expose a registerRuntimeLaunchers factory with a pluggable launch handler so commander wiring can be tested without spawning subprocesses.
Affected version
mosaicstack/mosaic 0.0.29 (current). Fix to ship in 0.0.30.
Fixed in mosaicstack/stack#455 (merge commit
b2cec8c6ba). Ships in mosaicstack/mosaic 0.0.30.