Skip to content

`POST /api/workspaces/{id}/backlog/dispatch` (ADR 0045 Stage 1). The body's `dry_run` defaults to `true` (a bodiless POST is a safe preview).

POST
/api/workspaces/{id}/backlog/dispatch
curl --request POST \
--url https://example.com/api/workspaces/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/backlog/dispatch \
--header 'Content-Type: application/json' \
--cookie supacloud_session=<supacloud_session> \
--data '{ "autonomy_level": 1, "dry_run": true }'
  • dry_run = true — RBAC CreateRun (consistent with the launch path; a preview is a dispatch-shaped action). Returns a [DispatchDryRunReport] WITHOUT launching anything.
  • dry_run = false — RBAC CreateRun. Calls dispatch_workspace_backlog (every gate enforced there) and returns {launched}. Writes an audit_events row (workspace / backlog_dispatch_manual).

A missing/empty body deserializes to the Default (dry_run = true), so a bodiless POST is the preview.

id
required
string format: uuid

Workspace ID to preview or dispatch

Media typeapplication/json

The dispatch body. dry_run defaults to true (a bodiless POST is a safe preview); autonomy_level is an OPTIONAL hypothetical for the dry-run preview (clamped to the resolved ceiling in the service) and is ignored on a real launch.

object
autonomy_level
integer | null format: int32
dry_run
boolean

Example generated

{
"autonomy_level": 1,
"dry_run": true
}

Dry-run preview (DispatchDryRunReport) or the launched count ({launched})

Media typeapplication/json

The dispatch response: a dry-run preview OR the launched count. A dry_run preview returns the [DispatchDryRunReport]; a real launch returns {launched}. The two are distinct shapes so the FE can render a preview banner vs a success toast without guessing.

One of:

ADR 0045 Stage 1 — the manual-dispatch DRY-RUN preview (no writes). Reports the resolved gate state the FE renders BEFORE a real dispatch: how many queued items would launch (an UPPER BOUND — per-project caps/budgets are not simulated), why dispatch is blocked (if it is), and the resolved gates.

autonomy_level_max is the resolved CEILING verbatim — on a dev / enterprise / legacy-grant-all instance it is AUTONOMY_LEVEL_CEILING (100); only a genuine free entitlement resolves it to 0. The preview reports it as-is and never special-cases 0 (Risk-Resolution: dry-run reports the resolved value verbatim).

workspace_ceiling_free is the workspace’s remaining free dispatch slots under max_backlog_concurrent (ceiling − in-flight); None = uncapped.

blocked_reason is the English text of the first every-scope blocker (kept for API compatibility; blockers is the localizable, complete list). would_dispatch == blocked_reason.is_none() holds: both describe the MANUAL dispatch, while would_auto_dispatch describes the unattended tick (AUD-UX-011).

ADR 0045 Stage 2a (GATE 5 — quota): the quota_* fields explain the provider-quota gate the live dispatcher applies after the autonomy gate — which credential REGIME the workspace’s autodev launches under, how much window headroom remains, whether a near-cap effort downshift would apply, and which providers are near exhaustion. All are Option/default so a pre-Stage-2 workspace (no quota snapshots) reports them as absent and the FE .passthrough() schema tolerates it.

object
autonomy_level_max
required
integer format: int64
blocked_reason
string | null
blockers
required

AUD-UX-011 — EVERY blocking gate, in the live dispatcher’s order (not only the first). Empty ⇔ the scheduler tick would launch now.

Array<object>

AUD-UX-011 — one blocking dispatch gate with its params. Only the params of the blocker’s own code are set; the rest are None / empty.

object
code
required

AUD-UX-011 — a stable, localizable dispatch-blocker code (the FE maps each to backlog_blocker_<code>). Declared in the live dispatcher’s gate order.

string
Allowed values: workspace_not_found kill_switch maintenance_window workspace_ceiling instance_in_flight_cap hourly_dispatch_cap onboarding_mode quiet_hours autonomy_entitlement_zero autonomy_below_dispatch quota_near_exhaustion project_budget queue_empty
level

autonomy_below_dispatch: the highest effective level any backlog-enabled project resolves to.

integer | null format: int64
project_id

project_budget: the project whose project-total AI budget is spent (one blocker per such project, AUD-INT-025).

