ReferenceHTTP APIRecovery

Operator decision for an unknown outcome or a context no checkpoint covers

POST
/v1/sessions/{id}/recovery-decisions

Records an operator's decision where the platform will not guess: a turn whose outcome is unknown, or context no checkpoint covers. Nothing the execution did outside is reverted.

  • abandon: the outcome_unknown turn target_turn_id becomes cancelled and its input receipt fails; the session is stopped.
  • confirm_completed: with evidence_ref, the turn becomes completed and its input receipt succeeds; it needs a committed checkpoint that reaches the turn. The session is stopped.
  • close: ends the session for good.
  • start_fresh: continues on a new engine session that does not remember the turns before; the checkpoints so far are retired and queued input runs.
  • retry_restore: restores the same checkpoint again after what made the restores fail is fixed; queued input runs.

The decision takes effect in the request: the receipt is succeeded in the response, with result {resulting_admission_state, checkpoint_revision, resumable}. After abandon or confirm_completed, resume the session; resumable: false means a resume would answer CHECKPOINT_UNAVAILABLE. The decision is also recorded as a system event on the stream.

Scope: sessions:recover (API key or cookie session). Idempotency-Key: required.

Authorization

headerAuthorizationBearer <token>

For servers and scripts: an API key sent as an HTTP bearer token, Bearer <key>. It holds exactly the scopes it was issued with; a key issued before scopes existed holds none. It never needs the CSRF header, and it cannot manage agents, members, teams or API keys. Issue one in the web console under Settings → API keys; each operation names the scope it needs.

Scope: sessions:recover

Path Parameters

id*string

The session's id.

Match^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
Formatuuid

Header Parameters

Idempotency-Key*string

Required, 1–255 characters; a UUID per user intent works. A retry with the same key and the same body returns the original response and runs the command once; the same key with a different body answers 409 IDEMPOTENCY_CONFLICT. A missing or invalid key answers 400 BAD_REQUEST, after the body is read.

Length1 <= length <= 255
X-Requested-With?"werft-web"

Required with a cookie session: the literal werft-web.

Value in"werft-web"

Request Body

application/json
  1. body
expected_revision*integer
Range0 <= value <= 2147483647
reason*string
Length1 <= length
decision*string
target_turn_id*string
Length1 <= length

Response Body

The decision is applied; the receipt is succeeded.

application/json
  1. response
receipt_id*string
Match^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
Formatuuid
receipt_status*string
Value in"accepted""succeeded""failed""unknown"
Example Request
curl -X POST 'https://example.com/v1/sessions/497f6eca-6276-4993-bfeb-53cbbbba6f08/recovery-decisions' \  -H 'Idempotency-Key: string' \  -H 'Content-Type: application/json' \  -d '{  "decision": "abandon",  "expected_revision": 9,  "target_turn_id": "3",  "reason": "The call had no external effect."}'
Example Response
{  "receipt_id": "c4a1e9d2-7b3f-4e8a-a6c5-1d2e3f4a5b6c",  "receipt_status": "succeeded"}