Consolidate superseded plans into a plan
POST https://weights.fyi/run/v1/compute/plans/{plan_id}/consolidate
Authorization: Bearer <token> scope: submit
Content-Type: application/json- Available since
- 2026-11-08: included in this build; see What is live for deployment status.
- Answer time
- synchronous move and cancellation in one transaction; does not wait for running work to stop.
Moves the remaining work of your superseded plans into this plan and ends them. A workload submitted as one dated plan per day leaves a trail of plans, each holding its own pending or dead-lettered remainder. This call takes every pending, lazy and stashed pack of each superseded plan, and with retry_dead_lettered its dead-lettered packs too, and registers them on the matching stage of this plan as <superseded plan_id>.<pack_id>, in their original order. A live superseded plan is then cancelled as superseded; a completed or failed one keeps its state and records only that it was superseded.
The target stage is usually a continuous stream (workload.continuous: true): a sealed or completed continuous stage reopens to take the packs, and the plan returns to executing. A sealed stage that is not continuous refuses the call. Nothing moves from under a worker: a superseded plan still holding a live pack lease refuses the whole call, and nothing changes. Expired leases requeue first.
Request
| Name | Where | Required | Meaning |
|---|---|---|---|
Authorization | header | yes | Bearer token with submit. |
plan_id | path | yes | Identifier of the plan that takes the work. Its window must still be open. |
superseded_plan_ids | body | yes | Non-empty list of your plans in the same tenant, none of them this plan, none listed twice. |
stage_map | body | no | Object mapping a superseded plan's stage identifier to this plan's stage identifier. Omitted, stages match by identifier. |
retry_dead_lettered | body | no | Boolean. true moves dead-lettered packs as fresh pending packs, with their dead-letter history kept. |
reason | body | no | Non-empty string of at most 4,096 bytes, recorded on each cancellation. Omitted, it is superseded_by:<plan_id>. |
Send a JSON object of at most 1 MiB with these fields only.
Return value
200 OK with the current plan receipt, whose outcome and coverage now count the moved packs, and a consolidation object: moved_packs, reopened_stages, reason, replayed, and superseded, one entry per listed plan with plan_id, from_state, cancelled, moved_packs, moved_dead_lettered and its per-stage moves.
Repeating the call for plans this plan already superseded moves nothing, records nothing and answers replayed: true. A plan another plan superseded is refused.
Each superseded plan records plan_superseded with superseded_by, moved_packs and moved_pack_ids; this plan records plan_consolidated, and stream_reopened for each stage it reopened. Moved packs carry metadata.moved_from.
Errors
| Status | Code | Meaning |
|---|---|---|
400 | invalid_json, invalid_compute_plan | Invalid JSON, identifiers, fields, or a superseded stage with no matching stage here. |
401 | unauthorized, invalid_token, token_revoked, token_expired | Supply a valid token. |
403 | scope_required, account_suspended, compute_tenancy_unauthorized | Token lacks submit, the account is suspended, or the tenant grant is gone. |
404 | compute_plan_not_found | This plan or a listed plan is absent or belongs to another account. |
409 | compute_plan_conflict | A live lease, a plan already superseded or cancelled, another tenant, a failed or cancelled target, or a sealed stage that is not continuous. |
409 | compute_schedule_window_closed | This plan's window has closed; consolidate into a plan whose window is open. |
413 | body_too_large | Body exceeds 1 MiB. |
429 | rate_limited | Wait for Retry-After before retrying. |
Examples
curl -s https://weights.fyi/run/v1/compute/plans/PLAN_ID/consolidate \
-H "Authorization: Bearer $WEIGHTS_API_KEY" -H "Content-Type: application/json" \
-d '{"superseded_plan_ids":["embeddings-20261104","embeddings-20261106"],"retry_dead_lettered":true,"reason":"one stream per workload"}'Selected response fields:
{"plan_id":"embeddings","state":"executing","continuous":true,"stages":[{"stage_id":"embed","state":"ready_to_wake","stream_sealed":false,"continuous":true,"packs_total":46,"packs_completed":40,"packs_pending":6}],"consolidation":{"moved_packs":6,"reopened_stages":["embed"],"replayed":false,"superseded":[{"plan_id":"embeddings-20261104","from_state":"ready_to_wake","cancelled":true,"moved_packs":4,"moved_dead_lettered":0},{"plan_id":"embeddings-20261106","from_state":"failed","cancelled":false,"moved_packs":2,"moved_dead_lettered":1}]}}History
- 2026-11-08: documented consolidation of superseded plans into a continuous plan.