Tasks
Lifecycle commands may return before their work finishes. When a response contains taskId, retain that ID and inspect the task until it reaches a terminal state.
Tasks span VMs, jails, and template operations. The task commands are read-only: they inspect current and historical work but do not cancel or retry it.
Understand task states
Section titled “Understand task states”Every lifecycle task has one of four states:
| Status | Meaning | Terminal |
|---|---|---|
queued |
Accepted and waiting to run | No |
running |
Work is in progress | No |
success |
The operation completed | Yes |
failed |
The operation stopped with an error | Yes |
Do not treat a successfully queued request as a completed operation. The command response confirms acceptance; the task record confirms the result.
List active tasks
Section titled “List active tasks”Show tasks that are currently queued or running:
doas sylve tasks activeUse JSON for automation:
doas sylve tasks active --jsonLoki had no active work during the documentation run:
[]The readable output for the same state is No lifecycle tasks found.
List recent tasks
Section titled “List recent tasks”Show recent tasks across all guest types:
doas sylve tasks recent --limit 6--limit accepts values from 1 through 200 and defaults to 50.
Filter task history
Section titled “Filter task history”Both active and recent accept --guest-type and --guest-id:
doas sylve tasks recent \ --guest-type vm \ --guest-id 301 \ --limit 5 \ --jsonKnown guest types are:
vmjailvm-templatejail-template
Filters may be used independently. A guest-type-only query is useful for reviewing all VM-template work:
doas sylve tasks recent --guest-type vm-template --limit 5 --jsonInspect one task
Section titled “Inspect one task”Use the task ID returned by the original operation:
doas sylve tasks get --id 34The readable result summarizes timing and outcome:
Task ID: 34Guest type: vm-templateGuest ID: 1Action: createSource: userStatus: successRequested by: consoleCreated: 2026-08-22T22:27:04ZStarted: 2026-08-22T22:27:06ZFinished: 2026-08-22T22:27:09ZMessage: completedUse JSON to retain the full payload and exact timestamps:
doas sylve tasks get --id 34 --jsonImportant fields include:
guestType,guestId, andactionidentify the operation.sourceandrequestedByidentify how it was requested.status,message, anderrordescribe the result.payloadcontains the serialized request for operations that need one.createdAt,startedAt, andfinishedAtshow queue and execution timing.overrideRequestedrecords whether an applicable lifecycle override was requested.
Poll safely from a script
Section titled “Poll safely from a script”Capture the ID from a queued operation, then poll until the task succeeds or fails:
result="$(doas sylve vms start --rid 301 --json)" || exit 1task_id="$(printf '%s\n' "$result" | jq -er '.taskId')" || exit 1
while :; do task="$(doas sylve tasks get --id "$task_id" --json)" || exit 1 status="$(printf '%s\n' "$task" | jq -r '.status')"
case "$status" in success) break ;; failed) printf '%s\n' "$task" | jq -r '.error' exit 1 ;; queued|running) sleep 1 ;; *) printf 'Unknown task status: %s\n' "$status" >&2 exit 1 ;; esacdoneUse a bounded timeout in production automation so a lost connection or stalled task cannot block a script forever.
Handle failures
Section titled “Handle failures”A failed task keeps its request and error for inspection. Start with:
doas sylve tasks get --id TASK_ID --jsonReview error, message, and payload, correct the underlying problem, and issue the original operation again. The current CLI does not provide task cancel or retry commands. Retrying the original command creates a new task with a new ID.
Use the interactive console
Section titled “Use the interactive console”The console uses positional task IDs:
tasks active --jsontasks active --guest-type vm --guest-id 301 --jsontasks recent --limit 20 --jsontasks recent --guest-type vm-template --limit 5 --jsontasks get 34 --jsonDirect and console modes expose the same task records and filters.