Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions pkgs/fleet/book/concepts/placement.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,10 +236,10 @@ handle, despite the workflow describing it as one.

A dispatched job gets a session handle: `fp_` plus 16 random bytes from
`/dev/urandom`, hex-encoded — `fp_` plus 32 lowercase hex characters, 128
bits. Records live in the local store at `$FLEET_PLACE_STATE/sessions.json`,
default `~/.local/state/fleet-place/sessions.json` — a labelled stopgap with
the reference implementation's path and record shape, so records migrate
when the designed queue-backend table lands. The store is guarded by a lock
bits. The local store at `$FLEET_PLACE_STATE/sessions.json` defaults to
`~/.local/state/fleet-place/sessions.json`. Dispatch commits locally and then
mirrors the record to the queue broker’s `placement_sessions` table. The
placement decision uses the local session history. The store is guarded by a lock
directory (waiters poll every 50 ms up to 15 s; a lock older than 120 s is
stale and is broken) and written by rename of a temp file, with keys
recursively sorted.
Expand All @@ -253,11 +253,13 @@ recorded-field caveat, stated as the source behaves: `actor` is hardcoded
to `developing-today[bot] (GitHub App dispatch)` even for surfaces that
dispatch as the user.

`fleet queue session status|result|list` reads the store: `status` refreshes
An `fp_` lookup for status, result or follow-up selects the newer copy by
`updated_at` across the local store and the broker mirror. Status and result
can seed the local store from that record. The session verbs then work as follows: `status` refreshes
the record from GitHub and prints its state, surface, and run URL; `result`
adds `terminal` (true exactly for `succeeded|failed|cancelled`) and, when
not terminal, the note "not terminal yet — reconnect with the same handle";
`list` prints stored records newest first without refreshing (`--mine`
`list` combines local records with up to 200 from the mirror, then prints them newest first without refreshing GitHub (`--mine`
filters to the current `USER@hostname`). Anywhere a handle is accepted, the
portable `OWNER/REPO#RUN_ID` is accepted too and is resolved **directly
against GitHub without the local store** — the repo must be a registered
Expand Down
14 changes: 8 additions & 6 deletions pkgs/fleet/book/concepts/secrets.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@ TTL, 3 for a token-file or bind failure. The broker's own token file is
## The serving gate: 503 until loaded

`serving` is true only once at least one refresh has _succeeded_. Before
that, `/health` answers **503** with `ok:false, serving:false` (plus
`refresh_error` when a refresh has failed), and `GET /secret/<name>`
answers 503 `{error: "secrets not loaded yet", …}`. A live process whose
that, public `/health` answers **503** with `ok:false, serving:false`.
An authenticated `GET /secret/<name>` answers 503 with
`error: "secrets not loaded yet"` and includes `refresh_error` when a
refresh has failed. A live process whose
`bws` cannot run is _not_ serving, and health says so: not-loaded is a
distinct, diagnosable state, not a 404. Clients key on this gate.

Expand Down Expand Up @@ -76,9 +77,10 @@ during a refresh, and a failed refresh keeps the old values. One refresh is
loudly rather than silently dropping a secret), then one `bws secret get`
per secret, fetched **8-way parallel** (an 8-worker pool over the name
list). Each `bws` child has a deadline, so a hung child fails its fetch
instead of wedging the refresh — and the `refreshing` flag — forever. A
second refresh requested while one is in progress is refused
(`refresh already in progress`).
instead of wedging the refresh — and the `refreshing` flag — forever. The authenticated
`POST /refresh` acknowledges the request with 202. If a sweep is already
running, the worker skips the overlapping sweep. Use `last_refresh_unix`
and `refreshing` on `/health` to follow progress.

A refresh installs **per secret**, not all-or-nothing: fetches that succeed
land immediately with the batch's install time; a secret whose fetch fails
Expand Down
15 changes: 9 additions & 6 deletions pkgs/fleet/book/getting-started/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,19 @@ failed (the message names it), 2 usage. Phases are selectable with
`--only <list>` / `--skip <list>`; `--all` additionally restores `~/git` and
`~/agents`.