string | null format: uuid
providers
required

quota_near_exhaustion: the providers at/over their fill target.

Array<string>
required_level

autonomy_below_dispatch: the lowest level at which the tick dispatches.

integer | null format: int64
scope
required

AUD-UX-011 — which launch origins a dispatch blocker binds (ADR 0061 §2). every: the manual “Dispatch now” is blocked too (launch-safety + the dispatcher’s own ceiling/onboarding/quota/budget gates, or nothing queued). automatic: only the unattended scheduler tick is blocked (maintenance window, quiet hours, the autonomy slider, the autonomous quota fill target); a manual dispatch still launches.

string
Allowed values: every automatic
until

quiet_hours: when the window ends, HH:MM UTC.

string | null
dispatched_recent

Backlog runs dispatched in the recent throughput window for THIS workspace — the owner-visible launch rate (the per-workspace counterpart to the operator console’s cross-tenant throughput gauge).

integer format: int64
downshifted_effort

The effort ceiling a near-cap window would impose on the next dispatch ('minimal' | 'low'); None when no downshift applies (healthy window).

string | null
fill_target

The operator’s target window saturation in [0.0, 1.0] (e.g. 0.85) the gate reserves against; None → the surface falls back to the Balanced default.

number | null format: double
global_dispatch_enabled
required
boolean
in_flight

In-flight backlog runs across the whole workspace right now (the workspace-ceiling denominator: backlog_item_id IS NOT NULL runs in an active status). The same figure the live dispatcher reads, so the panel’s “In flight” matches what occupies the concurrency slots.

integer format: int64
in_quiet_hours

The workspace is inside its configured daily quiet-hours window (workspace_settings.backlog_quiet_hours_*, UTC) during which UNATTENDED dispatch is suppressed (scan/classify keep running). true always surfaces as an automatic-scope quiet_hours blocker (AUD-UX-011); a manual dispatch still launches (ADR 0061 §2). false when no window is configured or the current time is outside it.

boolean
onboarding_mode
required
boolean
orphaned_in_progress

AUD-INT-047 / SCG-130 — this workspace’s backlog items stuck in_progress on a run that already ended (completed|failed|skipped) for longer than the stale window: the workspace slice of the supacloud_backlog_orphaned_in_progress gauge. Non-zero means the recovery lane has not repaired them yet.

integer format: int64
per_project

Per-project dispatch snapshot: cap / in-flight / queued / blocked-reason for each backlog-enabled project of the workspace, so the owner sees WHICH project is at its cap and WHY a queue is not draining. Built from the same level-aware effective_cap_at_level + in-flight + queued reads the dispatcher uses.

Array<object>

#532 A1 — one project’s slice of the owner dispatch observability panel: the effective fan-out cap, the current in_flight backlog-run count, the queued items waiting, and a blocked_reason when the project cannot dispatch this tick (cap reached, or a 0 cap = paused). cap/in_flight reuse the EXACT reads the live dispatcher uses (dispatch::effective_cap_at_level + count_in_progress_backlog_runs), so the panel never disagrees with the launcher. title is the project name (projects.name).

object
blocked_reason

A human reason this project cannot dispatch right now, or None when it has free slots and queued work. Distinct from the workspace-level blocked_reason — this is per-project (cap reached / paused at a 0 cap).

string | null
cap
required
integer format: int64
in_flight
required

AUD-INT-011 — the ACTIVE backlog runs (they consume cap). A run parked on a human gate is counted in waiting instead.

integer format: int64
last_dispatched_at

AUD-UX-034 — when the project’s newest backlog run was launched, so a picker can show the last dispatch. Omitted when the project never dispatched one.

string | null format: date-time
max_waiting
required

AUD-INT-011 — the effective waiting cap (backlog_max_waiting ?? 2 x cap); dispatch launches nothing while waiting >= max_waiting.

integer format: int64
project_id
required
string format: uuid
queued
required
integer format: int64
title
required
string
waiting
required

AUD-INT-011 — the backlog runs parked on a human gate (a waiting run, a waiting human node or a pending tool approval in its tree).

integer format: int64
providers_near_exhaustion

Providers whose chosen credential is at/over its fill target (near exhaustion) — surfaced so the usage panel can name them. Empty when none.

