fix(launcher): mosaic yolo runtime passes runtime name as initial user message #454

Closed
opened 2026-04-11 16:42:14 +00:00 by jason.woltje · 1 comment
Owner

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.

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.
Author
Owner

Fixed in mosaicstack/stack#455 (merge commit b2cec8c6ba). Ships in mosaicstack/mosaic 0.0.30.

Fixed in mosaicstack/stack#455 (merge commit b2cec8c6bac29336a6cdcdb4f19806f7b5fa0054). Ships in mosaicstack/mosaic 0.0.30.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mosaicstack/stack#454