Wait
cmd/crewship/cmd_wait.go polls a run’s status until it transitions to a final state, then exits with a status-aware code so scripts can act on the outcome without re-parsing JSON.
The run id may be an agent run or a routine (pipeline) run — the agent-run endpoint is probed first, and a 404 falls through to the routine-run endpoint, so callers don’t have to know which subsystem produced the id.
crewship wait <run-id>
A routine run parked on a human approval (status
waiting) is not terminal — wait keeps polling until the waitpoint is approved/rejected and the run finishes, or --timeout fires.
When neither --quiet nor a structured --format (json/yaml/ndjson) is set, status transitions are logged to stderr as [wait] <run> status=<S> elapsed=<dur> and the final state lands on stdout as [done] <run> status=COMPLETED elapsed=12s.
Exit codes
wait is the one documented exception to the CLI’s structured-error contract: because it
owns these run-outcome exit codes, error diagnostics are printed to stderr as plain
[wait] error: ... text even under a machine --format — there is no JSON/YAML error
envelope. Branch on the exit code, not on parsing stderr.Examples
Scope: agent + routine runs only
crewship wait (and its --timeout/--interval polling contract) covers
agent runs and routine (pipeline) runs. A handful of other long-running
commands have grown their own --wait flag that polls a
command-specific status endpoint instead of routing through wait:
crew provision / crew rebuild block by default (pass --no-watch to
opt out) via their own devcontainer-build poll, so they don’t need a
--wait flag at all.
See also
crewship watch— live event tail (use to follow what’s happening during the run).crewship history— find a run-id to wait on.crewship retry <run-id>— kick off a fresh run that you’ll likely want towaiton.