Skip to content

wait

Copy page

Blocks until the agents in the given worktrees reach a status. By default it waits until each worktree has an agent that is done.

Terminal window
workrex wait <worktree>... [--status <status>] [--timeout <seconds>] [--any]
  • <worktree>...: One or more worktree names. Use project:handle to reach an agent in another project.
FlagDescription
--status <status>Status to wait for: working, waiting or done. Default: done.
--timeout <seconds>Maximum time to wait. Without it, wait waits indefinitely.
--anyReturn when any one worktree reaches the status, instead of all of them.

wait prints one line to stderr for each worktree as it finishes, for example user-auth: done (3m 12s). A worktree also counts as finished when its agent stops and the worktree no longer exists, which wait reports as merged. A remote workspace that is removed reports removed.

StatusMeaning
0The worktrees reached the status.
1The timeout passed, and wait names the worktrees it was still waiting for. wait also exits with 1 on an error, such as an unknown worktree.
3An agent that was running stopped while its worktree still exists.

wait keeps waiting for an agent that has not started yet. Use --timeout to bound that.

Terminal window
# Wait for two agents to finish
workrex wait feature-a feature-b
# Confirm that an agent started
workrex wait user-auth --status working --timeout 60
# Continue when the first of several agents finishes
workrex wait task-1 task-2 task-3 --any
  • status to check status once without blocking
  • Skills for how a coordinator agent uses wait