---
title: "Plan file"
description: "The JSON plan a manager mounts for a leader — every field the leader reads, what each one changes, how the file is watched, and how the leader heals declared gangs."
url: "https://opod.io/docs/core-reference/plan-file/"
markdown_url: "https://opod.io/docs/core-reference/plan-file.md"
section: "Core reference"
last_updated: "2026-10-30"
---

# Plan file

> The JSON plan a manager mounts for a leader — every field the leader reads, what each one changes, how the file is watched, and how the leader heals declared gangs.

## In short

The plan file is a JSON document a manager writes to say what one endpoint is: its one model, its revision, adapters, request size and gangs. A leader that finds it at start serves that model only and re-reads the file every 10 seconds. Without it, the leader is unrestricted.

```json
{ "revision": 7, "model": { "id": "qwen2.5-7b-instruct" } }
```

The plan says what one endpoint is: its one model, how it scales, the adapters it serves, the request size it is sized for, and its gangs. A manager writes it; the leader reads it and serves within it.

| Setting        | Value                                                                                                                                                                  |
| -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Path           | `OPOD_PLAN_FILE`, default `/etc/opod/plan.json`                                                                                                                        |
| Watched        | only when the file **exists when the leader starts**. Without it the leader is standalone and unrestricted, and a file created later is not picked up until a restart. |
| Re-read        | every 10 seconds, when the file's modification time is newer than the last good read. No restart.                                                                      |
| Bad JSON       | logged (`plan file unreadable — keeping last good plan`) and ignored; the last good plan stays in force and the file is read again every 10 seconds until it parses.   |
| Unknown fields | ignored, so the plan can carry a manager's own data.                                                                                                                   |
| Event          | a change of `revision` or `model.id` records `plan.updated` with the revision, and logs `plan file applied`.                                                           |

## Fields the leader reads

```json
{
  "revision": 7,
  "model": { "id": "qwen2.5-7b-instruct" },
  "autoscale": { "floor": 0, "max": 4 },
  "adapters": [ { "name": "sql" }, { "name": "support" } ],
  "workload": { "inputTokens": 4000, "outputTokens": 1000, "maxContext": 8192 },
  "shardGroups": [
    {
      "id": "g0",
      "parts": [ {}, {} ],
      "parallelism": { "tensor": 1, "pipeline": 2, "expert": false },
      "devicesPerPart": 1,
      "flags": { "ctx": "8192" },
      "parked": false
    }
  ]
}
```

| Field                                           | Type     | Effect                                                                                                                                                                 |
| ----------------------------------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `revision`                                      | integer  | Shown as `plan_revision` on `/loadz`, so you can see which revision a leader observes.                                                                                 |
| `model.id`                                      | string   | The endpoint's **one model** (below). Empty = no model restriction.                                                                                                    |
| `autoscale.floor`, `autoscale.max`              | integers | With `max > 0` and `floor == 0`, zero serving capacity is a healthy, parked state: `/readyz` answers `200` with mode `sleeping` or `waking` instead of `503 degraded`. |
| `adapters[].name`                               | strings  | The LoRA adapters this endpoint serves. Empty names are skipped. Empty list = no adapter check.                                                                        |
| `workload.maxContext`                           | integer  | The longest request a worker must hold, in tokens. When `0`, `inputTokens + outputTokens` is used.                                                                     |
| `workload.inputTokens`, `workload.outputTokens` | integers | Used only when `maxContext` is `0`.                                                                                                                                    |
| `shardGroups[]`                                 | array    | The gangs the endpoint declares (below).                                                                                                                               |

### One model per endpoint

With `model.id` set, the leader serves that model only. It passes:

- the catalog id itself;
- any engine-native name of it (for example the Ollama tag an engine reports);
- `<model>:<adapter>` for a LoRA adapter, when `adapters` names it or names none.

Anything else is refused before routing, with `404` and `error.type` `not_found`:

```text
this endpoint serves only qwen2.5-7b-instruct (requested llama-3.2-3b)
this endpoint serves only qwen2.5-7b-instruct with adapters sql, support (requested qwen2.5-7b-instruct:legal)
```

### Workload and the KV bound

With a workload context, admission counts no more requests at once per worker than that worker's KV-cache pool holds at that context; `/loadz` then reports `admission_bound: kv`. No workload means no KV bound, and admission holds a worker to its engine's slots only. A change of the context re-checks every held request at once.

## Gangs

| Field                                           | Effect                                                                                                                         |
| ----------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
| `shardGroups[].id`                              | The gang id. Empty = `g0`, the default gang.                                                                                   |
| `shardGroups[].parts`                           | One entry per part. **Only the count is read**; the objects can carry the manager's own data. A gang with no parts is skipped. |
| `shardGroups[].parallelism.tensor`, `.pipeline` | Tensor- and pipeline-parallel sizes, as for `opod shard create --tp/--pp`.                                                     |
| `shardGroups[].parallelism.expert`              | `true` for a vLLM expert-parallel gang.                                                                                        |
| `shardGroups[].devicesPerPart`                  | GPUs per part.                                                                                                                 |
| `shardGroups[].flags`                           | Engine flags (string to string) passed to the gang's coordinator when the leader forms it, for example `ctx`.                  |
| `shardGroups[].parked`                          | `true` = scaled to zero on purpose. The leader does not form it.                                                               |

### Gang healing

A leader with a plan heals the gangs the plan declares. This is what lets an endpoint recover a gang while its manager is down: an autoscaler restores the worker pods, and the leader forms the gang on them.

The rule is narrow on purpose:

1. Every **15 seconds** the leader looks at each declared gang that is not parked.
2. It acts only on a gang with **no parts at all**. A gang that lost one part is left alone: re-creating it would take down the parts still serving.
3. The gang must have been completely absent for **45 seconds**, so a manager that is doing its job always wins the first race.
4. Enough free workers must have registered for the gang's part count.
5. It runs the same create as `POST /admin/v1/shards/create`, with the plan's parts, parallelism, devices and flags. It does not choose where parts run: the parts are already on the nodes the manager placed them on.

After a **failed** heal it backs off that gang: **15 s**, then **30 s**, then **60 s**. Each failure records `shard.heal_failed` with the gang, the plan revision, the create's `error.code`, the reason, the attempt number and `final`. After **3 failed attempts** at the same gang shape, the last event carries `final: true` and the leader stops trying that gang.

The back-off and the give-up reset when:

- a heal succeeds, or the gang appears by any other path;
- the plan changes that gang's shape (parts, parallelism, devices or flags);
- the gang leaves the plan's active set (parked or removed) and later comes back.

A new `revision` alone does **not** reset them, since an autoscaler writes a revision for every scale. A gang that gave up is the manager's to fix: park it, change its shape, or form it by hand.

While a heal runs, it holds the gang's create guard. A manager's own create of the same gang in that window gets `502 gang_create_in_flight`; read `shard.heal_failed` on the event stream for the leader's verdict.

## Revisions and traffic split

Workers state the plan revision they were started for with `OPOD_PLAN_REVISION`. The policy snapshot's `routing.revisions` then splits traffic between revision groups, which is how a manager runs a canary. See [Policy snapshot](https://opod.io/docs/core-reference/policy-snapshot/#routing).

## Write it safely

Write the file atomically (a temporary file, then a rename), or let a ConfigMap mount do it. Create the file **before** the leader starts: a leader that started without one never watches the path.
