internal

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).

patch/internal/runs/{run_id}/turn

Request

  • Base URL: https://api.nanocorp.so (the document declares no server; this is the origin it was published from)
  • URL: https://api.nanocorp.so/internal/runs/{run_id}/turn
  • Auth: HTTP bearer

Path parameters

run_idstring uuid required

Request body

status'completed' | 'failed' | 'interrupted' | 'waiting' nullable
error_messagestring nullable
sdk_session_idstring nullable
clear_sdk_session_idboolean
deferred_tool_useobject nullable

Response

Successful Response

interruptboolean

Changes

    • info

      added the new optional request property

    • info

      added the new waiting enum value to the request property /