Schema
CycleResponse
Cycle response model.
| Field | Type | Description |
|---|---|---|
idrequired | string (uuid) | Cycle UUID |
permakey | string | null | Stable human-readable cycle key for the deep-link URL /workstreams/{ws}/cycles/{permakey}/instance/{task}. Null on legacy rows. |
workstream_id | string (uuid) | null | Parent workstream UUID. Populated for every cycle launched against a workstream definition; only null for legacy agentic/v2 cycles that have no workstream parent. |
workstream_permakey | string | null | Parent workstream's stable human-readable key (workstreams.workstream.permakey), resolved by joining on the same COALESCE(cycle.workstream_id, blueprint.workstream_id) that backs workstream_id. Lets the list/detail surfaces build the permakey-prefixed deep link /workstreams/{workstream_permakey}/cycles/{permakey} without a second fetch. Null when no workstream parent resolves (legacy agentic/v2 cycles, or a workstream that no longer exists). |
workstream_slug | string | null | Parent workstream's URL slug (workstreams.workstream.slug), resolved via the same join as workstream_permakey. Null when no workstream parent resolves. |
workstream_version | integer | null | The WorkStream version this cycle ran — the integer version it resolved, written in the INSERT that created it (the pinned version on a pinned WorkPlan, a blueprint's own version, else the head). The database refuses to change it afterwards. Null on cycles that recorded none (every cycle created before this was recorded); never the WorkStream's current version. |
current_workstream_version | integer | null | The version the WorkStream is at now (workstreams.workstream.version). Compare with workstream_version to see whether the WorkStream has moved on since this cycle ran. Null when the cycle has no WorkStream parent. |
accounting_ledger | "off" | "optional" | "required" | null | The Accounting Ledger mode this cycle was launched with — stamped into blueprint_snapshot.settings.accounting_ledger at launch (resolve_accounting_ledger_mode) and read back here verbatim. Immutable after launch, same pattern as workstream_version: a WorkStream edited after this cycle launched does not retroactively add or remove its Ledger tab. Resolves to 'off'/'optional'/'required' for every well-formed snapshot — 'off' for any legacy cycle whose snapshot predates this setting. Also null (read as not declared, same as 'off' for gating purposes) when the stored value fails resolve_accounting_ledger_mode's validation — a read site never errors the whole list/detail response over one malformed cycle — or when a caller never ran this resolution at all (e.g. a hand-built response in a test). |
cycle_launch_id | string (uuid) | null | The cycle_launch (the product's Cycle - one launch of a plan) this instance (per-client cycle row) belongs to. Card 'Cycle URLs open cycles, WorkPlan URLs open WorkPlans': an instance nests under its cycle (/workstreams/{ws}/cycles/{cycle}/instances/{instance}), and the cycle segment is the cycle_launch's permakey. Null on legacy rows that predate the backfill (20260902_0100). |
cycle_launch_permakey | string | null | The cycle_launch's stable permakey - the canonical cycle URL segment the instance nests under. Lets the instance page build its breadcrumb cycle crumb (/workstreams/{ws}/cycles/{cycle}) without a second fetch. Null when the instance has no parent launch (a pre-backfill orphan). |
definition_hash | string | null | The fingerprint of the WorkStream version this cycle ran (`wsdef-v1:<sha>` or `steps-v0:<sha>`), written with workstream_version and never changed afterwards. Null when that version holds no fingerprint or the cycle recorded none. Distinct from code_sha (the launching-code git SHA used by the deploy-race guard). |
source_commit | string | null | The head commit (40 lower-case hex characters) of the WorkStream's working branch when this cycle was launched, written with the cycle and never changed afterwards. Null for a WorkStream that is not git-managed and for a cycle launched before this was recorded. |
workplan_id | string (uuid) | null | Workplan UUID (null for agentic cycles) |
workplan_name | string | null | Workplan name (from join) |
client_id | string (uuid) | null | Client UUID (from workplan join) |
client_name | string | null | Client name (from workplan join) |
statusrequired | "created" | "planning" | "queued" | "running" | "paused" | "blocked" | "completed" | "failed" | "cancelled" | "skipped" | "pending" | "needs_guidance" | "abandoned" | "debug_paused" | Status for execution cycles - matches DB check constraint.createdplanningqueuedrunningpausedblockedcompletedfailedcancelledskippedpendingneeds_guidanceabandoneddebug_paused |
progress_pct | number | `completed_steps / total_steps * 100` — work that RAN AND FINISHED, over the whole ladder. Skipped steps are excluded from the numerator and stay in the denominator, so a run that stopped early can never reach 100%. It is a record of how far the run got, not a live fraction: pair it with `status` and `current_step_index` before rendering, and never read it alone as 'nearly done'. |
blueprint_snapshot | object | Workplan snapshot at cycle startshow nestedEmpty object. |
error_context | object | null | Error context if failed |
started_at | string (date-time) | null | Start timestamp |
completed_at | string (date-time) | null | Completion timestamp |
started_by | string (uuid) | null | Initiator user ID (started_by in DB) |
created_atrequired | string (date-time) | Creation timestamp |
updated_atrequired | string (date-time) | Last update timestamp |
current_step_name | string | null | Name of the ONE current step every FE view should render verbatim (banner, Steps tab, Approvals tab, batch matrix). Resolved by _compute_run_progress: the earliest in-flight/awaiting step, else (when the cycle has failed) the last failed step. Never the literal 'Unknown' — an unnamed step falls back to a humanized blueprint step id or 'Step N'. Null only when no step can be resolved at all (e.g. a cycle with zero tasks). |
current_step_index | integer | null | 1-based position of current_step_name within the cycle's steps. Null exactly when current_step_name is null — the two are always resolved together so a view never pairs a real index with a missing name (or vice versa) — see pilot run-through defect B1 ('Step 0: Unknown'). |
failure_reason | string | null | Human-readable reason the run is errored/blocked, populated whenever status is failed/cancelled/blocked — even when no current step could be resolved (e.g. 'The run stopped before any step could be identified.'). FE should show this INSTEAD OF a step placeholder, never alongside a fabricated 'Step ?'. Written for an accountant: no step ids, no raw floats where money is meant, no internal certification vocabulary. The engine's or the approver's own words are on failure_details. |
failure_details | string | null | The engine's or the approver's own words, verbatim and unshortened, behind the surface's Details affordance. NEVER rendered inline — failure_reason is the sentence a person reads. Null when the reason IS already the whole of what was recorded. |
retryable | boolean | Whether a Retry action applies to this run (status is failed/cancelled). |
needs_approval | boolean | True when this run is parked on a human sign-off nobody has given yet: a task with approved_at NULL that is awaiting_approval (by status or by outputs.status), on a cycle that is not already over. Same predicate as the swarm/jobs read, so a run cannot report differently depending on which endpoint served it. The FE pairs it with `status` to choose the amber 'Needs you' pill over the grey 'Blocked' one — a blocked cycle with no open gate is genuinely just blocked. |
held_reason | string | null | Why this run is WAITING, composed for an accountant from the cycle's OWN measured outputs — several short lines: what is happening, whose work it is, the amount as money, where it is written down, and what un-blocks it. Populated from the HOLD STATE (an approval gate with approved_at NULL, parked at awaiting_approval, on a cycle that is not over) — never by parsing a rejection string, which a held run does not have. A hold is NOT a failure: it never populates `failure_reason` and never writes cycle.error_context. |
held_details | string | null | The reviewer's own words for the hold (workstreams.task.outputs.hold_metadata.question on the parked gate), verbatim and unshortened, for a Details affordance. Never rendered inline and never mined for facts — every figure in `held_reason` comes from a step's own recorded output. |
completed_steps | integer | Steps that RAN AND FINISHED (completed/approved/done). Skipped steps are NOT counted here — they never ran. Card #263: until this field was corrected, a run halted at step 7 of 18 with the remaining steps skipped reported 16 of 18 and rendered a nearly-full bar. Read together with `skipped_steps` and `current_step_index`, which say how far the run actually got and where it stopped. |
skipped_steps | integer | Steps that NEVER RAN — the run stopped upstream, or a condition excluded them. Not progress and not failure: reported in its own right so a refusal reads as a refusal. `completed_steps + skipped_steps` is NOT a progress figure and must never be rendered as one; the pair exists precisely so the two are not added together again. |
total_steps | integer | Total number of steps in cycle |
customer_cost_gbp | number | null | Customer-facing cost in GBP: £19/hr x elapsed time since cycle start. NULL when the cycle has not yet started. Uses completed_at if available, otherwise current wall-clock time. The real compute cost is never served (CR-COST-01). |
tokens_total_input | integer | null | Total input tokens across all steps. NULL when none recorded. |
tokens_total_output | integer | null | Total output tokens across all steps. NULL when none recorded. |
artifacts | CycleArtifactSummary[] | Artifacts produced by this cycle (workstreams.cycle_artifact, non-deleted), newest first, each with a download_url. Surfaced at CYCLE level — step→artifact attribution is a follow-up. Empty when the cycle produced no artifacts.item shape |
workbook | CycleWorkbookRef | The workbook a run produced, with its review state (card 011).
The API does the fallback, not the frontend: the cycle GET payload carries
this field so the Workbook tab renders from it directly — a frontend-only
guess at step outputs is rejected. ``document_id`` is the file_uploads id of
the workbook the latest fill/compile step wrote (``task.outputs.document_id``,
which the workbook operations return today); ``state`` is
``reviewed`` when a run-level sign-off record exists, ``not_yet_reviewed``
when that document_id exists but no sign-off does, and ``none`` otherwise.show nested |
input_data | object | Launch inputs the cycle was started with (period, file refs, run_mode, etc.), read from workstreams.cycle.runtime_vars — the canonical input dict written verbatim on both the inline and containerized launch paths. Empty when the cycle has no recorded launch inputs. Within-workspace only (the endpoint is FGA- + workspace-scoped); redact file names / conversation_id before surfacing this on any cross-org surface.show nestedEmpty object. |