Relationships
#2547 workflow run --json: guarded-skip lines land on stdout or stderr depending on timing
Opened by hammz · 9/25/2026· Shipped 9/28/2026
Summary
In JSON mode, workflow run writes one line per guarded step skip with console.log before the final run document. Whether that line reaches stdout or stderr depends on timing: if any model method in the run is executing at that moment, the line lands on stderr instead of stdout. So stdout is not reliably a single JSON document, and the set of skip lines on stdout changes with step scheduling.
Cause
The JsonWorkflowRunRenderer step_skipped handler in src/presentation/renderers/workflow_run.ts (around line 831) calls console.log for reason guarded. In JSON mode, withConsoleGuard in src/domain/models/console_guard.ts replaces the global console methods while any method runs (activeGuards above zero). It pushes every captured line into all active log buffers and flushes them to stderr when that method finishes. The renderer's own console.log is therefore captured as if the running model had written it, so it goes to stderr and is also appended to an unrelated method's captured logs.
Steps to reproduce
- A workflow with job main containing a command/shell step deploy running true, and a step cleanup with guard set to a true expression.
- A second job fanout with a forEach step over dev, staging and prod, guarded so dev and staging are skipped.
- Run swamp workflow run with --json and separate stdout from stderr.
Observed, the same across 3 runs: the each-dev skip line was on stdout ahead of the run document, while the cleanup and each-staging skip lines were on stderr. The dependency skip produces no line at all.
Expected
Guarded-skip lines in JSON mode go to a single, deterministic stream, and never pass through the console guard of a concurrently running method. Separately, it is worth deciding whether these lines belong on stdout at all, given that the run document is also written there.
Environment
swamp 20260925.180024.0-sha.e08f1d5b, Linux x86_64. Found while reproducing swamp-club#2538.
Shipped
Click a lifecycle step above to view its details.
Sign in to post a ripple.