Ask the service to drain and exit.
API version mission-write unreleased
The service stops accepting writes and repairs (health reads draining and a new write or repair is refused with SERVICE_DRAINING). 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. The service finishes the writes it holds, removes its endpoint file while it still names this instance and exits 0. It answers 202 before it exits; a shutdown while it already drains is answered 202 and starts nothing new. Settled when command-cli was built (spec-kitty/spec-kitty-events#156).
Authorizations
Parameters
Header Parameters
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.
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.
Responses
202
The service drains and exits.
400
The request was refused before it was read (400): REQUEST_MALFORMED or PROTOCOL_VERSION_UNSUPPORTED.
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/
object
A stable machine-readable code for the problem, such as the name of a refusal reason. Consumers branch on it, never on the title.
A human-readable explanation specific to this occurrence of the problem.
A URI reference that identifies this occurrence of the problem.
The HTTP status code of this occurrence.
A short, human-readable summary of the kind of problem. It does not change between occurrences.
A URI reference that identifies the kind of problem. Absent means about:blank.
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- 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.
- Another actor holds the claim on the work package. The CLI’s orchestrator-api code for a WorkPackageClaimConflict.
- A dependency of the work package is not approved, done or canceled with operator provenance, and the transition is gated on it.
- The Mission has no work package with this wpId.
- No Mission of the repository has this missionId.
- The per-Mission status lock is held by another writer (a CLI writer during the strangler) beyond the wait budget.
- The request repeats an event_id inside one unit or batch.
- Protocol-only. The coordination branch moved between the read of its tip and the compare-and-swap update of the ref, so another writer committed to it; nothing is written and the service does not retry (ADR-0007). Provisional until migration step 4 serves the surface.
- Protocol-only. The coordination branch is checked out in a worktree of the repository, so a commit to its ref would leave that checkout behind; nothing is written (ADR-0007). Provisional until migration step 4 serves the surface.
- The write would commit to a protected branch.
- The destination branch does not exist locally.
- The destination ref is empty, padded, fully qualified or starts with a dash or a slash.
- The destination branch exists only as a remote-tracking ref.
- The Mission’s recorded coordination branch (the destinationRef of a coordination_ref_commit) no longer exists.
- The caller’s owned checkout does not hold the Mission of the request.
- Protocol-only. The Mission’s event log in the tree of the coordination branch tip cannot be read or parsed, so the append cannot be judged against it; nothing is written (ADR-0007). Provisional until migration step 4 serves the surface.
- The append, or its read-back verification, failed; the unit is not acknowledged. Also answers a torn tail (refused, not repaired), a log the write fold cannot reduce, and a failed write or sync after which the append was cut back.
- The status commit of the unit failed and the append was cut.
- Protocol-only. The service could not verify the missionDirectory and writeSurface of the request context against its own resolution. A coordination_ref_commit unit is refused before migration step 4, ahead of any Mission lookup. On checkout_append, also answers when checkout is not ., destinationRef is not null, or missionDirectory is not the directory of the Mission named by missionId. Provisional: the verification rule is open until write-location resolution moves into the service (ADR 2026-10-22-1 open question 2).
- Protocol-only. The body does not have the contract’s shape (an empty unit, more than 64 units, a missing field), or a row names another work package or Mission than the request. Also answers a row of the wrong kind for its position, a lane alias or non-canonical lane spelling, a non-finite number, and a session-time pair that cannot be subtracted. Also answers a row the service could not read back: before appending, it decodes and re-folds the new rows with the log, and refuses JSON nesting beyond 256, an integer beyond 4300 digits, an actor object the fold cannot decode, or a unit the fold rejects; a batch unit gets this 400 with instance naming it.
- Protocol-only. The Spec-Kitty-Write-Protocol header is missing, is not an integer, or names a major the service does not speak; the detail lists the supported majors.
- Protocol-only. The bearer token is missing or wrong. The body never echoes the token.
- Protocol-only. The Host, Origin or Sec-Fetch-Site guard refused the request, as the read service’s request_refused does.
- Protocol-only. An event_id of the request is already persisted with different content, or only some of a unit’s event ids are persisted. Provisional (idempotent retry).
- Protocol-only. The body exceeds the size cap (1 MiB, provisional).
- Protocol-only. The service is serializing other writes beyond its queue bound; retry the same service after the Retry-After seconds. The in-process turn and the Mission lock share one 10 s budget. Provisional (backpressure).
- Protocol-only. The service is draining before it exits; re-read the endpoint file and retry against the service it names (the launcher starts one when none runs).
- WriteRefusalReason
- WriteRefusalReason
- WriteRefusalReason
- WriteRefusalReason
- WriteRefusalReason
- WriteRefusalReason
- WriteRefusalReason
- WriteRefusalReason
- WriteRefusalReason
- WriteRefusalReason
- WriteRefusalReason
- WriteRefusalReason
- WriteRefusalReason
- WriteRefusalReason
- WriteRefusalReason
- WriteRefusalReason
The from or to status lane is not one of the 11 persisted Lane values.
The edge is not in the lane state machine, or leaves a terminal lane without force.
A forced transition carries no actor or no reason.
The transition needs an actor identity (a claim, a review claim).
A dependency of the work package is not approved, done, or canceled with operator provenance.
Claimed to in_progress carries no workspace context. No wire request can produce this reason: every wire door supplies or synthesises a context. Core’s guard is a fail-closed invariant for its own batch API (transition_pipeline.py:322-337 at core main @ 366ff233; operator decision 2026-09-07, spec-kitty/spec-kitty#946, DRIFT-3), kept so the vocabulary mirrors core.
In_progress to for_review fails either half of the guard. Both halves are reachable: the subtask half comes from the roster, and the evidence half comes from implementationEvidencePresent: false.
The transition needs a reason (in_progress back to planned).
The transition needs a review_ref.
A move to approved or done carries no reviewer identity or approval reference.
The review result is incomplete, does not match its review_ref, or conflicts with a live review claim.
A forced exit from in_review or approved carries no note.
The done evidence lacks the reviewer, the verdict or the reference.
Another actor holds the claim (travels under WP_ALREADY_CLAIMED).
The work package cannot start: not finalized, in the wrong status lane, or force misused.
The unit’s from_lane is not the work package’s current lane. Provisional events-side addition with no core equivalent (spec-kitty/spec-kitty-events#161).
401
The bearer token is missing or wrong (401, WRITE_TOKEN_INVALID). The body never echoes the token.
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/
object
A stable machine-readable code for the problem, such as the name of a refusal reason. Consumers branch on it, never on the title.
A human-readable explanation specific to this occurrence of the problem.
A URI reference that identifies this occurrence of the problem.
The HTTP status code of this occurrence.
A short, human-readable summary of the kind of problem. It does not change between occurrences.
A URI reference that identifies the kind of problem. Absent means about:blank.
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- 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.
- Another actor holds the claim on the work package. The CLI’s orchestrator-api code for a WorkPackageClaimConflict.
- A dependency of the work package is not approved, done or canceled with operator provenance, and the transition is gated on it.
- The Mission has no work package with this wpId.
- No Mission of the repository has this missionId.
- The per-Mission status lock is held by another writer (a CLI writer during the strangler) beyond the wait budget.
- The request repeats an event_id inside one unit or batch.
- Protocol-only. The coordination branch moved between the read of its tip and the compare-and-swap update of the ref, so another writer committed to it; nothing is written and the service does not retry (ADR-0007). Provisional until migration step 4 serves the surface.
- Protocol-only. The coordination branch is checked out in a worktree of the repository, so a commit to its ref would leave that checkout behind; nothing is written (ADR-0007). Provisional until migration step 4 serves the surface.
- The write would commit to a protected branch.
- The destination branch does not exist locally.
- The destination ref is empty, padded, fully qualified or starts with a dash or a slash.
- The destination branch exists only as a remote-tracking ref.
- The Mission’s recorded coordination branch (the destinationRef of a coordination_ref_commit) no longer exists.
- The caller’s owned checkout does not hold the Mission of the request.
- Protocol-only. The Mission’s event log in the tree of the coordination branch tip cannot be read or parsed, so the append cannot be judged against it; nothing is written (ADR-0007). Provisional until migration step 4 serves the surface.
- The append, or its read-back verification, failed; the unit is not acknowledged. Also answers a torn tail (refused, not repaired), a log the write fold cannot reduce, and a failed write or sync after which the append was cut back.
- The status commit of the unit failed and the append was cut.
- Protocol-only. The service could not verify the missionDirectory and writeSurface of the request context against its own resolution. A coordination_ref_commit unit is refused before migration step 4, ahead of any Mission lookup. On checkout_append, also answers when checkout is not ., destinationRef is not null, or missionDirectory is not the directory of the Mission named by missionId. Provisional: the verification rule is open until write-location resolution moves into the service (ADR 2026-10-22-1 open question 2).
- Protocol-only. The body does not have the contract’s shape (an empty unit, more than 64 units, a missing field), or a row names another work package or Mission than the request. Also answers a row of the wrong kind for its position, a lane alias or non-canonical lane spelling, a non-finite number, and a session-time pair that cannot be subtracted. Also answers a row the service could not read back: before appending, it decodes and re-folds the new rows with the log, and refuses JSON nesting beyond 256, an integer beyond 4300 digits, an actor object the fold cannot decode, or a unit the fold rejects; a batch unit gets this 400 with instance naming it.
- Protocol-only. The Spec-Kitty-Write-Protocol header is missing, is not an integer, or names a major the service does not speak; the detail lists the supported majors.
- Protocol-only. The bearer token is missing or wrong. The body never echoes the token.
- Protocol-only. The Host, Origin or Sec-Fetch-Site guard refused the request, as the read service’s request_refused does.
- Protocol-only. An event_id of the request is already persisted with different content, or only some of a unit’s event ids are persisted. Provisional (idempotent retry).
- Protocol-only. The body exceeds the size cap (1 MiB, provisional).
- Protocol-only. The service is serializing other writes beyond its queue bound; retry the same service after the Retry-After seconds. The in-process turn and the Mission lock share one 10 s budget. Provisional (backpressure).
- Protocol-only. The service is draining before it exits; re-read the endpoint file and retry against the service it names (the launcher starts one when none runs).
- WriteRefusalReason
- WriteRefusalReason
- WriteRefusalReason
- WriteRefusalReason
- WriteRefusalReason
- WriteRefusalReason
- WriteRefusalReason
- WriteRefusalReason
- WriteRefusalReason
- WriteRefusalReason
- WriteRefusalReason
- WriteRefusalReason
- WriteRefusalReason
- WriteRefusalReason
- WriteRefusalReason
- WriteRefusalReason
The from or to status lane is not one of the 11 persisted Lane values.
The edge is not in the lane state machine, or leaves a terminal lane without force.
A forced transition carries no actor or no reason.
The transition needs an actor identity (a claim, a review claim).
A dependency of the work package is not approved, done, or canceled with operator provenance.
Claimed to in_progress carries no workspace context. No wire request can produce this reason: every wire door supplies or synthesises a context. Core’s guard is a fail-closed invariant for its own batch API (transition_pipeline.py:322-337 at core main @ 366ff233; operator decision 2026-09-07, spec-kitty/spec-kitty#946, DRIFT-3), kept so the vocabulary mirrors core.
In_progress to for_review fails either half of the guard. Both halves are reachable: the subtask half comes from the roster, and the evidence half comes from implementationEvidencePresent: false.
The transition needs a reason (in_progress back to planned).
The transition needs a review_ref.
A move to approved or done carries no reviewer identity or approval reference.
The review result is incomplete, does not match its review_ref, or conflicts with a live review claim.
A forced exit from in_review or approved carries no note.
The done evidence lacks the reviewer, the verdict or the reference.
Another actor holds the claim (travels under WP_ALREADY_CLAIMED).
The work package cannot start: not finalized, in the wrong status lane, or force misused.
The unit’s from_lane is not the work package’s current lane. Provisional events-side addition with no core equivalent (spec-kitty/spec-kitty-events#161).
Headers
The bearer challenge (RFC 9110), Bearer with no parameters.
403
The Host, Origin or Sec-Fetch-Site guard refused the request (403, REQUEST_REFUSED).
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/
object
A stable machine-readable code for the problem, such as the name of a refusal reason. Consumers branch on it, never on the title.
A human-readable explanation specific to this occurrence of the problem.
A URI reference that identifies this occurrence of the problem.
The HTTP status code of this occurrence.
A short, human-readable summary of the kind of problem. It does not change between occurrences.
A URI reference that identifies the kind of problem. Absent means about:blank.
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- WriteRefusalCode
- 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.
- Another actor holds the claim on the work package. The CLI’s orchestrator-api code for a WorkPackageClaimConflict.
- A dependency of the work package is not approved, done or canceled with operator provenance, and the transition is gated on it.
- The Mission has no work package with this wpId.
- No Mission of the repository has this missionId.
- The per-Mission status lock is held by another writer (a CLI writer during the strangler) beyond the wait budget.
- The request repeats an event_id inside one unit or batch.
- Protocol-only. The coordination branch moved between the read of its tip and the compare-and-swap update of the ref, so another writer committed to it; nothing is written and the service does not retry (ADR-0007). Provisional until migration step 4 serves the surface.
- Protocol-only. The coordination branch is checked out in a worktree of the repository, so a commit to its ref would leave that checkout behind; nothing is written (ADR-0007). Provisional until migration step 4 serves the surface.
- The write would commit to a protected branch.
- The destination branch does not exist locally.
- The destination ref is empty, padded, fully qualified or starts with a dash or a slash.
- The destination branch exists only as a remote-tracking ref.
- The Mission’s recorded coordination branch (the destinationRef of a coordination_ref_commit) no longer exists.
- The caller’s owned checkout does not hold the Mission of the request.
- Protocol-only. The Mission’s event log in the tree of the coordination branch tip cannot be read or parsed, so the append cannot be judged against it; nothing is written (ADR-0007). Provisional until migration step 4 serves the surface.
- The append, or its read-back verification, failed; the unit is not acknowledged. Also answers a torn tail (refused, not repaired), a log the write fold cannot reduce, and a failed write or sync after which the append was cut back.
- The status commit of the unit failed and the append was cut.
- Protocol-only. The service could not verify the missionDirectory and writeSurface of the request context against its own resolution. A coordination_ref_commit unit is refused before migration step 4, ahead of any Mission lookup. On checkout_append, also answers when checkout is not ., destinationRef is not null, or missionDirectory is not the directory of the Mission named by missionId. Provisional: the verification rule is open until write-location resolution moves into the service (ADR 2026-10-22-1 open question 2).
- Protocol-only. The body does not have the contract’s shape (an empty unit, more than 64 units, a missing field), or a row names another work package or Mission than the request. Also answers a row of the wrong kind for its position, a lane alias or non-canonical lane spelling, a non-finite number, and a session-time pair that cannot be subtracted. Also answers a row the service could not read back: before appending, it decodes and re-folds the new rows with the log, and refuses JSON nesting beyond 256, an integer beyond 4300 digits, an actor object the fold cannot decode, or a unit the fold rejects; a batch unit gets this 400 with instance naming it.
- Protocol-only. The Spec-Kitty-Write-Protocol header is missing, is not an integer, or names a major the service does not speak; the detail lists the supported majors.
- Protocol-only. The bearer token is missing or wrong. The body never echoes the token.
- Protocol-only. The Host, Origin or Sec-Fetch-Site guard refused the request, as the read service’s request_refused does.
- Protocol-only. An event_id of the request is already persisted with different content, or only some of a unit’s event ids are persisted. Provisional (idempotent retry).
- Protocol-only. The body exceeds the size cap (1 MiB, provisional).
- Protocol-only. The service is serializing other writes beyond its queue bound; retry the same service after the Retry-After seconds. The in-process turn and the Mission lock share one 10 s budget. Provisional (backpressure).
- Protocol-only. The service is draining before it exits; re-read the endpoint file and retry against the service it names (the launcher starts one when none runs).
- WriteRefusalReason
- WriteRefusalReason
- WriteRefusalReason
- WriteRefusalReason
- WriteRefusalReason
- WriteRefusalReason
- WriteRefusalReason
- WriteRefusalReason
- WriteRefusalReason
- WriteRefusalReason
- WriteRefusalReason
- WriteRefusalReason
- WriteRefusalReason
- WriteRefusalReason
- WriteRefusalReason
- WriteRefusalReason
The from or to status lane is not one of the 11 persisted Lane values.
The edge is not in the lane state machine, or leaves a terminal lane without force.
A forced transition carries no actor or no reason.
The transition needs an actor identity (a claim, a review claim).
A dependency of the work package is not approved, done, or canceled with operator provenance.
Claimed to in_progress carries no workspace context. No wire request can produce this reason: every wire door supplies or synthesises a context. Core’s guard is a fail-closed invariant for its own batch API (transition_pipeline.py:322-337 at core main @ 366ff233; operator decision 2026-09-07, spec-kitty/spec-kitty#946, DRIFT-3), kept so the vocabulary mirrors core.
In_progress to for_review fails either half of the guard. Both halves are reachable: the subtask half comes from the roster, and the evidence half comes from implementationEvidencePresent: false.
The transition needs a reason (in_progress back to planned).
The transition needs a review_ref.
A move to approved or done carries no reviewer identity or approval reference.
The review result is incomplete, does not match its review_ref, or conflicts with a live review claim.
A forced exit from in_review or approved carries no note.
The done evidence lacks the reviewer, the verdict or the reference.
Another actor holds the claim (travels under WP_ALREADY_CLAIMED).
The work package cannot start: not finalized, in the wrong status lane, or force misused.
The unit’s from_lane is not the work package’s current lane. Provisional events-side addition with no core equivalent (spec-kitty/spec-kitty-events#161).