Array<string>
queued_items
required
integer format: int64
quota_blocked

The quota gate WOULD block the next dispatch (the window is past its fill target). Distinct from would_dispatch (which folds in every gate) so the FE can show a quota-specific “throttled” chip even when another gate is the reported blocked_reason.

boolean
quota_headroom

The minimum window headroom across the gated windows in [0.0, 1.0] — the figure the quota gate compares against the fill-target reserve. None when no regime gate applies (system / no credential).

number | null format: double
recent_routing_decisions

ADR 0045 D1 — the most-recent routing decisions for this workspace, each carrying its decision_factors JSON (why dispatched / which model chosen / why escalated). The SAME explainability the operator /routing decision-log exposes, surfaced inline in the dry-run so a user previewing a dispatch sees why the queued items routed as they did. Empty for a pre-Stage-2b workspace (no decisions logged yet).

Array<object>

ADR 0045 D1 — one routing decision surfaced in the dry-run. A trimmed, FE-stable projection of the backlog_routing_decisions log row (mig 212): the item it routed, the source path (classify|escalate|fallback|manual) and the verbatim decision_factors JSON. Mirrors the operator /routing entry so the two explainability surfaces agree on field names.

object
created_at
required
string format: date-time
decision_factors
required
object
key
additional properties
item_id
required
string format: uuid
item_title
string | null
routing_source
required
string
regime

The resolved credential regime the workspace’s autodev launches under ('subscription' | 'api_key' | 'system'); None when no project/credential resolves (an empty workspace).

string | null
rolling_5h_fill

Rolling-5h window fill fraction [0.0, 1.0] for the chosen subscription credential; None for an API-key/system regime or an unmetered credential.

number | null format: double
seconds_since_tick

Seconds since the last backlog dispatch sweep (the BACKLOG_SCAN_TICK_SECONDS cadence, distinct from the faster due-schedules loop). None before the first sweep of a just-booted process — the FE renders that as “not yet”. Lets the owner see the dispatch engine is alive and how stale the last sweep is.

integer | null format: int64
tick_interval_seconds

The scheduler tick interval in seconds (services::backlog::BACKLOG_SCAN_TICK_SECONDS) — the cadence at which dispatch is re-evaluated. Surfaced so the FE renders the real interval instead of hardcoding it (NO magic numbers on the FE).

integer format: int64
unavailable_profiles

AUD-WIR-053 — every ENABLED fixed-model profile whose provider credentials are all exhausted right now: the live dispatcher parks an item pinned to one of them (last_error = profile_model_unavailable:*) instead of launching into the usage wall. Empty when no fixed profile is blocked.

Array<object>

AUD-WIR-053 — an enabled agent profile whose FIXED model cannot run now: every credential of its harness’s provider has a quota window at its limit. resets_at is the earliest known moment one of them frees up (“assigned model unavailable until <resets_at>”); None when no exhausted window names its reset.

object
fixed_model
string | null
harness
required

The profile’s harness (default_agent_type), whose provider was judged.

string
name
required
string
profile_id
required
string format: uuid
provider
required
string
resets_at
string | null format: date-time
slug
required
string
waiting_for

SC-25 — queued items the dispatcher held back at its last evaluation because an in-flight item’s paths overlap theirs on a serialize glob (“waiting for #N”).

Array<object>

SC-25 — one queued item the dispatcher holds back for a path overlap, as the dry-run reports it (the dispatcher’s LAST evaluation; evaluated_at shows its age).

object
blocked_by_external_id
required
string
blocked_by_item_id
required
string format: uuid
evaluated_at
string | null format: date-time
item_external_id
required
string
item_id
required
string format: uuid
item_title
string | null
overlap_glob
required
string
summary
required

“waiting for #N (overlap: )”.

string
weekly_fill

Weekly window fill fraction [0.0, 1.0] for the chosen subscription credential; None for an API-key/system regime or an unmetered credential.

number | null format: double
workspace_ceiling_free
integer | null format: int64
would_auto_dispatch
required

AUD-UX-011 — true iff blockers is empty: the UNATTENDED tick would launch. would_dispatch is the ATTENDED (manual) counterpart: no every-scope blocker.

boolean
would_dispatch
required
boolean

Example

{
"blockers": [
{
"code": "workspace_not_found",
"scope": "every"
}
]
}

Structured client error

Media typeapplication/json

The canonical JSON body of every error response. Every AppError serializes as this exact shape; code is the generated stable machine-readable vocabulary.

object
cap
One of:

Present only on an MCP budget refusal (429) — the refusing layer + retry hint.

object
layer
required

The refusing layer.

string
limit
required

The layer’s budget.

integer format: int64
retry_after_seconds

Seconds until a retry can pass, or null when it never will for this session.

integer | null format: int64
used
required

Calls already counted in the layer.

integer format: int64
code
required

Machine-readable, stable error code.

string
Allowed values: not_found unauthorized forbidden license_required license_expired fresh_auth_required source_not_released bad_request unprocessable precondition_failed conflict artifact_staging_busy artifact_staging_store_unavailable intervention_attachment_limit method_not_allowed rate_limited too_many_requests quota_exceeded mcp_cap_exceeded form_schema_invalid autosave_not_offered submit_not_offered idempotency_key_reused response_cap_reached required_missing database_error docker_error vault_error internal_error artifact_frames_unavailable identity_native_custody_unconfigured launch_concurrency_limit launch_already_active launch_not_pending launch_budget_exhausted launch_draining launch_side_effects_disabled launch_dispatch_disabled no_eligible_runner launch_image_unavailable pull_request_no_git_branch pull_request_no_project project_credential_missing project_credential_expired project_credential_revoked project_credential_substitution project_parent_credential_not_current project_lineage_invalid project_binding_missing project_binding_mismatch project_not_found project_capability_not_granted project_capability_unknown project_capabilities_required project_history_is_not_authority project_task_not_found project_task_project_missing project_task_not_active project_native_origin_missing project_broader_scope_required project_system_scope_required project_lifetime_invalid project_lifetime_not_finite project_lifetime_exceeds_maximum project_delegation_exceeds_parent project_renewal_not_allowed project_delegation_widened project_audience_mismatch project_deployment_claim_missing project_authority_disabled project_issuer_not_current project_operation_not_durable project_dispatch_gate_refused
details
One of:

Present only on a quota-exceeded 403 — the inline upgrade-CTA payload.

object
key
required

The entitlement feature key that was hit, e.g. apps.max_count.

string
limit
required

The plan’s limit for this key.

integer format: int64
upgrade_url
required

Where to send the user to upgrade.

string
used
required

Current usage (count or bytes, per the key).

integer format: int64
error
required

Human-readable message (the server’s English text; the client may localize by code).

string
launch
One of:

Present on a launch refusal (400/403/409) — the structured facts only the refusing class can fill: occupancy, exhausted budget, or required labels.

object
active

Weighted workspace slots already held by starting/running agent runs.

integer | null format: int64
cap_usd

The budget cap that refused.

number | null format: double
effective_spend_usd

Effective spend of the refusing budget scope (spend + in-flight reservations).

number | null format: double
max

The workspace’s configured agent-concurrency cap.

integer | null format: int64
provider

The provider whose budget cap refused; absent for the workspace-wide cap.

string | null
required_labels

Runner labels a fail-policy placement required and no runner offered.

Array<string>

Example

{
"code": "not_found"
}

Authentication required

Media typeapplication/json

The canonical JSON body of every error response. Every AppError serializes as this exact shape; code is the generated stable machine-readable vocabulary.

object
cap
One of:

Present only on an MCP budget refusal (429) — the refusing layer + retry hint.

object
layer
required

The refusing layer.

string
limit
required

The layer’s budget.

integer format: int64
retry_after_seconds

Seconds until a retry can pass, or null when it never will for this session.

integer | null format: int64
used
required

Calls already counted in the layer.

integer format: int64
code
required

Machine-readable, stable error code.

string
Allowed values: not_found unauthorized forbidden license_required license_expired fresh_auth_required source_not_released bad_request unprocessable precondition_failed conflict artifact_staging_busy artifact_staging_store_unavailable intervention_attachment_limit method_not_allowed rate_limited too_many_requests quota_exceeded mcp_cap_exceeded form_schema_invalid autosave_not_offered submit_not_offered idempotency_key_reused response_cap_reached required_missing database_error docker_error vault_error internal_error artifact_frames_unavailable identity_native_custody_unconfigured launch_concurrency_limit launch_already_active launch_not_pending launch_budget_exhausted launch_draining launch_side_effects_disabled launch_dispatch_disabled no_eligible_runner launch_image_unavailable pull_request_no_git_branch pull_request_no_project project_credential_missing project_credential_expired project_credential_revoked project_credential_substitution project_parent_credential_not_current project_lineage_invalid project_binding_missing project_binding_mismatch project_not_found project_capability_not_granted project_capability_unknown project_capabilities_required project_history_is_not_authority project_task_not_found project_task_project_missing project_task_not_active project_native_origin_missing project_broader_scope_required project_system_scope_required project_lifetime_invalid project_lifetime_not_finite project_lifetime_exceeds_maximum project_delegation_exceeds_parent project_renewal_not_allowed project_delegation_widened project_audience_mismatch project_deployment_claim_missing project_authority_disabled project_issuer_not_current project_operation_not_durable project_dispatch_gate_refused
details
One of:

Present only on a quota-exceeded 403 — the inline upgrade-CTA payload.

object
key
required

The entitlement feature key that was hit, e.g. apps.max_count.

string
limit
required

The plan’s limit for this key.

integer format: int64
upgrade_url
required

Where to send the user to upgrade.

string
used
required

Current usage (count or bytes, per the key).

integer format: int64
error
required

Human-readable message (the server’s English text; the client may localize by code).

string
launch
One of:

Present on a launch refusal (400/403/409) — the structured facts only the refusing class can fill: occupancy, exhausted budget, or required labels.

object
active

Weighted workspace slots already held by starting/running agent runs.

integer | null format: int64
cap_usd

The budget cap that refused.

number | null format: double
effective_spend_usd

Effective spend of the refusing budget scope (spend + in-flight reservations).

number | null format: double
max

The workspace’s configured agent-concurrency cap.

integer | null format: int64
provider

The provider whose budget cap refused; absent for the workspace-wide cap.

string | null
required_labels

Runner labels a fail-policy placement required and no runner offered.

Array<string>

Example

{
"code": "not_found"
}

Permission denied

Media typeapplication/json

The canonical JSON body of every error response. Every AppError serializes as this exact shape; code is the generated stable machine-readable vocabulary.

object
cap
One of:

Present only on an MCP budget refusal (429) — the refusing layer + retry hint.

object
layer
required

The refusing layer.

string
limit
required

The layer’s budget.

integer format: int64
retry_after_seconds

Seconds until a retry can pass, or null when it never will for this session.

integer | null format: int64
used
required

Calls already counted in the layer.

integer format: int64
code
required

Machine-readable, stable error code.

string
Allowed values: not_found unauthorized forbidden license_required license_expired fresh_auth_required source_not_released bad_request unprocessable precondition_failed conflict artifact_staging_busy artifact_staging_store_unavailable intervention_attachment_limit method_not_allowed rate_limited too_many_requests quota_exceeded mcp_cap_exceeded form_schema_invalid autosave_not_offered submit_not_offered idempotency_key_reused response_cap_reached required_missing database_error docker_error vault_error internal_error artifact_frames_unavailable identity_native_custody_unconfigured launch_concurrency_limit launch_already_active launch_not_pending launch_budget_exhausted launch_draining launch_side_effects_disabled launch_dispatch_disabled no_eligible_runner launch_image_unavailable pull_request_no_git_branch pull_request_no_project project_credential_missing project_credential_expired project_credential_revoked project_credential_substitution project_parent_credential_not_current project_lineage_invalid project_binding_missing project_binding_mismatch project_not_found project_capability_not_granted project_capability_unknown project_capabilities_required project_history_is_not_authority project_task_not_found project_task_project_missing project_task_not_active project_native_origin_missing project_broader_scope_required project_system_scope_required project_lifetime_invalid project_lifetime_not_finite project_lifetime_exceeds_maximum project_delegation_exceeds_parent project_renewal_not_allowed project_delegation_widened project_audience_mismatch project_deployment_claim_missing project_authority_disabled project_issuer_not_current project_operation_not_durable project_dispatch_gate_refused
details
One of:

Present only on a quota-exceeded 403 — the inline upgrade-CTA payload.

object
key
required

The entitlement feature key that was hit, e.g. apps.max_count.

string
limit
required

The plan’s limit for this key.

integer format: int64
upgrade_url
required

Where to send the user to upgrade.

string
used
required

Current usage (count or bytes, per the key).

integer format: int64
error
required

Human-readable message (the server’s English text; the client may localize by code).

string
launch
One of:

Present on a launch refusal (400/403/409) — the structured facts only the refusing class can fill: occupancy, exhausted budget, or required labels.

object
active

Weighted workspace slots already held by starting/running agent runs.

integer | null format: int64
cap_usd

The budget cap that refused.

number | null format: double
effective_spend_usd

Effective spend of the refusing budget scope (spend + in-flight reservations).

number | null format: double
max

The workspace’s configured agent-concurrency cap.

integer | null format: int64
provider

The provider whose budget cap refused; absent for the workspace-wide cap.

string | null
required_labels

Runner labels a fail-policy placement required and no runner offered.

Array<string>

Example

{
"code": "not_found"
}

Structured server error

Media typeapplication/json

The canonical JSON body of every error response. Every AppError serializes as this exact shape; code is the generated stable machine-readable vocabulary.

object
cap
One of:

Present only on an MCP budget refusal (429) — the refusing layer + retry hint.

object
layer
required

The refusing layer.

string
limit
required

The layer’s budget.

integer format: int64
retry_after_seconds

Seconds until a retry can pass, or null when it never will for this session.

integer | null format: int64
used
required

Calls already counted in the layer.

integer format: int64
code
required

Machine-readable, stable error code.

string
Allowed values: not_found unauthorized forbidden license_required license_expired fresh_auth_required source_not_released bad_request unprocessable precondition_failed conflict artifact_staging_busy artifact_staging_store_unavailable intervention_attachment_limit method_not_allowed rate_limited too_many_requests quota_exceeded mcp_cap_exceeded form_schema_invalid autosave_not_offered submit_not_offered idempotency_key_reused response_cap_reached required_missing database_error docker_error vault_error internal_error artifact_frames_unavailable identity_native_custody_unconfigured launch_concurrency_limit launch_already_active launch_not_pending launch_budget_exhausted launch_draining launch_side_effects_disabled launch_dispatch_disabled no_eligible_runner launch_image_unavailable pull_request_no_git_branch pull_request_no_project project_credential_missing project_credential_expired project_credential_revoked project_credential_substitution project_parent_credential_not_current project_lineage_invalid project_binding_missing project_binding_mismatch project_not_found project_capability_not_granted project_capability_unknown project_capabilities_required project_history_is_not_authority project_task_not_found project_task_project_missing project_task_not_active project_native_origin_missing project_broader_scope_required project_system_scope_required project_lifetime_invalid project_lifetime_not_finite project_lifetime_exceeds_maximum project_delegation_exceeds_parent project_renewal_not_allowed project_delegation_widened project_audience_mismatch project_deployment_claim_missing project_authority_disabled project_issuer_not_current project_operation_not_durable project_dispatch_gate_refused
details
One of:

Present only on a quota-exceeded 403 — the inline upgrade-CTA payload.

object
key
required

The entitlement feature key that was hit, e.g. apps.max_count.

string
limit
required

The plan’s limit for this key.

integer format: int64
upgrade_url
required

Where to send the user to upgrade.

string
used
required

Current usage (count or bytes, per the key).

integer format: int64
error
required

Human-readable message (the server’s English text; the client may localize by code).

string
launch
One of:

Present on a launch refusal (400/403/409) — the structured facts only the refusing class can fill: occupancy, exhausted budget, or required labels.

object
active

Weighted workspace slots already held by starting/running agent runs.

integer | null format: int64
cap_usd

The budget cap that refused.

number | null format: double
effective_spend_usd

Effective spend of the refusing budget scope (spend + in-flight reservations).

number | null format: double
max

The workspace’s configured agent-concurrency cap.

integer | null format: int64
provider

The provider whose budget cap refused; absent for the workspace-wide cap.

string | null
required_labels

Runner labels a fail-policy placement required and no runner offered.

Array<string>

Example

{
"code": "not_found"
}