**The pin.** Two lines near the top of the script, both overridable from the
environment, pin the release:
**The pin.** Read the matched asset URL and SHA-256 from the same checkout of
`scripts/muse/bootstrap.sh` that you intend to run:

```sh
FLEET_URL="${FLEET_URL:-https://github.com/developing-today/code/releases/download/fleet-static-b8bbcc0/fleet-x86_64-linux-musl}"
FLEET_SHA256="${FLEET_SHA256:-<the sha256 printed by publish-fleet.sh for that tag>}"
grep -E '^FLEET_(URL|SHA256)=' scripts/muse/bootstrap.sh
```

The URL is exactly the publish tag scheme (`fleet-static-<7-char short sha>`)
plus the asset name. `FLEET_AGENT` (default `muse`) and `FLEET_AGENT_GROUPS`
Bootstrap uses those defaults and verifies the downloaded binary. When
overriding the release, supply both `FLEET_URL` and `FLEET_SHA256` for the
same published asset. After installation, check `fleet version` and
`fleet capabilities` on the seat.

`FLEET_AGENT` (default `muse`) and `FLEET_AGENT_GROUPS`
select the seat identity; groups are never hardcoded for another agent kind.

**The phases**, in the order `PHASES="tools token restore tailnet fleet persist init check"`:
Expand Down
12 changes: 7 additions & 5 deletions pkgs/fleet/book/library/placement.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,11 +225,13 @@ order, Tier 3 Codespaces, then exhaustion — is walked step by step in

## The session store format

Placement sessions are a labelled **stopgap**: a local JSON store at
`$FLEET_PLACE_STATE/sessions.json`, defaulting to
`~/.local/state/fleet-place/sessions.json` — the same path and record
shape the reference implementation used, so records migrate rather than
being redesigned when the designed backend table lands.
The local store at `$FLEET_PLACE_STATE/sessions.json` defaults to
`~/.local/state/fleet-place/sessions.json`. Its existing record shape
remains readable. Dispatch commits locally before its best-effort mirror
write to the broker’s `placement_sessions` table. Listing merges local
records with up to 200 broker records and attempts to insert missing local
records into the mirror. Status, result and follow-up prefer the record
with the newer `updated_at` and select the broker copy on ties.
Comment on lines +233 to +234

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Limit broker-backed follow-up lookup to dry runs

For an actual dispatch --followup <fp_handle> --dispatch, the client does not select between local and broker records: the dispatch branch in pkgs/fleet/crates/fleet-queue/src/placement.rs calls refresh_session directly against the local store. Only the dry-run follow-up branch calls remote.get and pick_session. Consequently, a handle available only in the broker succeeds in a placement preview but fails on submission with no session with handle ..., contrary to this new description. Qualify this behavior here and in the placement concept chapter, and document that cross-seat submission requires first seeding the local store through session status/result or using the portable run reference.

Useful? React with 👍 / 👎.


Store shape:

