Patch Turn
Turn-status PATCH: the entrypoint reports how the turn ended, and (turn 1) the captured sdk_session_id. Terminal statuses release the session lock by construction (the partial unique index only covers pending/running).
Race shape (final review, three iterations): a finalize request carries its resume-key mutation INSIDE the transition statement (one atomic CTE) — the mutation applies iff that request wins the active→terminal transition, and both commit together, so there is no window between the key landing/withdrawing and the lock releasing, and a swept zombie's finalize applies nothing. Bare mutations (the init-time background PATCH) are terminal-fenced with a fresh status read, and their set is additionally guarded on the run still being active inside the UPDATE — a stalled bare set racing the atomic finalize either lands before it (an owning clear overwrites it; an owning set finds the slot taken — first-writer-wins, same key) or after it (guard fails, no-op).
Path parameters
Request body
Response
Successful Response
Changes
No recorded changes to this endpoint across all 1 revision of this API.