Skip to content

Explicitly repair a Mission's torn status log.

API version mission-write unreleased

POST
/missions/{missionId}/status-log-repairs

Explicit and operator-invoked: the write path never repairs (#222). The operation takes the same in-process turn and per-Mission status lock as a write, under the same shared budget. Its actions are none, completed and quarantined; a missing, empty or LF-terminated log is healthy and answers 200 with action none. A coordination-routed Mission answers 422 WRITE_LOCATION_UNVERIFIED until migration step 4 serves the coordination ref (ADR-0007 D-1): write-location verification cannot verify that location yet. This operation must land and ship in a service-v* release candidate before spec-kitty/spec-kitty#6195 removes core’s status-log writer.

Authorizations

Parameters

Path Parameters

missionId
required
MissionId

The canonical machine identity of a Mission: a 26-character Crockford ULID minted when the Mission is created and never changed. It is the only Mission selector the write service accepts.

string
/^[0-9A-HJKMNP-TV-Z]{26}$/

The identity of the Mission, a 26-character ULID; the only Mission selector accepted.

Header Parameters

Spec-Kitty-Write-Protocol
required
ProtocolVersion

A major version of the write-service protocol, a positive integer. The client sends the major it negotiated in the Spec-Kitty-Write-Protocol header; the handshake lists the majors the service speaks. This document describes major 1.

integer
>= 1

The protocol major the client negotiated through GET /handshake. A missing header, a value that is not an integer, or a major the service does not speak, is refused with PROTOCOL_VERSION_UNSUPPORTED.

Request Bodyrequired

Media type application/json
StatusLogRepairRequest

An explicit, operator-invoked request to repair the status log of the Mission named by the path. It carries the same caller and write-location context as a transition unit, and no row content.

object
context
required
RequestContext

The request context of the repair, verified against the Mission’s write location.

object
actor
required

The actor of the write, as the rows carry it.

string
>= 1 characters
checkout
required

The caller’s checkout, relative to the repository root checkout: a single dot for the repository root checkout, otherwise the worktree’s relative path. For checkout_append it is the checkout that holds the Mission directory, always the repository root checkout. For coordination_ref_commit it only names who asks: the write touches no checkout (ADR-0007).

string
>= 1 characters /^(\.|(?!/)(?![A-Za-z]:)(?!.*\\)(?!(.*/)?\.\.(/|$)).+)$/
destinationRef
required

The branch the unit’s status commit lands on, when the CLI resolved one; null otherwise. Always set for coordination_ref_commit: it is the coordination branch whose ref the service moves.

string | null
missionDirectory
required

The Mission directory (the write location the CLI resolved). For checkout_append it is relative to the checkout; for coordination_ref_commit it is the path of the Mission directory in the tree of destinationRef, relative to the root of that tree.

string
>= 1 characters /^(\.|(?!/)(?![A-Za-z]:)(?!.*\\)(?!(.*/)?\.\.(/|$)).+)$/
writeSurface
required
WriteSurface

The CLI write contract the location was resolved under.

string
Allowed values: checkout_append coordination_ref_commit

Responses

200

The repair outcome; action none means the healthy log was not touched.

Media type application/json
StatusLogRepairAck

The outcome of an explicit status-log repair. repaired is true if and only if action is not none. movedBytes is greater than 0 only for quarantined. quarantinedFile is non-null if and only if action is quarantined, and is always a fixed file name, never a host path.

object
action
required
StatusLogRepairAction

The repair action selected from the state of the Mission’s status log.

string
Allowed values: none completed quarantined
movedBytes
required

The fragment length in bytes for quarantined; zero for none and completed.

integer
quarantinedFile
required

The fixed quarantine file name when action is quarantined; null otherwise, never a host path.

string | null
/^status\.events\.jsonl\.torn$/
readableAfterRepair
required

Whether the log left by the repair decodes and folds as the next write would fold it.

boolean
repaired
required

True if and only if the repair changed the log; equivalent to action not being none.

boolean

400

The request was refused before it was read (400): REQUEST_MALFORMED or PROTOCOL_VERSION_UNSUPPORTED.

Media type application/problem+json
WriteRefusal

The body of every refused write-service request: the shared Problem with a code from WriteRefusalCode and the status that code fixes. A guard refusal also carries type, a WriteRefusalReason URN; every other refusal omits type (about:blank). The body never echoes the bearer token, a host path or row content. A refused batch names the unit that failed in instance, as the JSON pointer #/units/ of the request. Consumers branch on code, never on title.

object
code
required

A stable machine-readable code for the problem, such as the name of a refusal reason. Consumers branch on it, never on the title.

string
detail

A human-readable explanation specific to this occurrence of the problem.

string
instance

A URI reference that identifies this occurrence of the problem.

string
status
required

The HTTP status code of this occurrence.

integer
>= 400 <= 599
title
required

A short, human-readable summary of the kind of problem. It does not change between occurrences.

string
type

A URI reference that identifies the kind of problem. Absent means about:blank.

string
code
required
One of:
WriteRefusalCode
  1. The lane state machine or one of its guards refused the transition. The type names the reason, including stale_from_lane for a stale unit whose from_lane is not the work package’s current lane. The CLI’s orchestrator-api code for a TransitionError.
string
Allowed value: TRANSITION_REJECTED
type
One of:
WriteRefusalReason

The from or to status lane is not one of the 11 persisted Lane values.

string
Allowed value: urn:spec-kitty:write-refusal:unknown_lane

401

The bearer token is missing or wrong (401, WRITE_TOKEN_INVALID). The body never echoes the token.

Media type application/problem+json
WriteRefusal

The body of every refused write-service request: the shared Problem with a code from WriteRefusalCode and the status that code fixes. A guard refusal also carries type, a WriteRefusalReason URN; every other refusal omits type (about:blank). The body never echoes the bearer token, a host path or row content. A refused batch names the unit that failed in instance, as the JSON pointer #/units/ of the request. Consumers branch on code, never on title.

object
code
required

A stable machine-readable code for the problem, such as the name of a refusal reason. Consumers branch on it, never on the title.

string
detail

A human-readable explanation specific to this occurrence of the problem.

string
instance

A URI reference that identifies this occurrence of the problem.

string
status
required

The HTTP status code of this occurrence.

integer
>= 400 <= 599
title
required

A short, human-readable summary of the kind of problem. It does not change between occurrences.

string
type

A URI reference that identifies the kind of problem. Absent means about:blank.

string
code
required
One of:
WriteRefusalCode
  1. The lane state machine or one of its guards refused the transition. The type names the reason, including stale_from_lane for a stale unit whose from_lane is not the work package’s current lane. The CLI’s orchestrator-api code for a TransitionError.
string
Allowed value: TRANSITION_REJECTED
type
One of:
WriteRefusalReason

The from or to status lane is not one of the 11 persisted Lane values.

string
Allowed value: urn:spec-kitty:write-refusal:unknown_lane

Headers

WWW-Authenticate
string

The bearer challenge (RFC 9110), Bearer with no parameters.

403

The Host, Origin or Sec-Fetch-Site guard refused the request (403, REQUEST_REFUSED).

Media type application/problem+json
WriteRefusal

The body of every refused write-service request: the shared Problem with a code from WriteRefusalCode and the status that code fixes. A guard refusal also carries type, a WriteRefusalReason URN; every other refusal omits type (about:blank). The body never echoes the bearer token, a host path or row content. A refused batch names the unit that failed in instance, as the JSON pointer #/units/ of the request. Consumers branch on code, never on title.

object
code
required

A stable machine-readable code for the problem, such as the name of a refusal reason. Consumers branch on it, never on the title.

string
detail

A human-readable explanation specific to this occurrence of the problem.

string
instance

A URI reference that identifies this occurrence of the problem.

string
status
required

The HTTP status code of this occurrence.

integer
>= 400 <= 599
title
required

A short, human-readable summary of the kind of problem. It does not change between occurrences.

string
type

A URI reference that identifies the kind of problem. Absent means about:blank.

string
code
required
One of:
WriteRefusalCode
  1. The lane state machine or one of its guards refused the transition. The type names the reason, including stale_from_lane for a stale unit whose from_lane is not the work package’s current lane. The CLI’s orchestrator-api code for a TransitionError.
string
Allowed value: TRANSITION_REJECTED
type
One of:
WriteRefusalReason

The from or to status lane is not one of the 11 persisted Lane values.

string
Allowed value: urn:spec-kitty:write-refusal:unknown_lane

404

The Mission or the work package does not exist (404, MISSION_NOT_FOUND or WP_NOT_FOUND).

Media type application/problem+json
WriteRefusal

The body of every refused write-service request: the shared Problem with a code from WriteRefusalCode and the status that code fixes. A guard refusal also carries type, a WriteRefusalReason URN; every other refusal omits type (about:blank). The body never echoes the bearer token, a host path or row content. A refused batch names the unit that failed in instance, as the JSON pointer #/units/ of the request. Consumers branch on code, never on title.

object
code
required

A stable machine-readable code for the problem, such as the name of a refusal reason. Consumers branch on it, never on the title.

string
detail

A human-readable explanation specific to this occurrence of the problem.

string
instance

A URI reference that identifies this occurrence of the problem.

string
status
required

The HTTP status code of this occurrence.

integer
>= 400 <= 599
title
required

A short, human-readable summary of the kind of problem. It does not change between occurrences.

string
type

A URI reference that identifies the kind of problem. Absent means about:blank.

string
code
required
One of:
WriteRefusalCode
  1. The lane state machine or one of its guards refused the transition. The type names the reason, including stale_from_lane for a stale unit whose from_lane is not the work package’s current lane. The CLI’s orchestrator-api code for a TransitionError.
string
Allowed value: TRANSITION_REJECTED
type
One of:
WriteRefusalReason

The from or to status lane is not one of the 11 persisted Lane values.

string
Allowed value: urn:spec-kitty:write-refusal:unknown_lane

409

The lane state machine, a guard, the claim, the status lock, the event log, or the coordination branch (moved during the compare-and-swap, or checked out in a worktree) refused the write (409). Nothing was written.

Media type application/problem+json
WriteRefusal

The body of every refused write-service request: the shared Problem with a code from WriteRefusalCode and the status that code fixes. A guard refusal also carries type, a WriteRefusalReason URN; every other refusal omits type (about:blank). The body never echoes the bearer token, a host path or row content. A refused batch names the unit that failed in instance, as the JSON pointer #/units/ of the request. Consumers branch on code, never on title.

object
code
required

A stable machine-readable code for the problem, such as the name of a refusal reason. Consumers branch on it, never on the title.

string
detail

A human-readable explanation specific to this occurrence of the problem.

string
instance

A URI reference that identifies this occurrence of the problem.

string
status
required

The HTTP status code of this occurrence.

integer
>= 400 <= 599
title
required

A short, human-readable summary of the kind of problem. It does not change between occurrences.

string
type

A URI reference that identifies the kind of problem. Absent means about:blank.

string
code
required
One of:
WriteRefusalCode
  1. The lane state machine or one of its guards refused the transition. The type names the reason, including stale_from_lane for a stale unit whose from_lane is not the work package’s current lane. The CLI’s orchestrator-api code for a TransitionError.
string
Allowed value: TRANSITION_REJECTED
type
One of:
WriteRefusalReason

The from or to status lane is not one of the 11 persisted Lane values.

string
Allowed value: urn:spec-kitty:write-refusal:unknown_lane

413

The body exceeds the size cap (413, REQUEST_TOO_LARGE). Provisional.

Media type application/problem+json
WriteRefusal

The body of every refused write-service request: the shared Problem with a code from WriteRefusalCode and the status that code fixes. A guard refusal also carries type, a WriteRefusalReason URN; every other refusal omits type (about:blank). The body never echoes the bearer token, a host path or row content. A refused batch names the unit that failed in instance, as the JSON pointer #/units/ of the request. Consumers branch on code, never on title.

object
code
required

A stable machine-readable code for the problem, such as the name of a refusal reason. Consumers branch on it, never on the title.

string
detail

A human-readable explanation specific to this occurrence of the problem.

string
instance

A URI reference that identifies this occurrence of the problem.

string
status
required

The HTTP status code of this occurrence.

integer
>= 400 <= 599
title
required

A short, human-readable summary of the kind of problem. It does not change between occurrences.

string
type

A URI reference that identifies the kind of problem. Absent means about:blank.

string
code
required
One of:
WriteRefusalCode
  1. The lane state machine or one of its guards refused the transition. The type names the reason, including stale_from_lane for a stale unit whose from_lane is not the work package’s current lane. The CLI’s orchestrator-api code for a TransitionError.
string
Allowed value: TRANSITION_REJECTED
type
One of:
WriteRefusalReason

The from or to status lane is not one of the 11 persisted Lane values.

string
Allowed value: urn:spec-kitty:write-refusal:unknown_lane

422

The write location or its destination refused the write (422): a protected branch, a destination ref problem, a deleted coordination branch, an owned checkout that does not hold the Mission or an unverified write location. Nothing was written.

Media type application/problem+json
WriteRefusal

The body of every refused write-service request: the shared Problem with a code from WriteRefusalCode and the status that code fixes. A guard refusal also carries type, a WriteRefusalReason URN; every other refusal omits type (about:blank). The body never echoes the bearer token, a host path or row content. A refused batch names the unit that failed in instance, as the JSON pointer #/units/ of the request. Consumers branch on code, never on title.

object
code
required

A stable machine-readable code for the problem, such as the name of a refusal reason. Consumers branch on it, never on the title.

string
detail

A human-readable explanation specific to this occurrence of the problem.

string
instance

A URI reference that identifies this occurrence of the problem.

string
status
required

The HTTP status code of this occurrence.

integer
>= 400 <= 599
title
required

A short, human-readable summary of the kind of problem. It does not change between occurrences.

string
type

A URI reference that identifies the kind of problem. Absent means about:blank.

string
code
required
One of:
WriteRefusalCode
  1. The lane state machine or one of its guards refused the transition. The type names the reason, including stale_from_lane for a stale unit whose from_lane is not the work package’s current lane. The CLI’s orchestrator-api code for a TransitionError.
string
Allowed value: TRANSITION_REJECTED
type
One of:
WriteRefusalReason

The from or to status lane is not one of the 11 persisted Lane values.

string
Allowed value: urn:spec-kitty:write-refusal:unknown_lane

500

The write failed after it was accepted (500): the append, its verification or the status commit failed, or the coordination surface is unreadable. Nothing is acknowledged.

Media type application/problem+json
WriteRefusal

The body of every refused write-service request: the shared Problem with a code from WriteRefusalCode and the status that code fixes. A guard refusal also carries type, a WriteRefusalReason URN; every other refusal omits type (about:blank). The body never echoes the bearer token, a host path or row content. A refused batch names the unit that failed in instance, as the JSON pointer #/units/ of the request. Consumers branch on code, never on title.

object
code
required

A stable machine-readable code for the problem, such as the name of a refusal reason. Consumers branch on it, never on the title.

string
detail

A human-readable explanation specific to this occurrence of the problem.

string
instance

A URI reference that identifies this occurrence of the problem.

string
status
required

The HTTP status code of this occurrence.

integer
>= 400 <= 599
title
required

A short, human-readable summary of the kind of problem. It does not change between occurrences.

string
type

A URI reference that identifies the kind of problem. Absent means about:blank.

string
code
required
One of:
WriteRefusalCode
  1. The lane state machine or one of its guards refused the transition. The type names the reason, including stale_from_lane for a stale unit whose from_lane is not the work package’s current lane. The CLI’s orchestrator-api code for a TransitionError.
string
Allowed value: TRANSITION_REJECTED
type
One of:
WriteRefusalReason

The from or to status lane is not one of the 11 persisted Lane values.

string
Allowed value: urn:spec-kitty:write-refusal:unknown_lane

503

The service cannot take the write or repair now (503). SERVICE_BUSY: it is serializing other writes beyond its queue bound; retry the same service after Retry-After seconds. SERVICE_DRAINING: it is about to exit; re-read the endpoint file. A write or repair still waiting for the turn or the Mission lock when draining begins answers 503 SERVICE_DRAINING and writes nothing; one already holding the lock finishes. Provisional.

Media type application/problem+json
WriteRefusal

The body of every refused write-service request: the shared Problem with a code from WriteRefusalCode and the status that code fixes. A guard refusal also carries type, a WriteRefusalReason URN; every other refusal omits type (about:blank). The body never echoes the bearer token, a host path or row content. A refused batch names the unit that failed in instance, as the JSON pointer #/units/ of the request. Consumers branch on code, never on title.

object
code
required

A stable machine-readable code for the problem, such as the name of a refusal reason. Consumers branch on it, never on the title.

string
detail

A human-readable explanation specific to this occurrence of the problem.

string
instance

A URI reference that identifies this occurrence of the problem.

string
status
required

The HTTP status code of this occurrence.

integer
>= 400 <= 599
title
required

A short, human-readable summary of the kind of problem. It does not change between occurrences.

string
type

A URI reference that identifies the kind of problem. Absent means about:blank.

string
code
required
One of:
WriteRefusalCode
  1. The lane state machine or one of its guards refused the transition. The type names the reason, including stale_from_lane for a stale unit whose from_lane is not the work package’s current lane. The CLI’s orchestrator-api code for a TransitionError.
string
Allowed value: TRANSITION_REJECTED
type
One of:
WriteRefusalReason

The from or to status lane is not one of the 11 persisted Lane values.

string
Allowed value: urn:spec-kitty:write-refusal:unknown_lane

Headers

Retry-After
integer
>= 1

Seconds to wait before retrying; sent with SERVICE_BUSY, absent with SERVICE_DRAINING.