Expand Down
2 changes: 1 addition & 1 deletion pkgs/fleet/book/operations/health-and-healing.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Fleet has no single health endpoint; it has a health _surface_ per layer, and th
| ------------------------------- | ------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Queue as a client sees it | `fleet queue health [--queue <name>] [--worker <id>]` | The queue client can reach the broker (`POST /health`) and the broker's health rows come back. `--worker` scopes the answer to that worker's view. Distinct from the broker's own unauthenticated probe, below. |
| Queue-broker liveness | `GET /healthz` on the queue-broker (port 4801 on the laptop) | The broker process answers. Unauthenticated — the only unauthenticated queue-broker route. It answers before the Turso backend is up (the backend starts on a separate thread), so it proves liveness, not readiness. |
| Secrets-broker readiness | `GET /health` on the secrets-broker (port 4800) | Returns `{ok, serving, secrets, last_refresh_unix, refreshing, oldest_secret_age_seconds}`. **503 while `serving` is false** — `serving` becomes true only once at least one refresh has succeeded. Before that, the body carries `refresh_error` when a refresh has failed. A live process whose `bws` cannot run is _not_ serving, and this endpoint says so. |
| Secrets-broker readiness | `GET /health` on the secrets-broker (port 4800) | Returns `{ok, serving, secrets, last_refresh_unix, refreshing, oldest_secret_age_seconds}`. **503 while `serving` is false** — `serving` becomes true only once at least one refresh has succeeded. The public response exposes readiness and timing. An authenticated not-loaded secret read can include `refresh_error` after a failed refresh. A live process whose `bws` cannot run is _not_ serving, and this endpoint says so. |
| Session-broker (proxy) liveness | `fleet proxy` broker hello via `fleet init`'s probe; the broker also self-checks its peers | The session proxy answers on its socket and speaks the hello/capability handshake. `fleet init` reporting the proxy role as live is the practical check. |
| Bridge health | `fleet bridge health` | The message bridge's `/healthz` answers. No token needed. Proves the bridge service, not your seat's mailbox access — for that, read a mailbox (`fleet bridge inbox --agent <name> --limit 1`). |
| Seat health, all legs | `fleet agent doctor [--agent <name>]` | Four independent probes issued together — the **legs**: **bridge** (`bridge inbox --agent A --limit 1` with a name, else `bridge health`), **queue** (`queue health`), **github** (`gh api rate_limit` via `fleet gh`, falling back to plain signed-in `gh`), **shell** (`laptop-agent health`). There is no secrets leg: secrets is folded into the bridge leg's stated need. From the legs, doctor derives the **rungs** map (which intake rungs this seat still has: push = bridge leg, queue = queue leg, shortlist = always true, priority = github leg) and the `builds` line. Exit 0 when any intake rung is live, else 3. |
Expand Down
4 changes: 2 additions & 2 deletions pkgs/fleet/book/operations/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ Symptom → cause → fix. Each entry names the check that confirms the cause be
## Secrets broker stuck refreshing (503, very many `bws` fetches)

- **Symptom:** `fleet secrets get <name>` fails or reports the broker not serving; `GET /health` on the secrets-broker answers 503 with `serving=false` for a long time; the broker's refresh appears to run constantly (the shape recorded as issue #13081 involves on the order of 220 `bws` fetches in a refresh cycle).
- **Cause:** The broker's full-vault refresh has not yet _succeeded_. `serving` only becomes true once a refresh completes (`last_refresh_unix` is set); a refresh that keeps failing or being restarted keeps the broker in the not-serving state, and `/health` reports `refresh_error` when a refresh has failed.
- **Confirm:** `GET /health` — check `refreshing`, `last_refresh_unix`, and `refresh_error`. A cached read that succeeds carries `source: "cache"` and an `age_seconds`; that tells you the broker once served and how stale the value is.
- **Cause:** The broker's full-vault refresh has not yet _succeeded_. `serving` only becomes true once a refresh completes (`last_refresh_unix` is set); a refresh that keeps failing or being restarted keeps the broker in the not-serving state, and public `/health` continues to return 503.
- **Confirm:** `GET /health` — check `refreshing` and `last_refresh_unix`. An authenticated secret read while the cache is unready can return a 503 body with `refresh_error` after a failed refresh. A cached read that succeeds carries `source: "cache"` and an `age_seconds`; that tells you the broker once served and how stale the value is.
- **Fix:** Fix the refresh's cause (the `bws` route and its token, by name — never by pasting a value anywhere), then let **one** refresh complete. **Do not restart-loop the broker:** every restart discards refresh progress and restarts the clock, converting a slow recovery into a permanent 503. A process that is alive and returning 503-with-`serving=false` is in a known state, not crashed.

## Queue double-serve: a parked, completed, or cancelled task is served again (#13091)
Expand Down
Loading