Skip to content

Operations and retries

An operation records a change Heaven has accepted. Keep its ID to follow the work after the request that started it ends.

Operations

#

A management change can return data.operation. Read it by ID with Read an operation, even if the Computer has since been renamed or deleted. Accepted work continues after the client disconnects.

StateMeaning
acceptedHeaven saved the change and the work is in progress.
completeThe work finished.
failedThe work failed. The operation contains its error.
supersededA newer change replaced the operation. Read the resource for its current state.

Some requests return a result per target. Others return a group operation with its own ID and a list of operations. Read the group to follow the whole change and inspect individual results for failures.

Waiting

#

Read an operation can wait for a terminal state. Set wait to true and optionally specify a timeout. The default for this read is 10 seconds and the maximum is 10 minutes. If the wait expires, it returns unknown with the operation ID. Read the same operation again.

Some changes also take a wait option. Use --wait on the CLI or SSH, or wait: true over HTTP, to wait up to 10 minutes. For a shorter wait, use --wait=30s or "wait": "30s". The change can return an operation that is still accepted.

Over HTTP, Accept: application/x-ndjson streams supported operation results. An accepted record carries the initial result. operation records carry terminal outcomes. The stream sends complete after all the operations reach a terminal state. A bounded wait can end with pending. Read any remaining operation by ID.

Request IDs

#

For commands that support replay, a request ID identifies one intended change. Save a new ID and the original inputs before sending a change you may need to recover. If you omit the ID, Heaven supplies one. The command's reference page shows whether it supports replay.

InterfaceWhere to send the ID
HTTPSend the Idempotency-Key header. Heaven refuses a request_id field in the body and refuses the header on commands that don't support it.
CLI and SSHSet --request-id.
MCPSet the request_id argument.

Repeating the same command with the same inputs and ID recovers work Heaven already accepted without applying it twice. A request ID already used for a different change returns conflict. A new ID is for new work.

Lost responses

#

If the connection closes before you get the result, use the information you kept.

What you haveWhat to do
An operation IDRead the operation to follow the work.
A request ID on a command that supports replaySend the original request again with the same inputs and ID.
A change without replay or a usable IDInspect the resource before repeating the change. If you lost an API-key creation response, list your keys and revoke the key whose secret you didn't receive before creating another.
A guest commandCheck its effects inside the Computer before running it again.
An ordinary readRepeat the read after a transient failure.

When Heaven refuses a request, resolve the cause in its error. For rate_limited or busy, wait for the indicated delay if Heaven supplies one.

Unknown outcomes

#

unknown means Heaven couldn't confirm what happened. The change may already have taken effect. Use the operation or request ID in the error if one is available. Follow the lost response steps when the error gives you no ID.