Skip to content

fix(cmd): runDetached argv mirror silently drops 6 RunOptions fields #1500

@nextlevelshit

Description

@nextlevelshit

Parent: #1494 — Theme 6 (correctness bug, separate from refactor #1499)

Problem

cmd/wave/commands/run.go:766 runDetached rebuilds subprocess argv from RunOptions field-by-field (lines 814-856). Six flags present in RunOptions are absent from the rebuilt argv — silently lost when running detached.

Mirrored fields (lines 814-856): Pipeline, Input, FromStep, Force, Timeout, Manifest, Mock, Model, ForceModel, Adapter, PreserveWorkspace, Steps, Exclude, Verbose, AutoApprove.

RunOptions (lines 36-61) ALSO declares: Continuous, Source, MaxIterations, Delay, OnFailure, NoRetro — none mirrored.

Effect: wave run --detach --continuous --max-iterations 5 --delay 30 ... silently runs single-shot in subprocess. User intent lost without error.

Audit source

audit-architecture-20260428-180146-3ca6 finding #4 (medium severity), 2026-04-28 18:01.
Confirmed audit-architecture-20260428-182103-08a3 finding #4 (medium), 2026-04-28 18:21.

Fix

Two valid paths — pick one:

A. Reflective argv builder — walk RunOptions fields via reflection, emit --<flag> for non-zero values. Adding a new flag automatically covered.

B. Compile-time enforcement — table-driven flag spec (single source for help, parse, argv-rebuild). Test asserts every RunOptions field appears in spec.

Option B preferred — explicit, debuggable, no reflection cost.

Acceptance

  • 6 missing flags propagate to detached subprocess
  • Unit test: walk RunOptions fields, assert each appears in detach argv builder
  • Test fails when new flag added without registration (compile-time table or test enforcement)
  • wave run --detach --continuous --max-iterations 3 ... runs continuous in detached subprocess (verify via state DB or log)

Validation

go test ./cmd/wave/commands -run TestRunDetached -race
wave run --detach --continuous --max-iterations 2 --delay 5 <pipeline>
# verify subprocess actually loops via .agents/state.db

Out of scope

runRun split tracked in #1499. This fixes correctness only.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingexecutorPipeline executor changespriority: highHigh priority issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions