Skip to content

SC-14 — what the pre-deploy drain hook polls: local and fleet run COUNTS, the oldest local run's start, whether the drain is complete, and the maintenance / draining flags. Counts only — no workspace, project, task or title.

GET
/api/operator/v1/drain
curl --request GET \
--url https://example.com/api/operator/v1/drain

SC-14 — what the pre-deploy drain hook polls: local and fleet run COUNTS, the oldest local run’s start, whether the drain is complete, and the maintenance / draining flags. Counts only — no workspace, project, task or title.

OK

Media typeapplication/json

SC-14 — what a deploy hook polls. COUNTS ONLY: no workspace, project, task or title, so an operator token learns nothing about tenants from it.

object
active_fleet_runs
required

Open fleet assignments (assigned/claimed/running); they live on their runners and survive a hub restart, so they do not gate drain_complete.

integer format: int64
active_local_runs
required

Hub-local agent runs still in flight (their containers die with this process).

integer format: int64
drain_complete
required

active_local_runs == 0.

boolean
draining
required

This process is in its shutdown drain.

boolean
maintenance
required

The instance is in a maintenance window.

boolean
maintenance_origin
One of:

Who holds the maintenance window on, null while it is off. deploy_hook and shutdown_drain are cleared by the next boot; an operator window survives it.

string
Allowed values: deploy_hook shutdown_drain operator
oldest_started_at

The oldest started_at among the hub-local active runs.

string | null format: date-time

Example

{
"maintenance_origin": "deploy_hook"
}