HERD
User manual
Admin track · Setup F

Purpose review

Reservations owners rarely bother filling in a purpose category by hand for every booking. Purpose review is where the AI's guesses at reservation creation and end of use wait for a human to accept, override, or dismiss them before they count toward the numbers leadership sees.

The shape of this

A category an owner or admin picks by hand is confirmed immediately, no review needed. A category the AI proposes only ever becomes a suggestion: it never writes itself into the reservation. This page is where a suggestion turns into a confirmed category, or gets dismissed. Nothing here changes automatically without an admin clicking something.

Finding it

Where it lives

Go to Administration → Purpose Review (/admin/purpose-review). It is admin only. The page depends on your admin having turned on AI purpose classification (AI_PURPOSE_CLASSIFICATION_ENABLED) and having a working AI provider configured; if either is off, nothing ever lands here because the two classification passes described below never run. Manual, hand-picked categories keep working from the reservation create and detail modals regardless — see Reservations, and an admin can ask for a suggestion on one finished reservation from its detail modal with Classify now.

Step one

The three states

Every reservation's purpose sits in exactly one of three states, and none of them is a stored column by itself — they are read off purpose_category and the stored suggestion:

A confirmed reservation can still carry a suggestion underneath (kept for reference, e.g. to see how often the AI and the owner agree), but reporting only ever counts its confirmed value once a category is set.

Step two

The review queue

The page groups reservations by their suggestion's top category into collapsible cards, each showing a count. A reservation appears here only while it is genuinely worth a look:

herd.lab/admin/purpose-review
Purpose Review
Classify history
QA regression 3
PurposeOwnerDatesSuggestionActions
4.2 regression passsara.k08-28 → 08-29QA regression 71%Accept · Accept as · Dismiss
nightly HA suitedmitri.r08-30 → 08-31QA regression 64%Accept · Accept as · Dismiss
Support case replication 1
PurposeOwnerDatesSuggestionActions
repro for CASE-4821li.wei08-27 → 08-27Support case replication 58%Accept · Accept as · Dismiss

The Purpose Review page (Administration → Purpose Review): grouped by top suggested category, oldest cards expanded by default.

  1. Classify history. The backfill action; see below.
  2. A category group. Every reservation whose top suggestion is this category, with a count.
  3. A queue row. Purpose text, owner, dates, status, any confirmed category already set, the top-three suggested categories as percentage chips (the model's rationale shows as a tooltip), and the row actions.

A row shows up here only if it has an undismissed suggestion AND either has no confirmed category yet, or has a confirmed category that disagrees with the suggestion's top pick, so an admin can also catch a bad self-classification. A confirmed row that agrees with the AI has nothing left to review and drops out on its own; a dismissed suggestion never resurfaces. The category filter above the list narrows to one suggested category at a time; results page the same way as the other admin tables.

Step three

Accept, accept as, dismiss

Both accept actions can overrule an owner's own pick, too: an admin accepting a different category than what the owner set replaces it, with the admin recorded as who made the change. Every action removes the row from the queue immediately; a failure puts it back with an error toast so nothing silently disappears.

The catch-up tool

Classify history

Reservations that ended before this feature existed, or that a stack outage skipped, never automatically get a suggestion on their own. Classify history marks every terminal reservation (COMPLETED, CANCELLED, or FAILED) that has neither a confirmed category nor a suggestion yet as eligible for the same background pass that runs at reservation end, and separately gives a fresh set of attempts to any row that already used up its retries without ever getting a suggestion (a mixed-version deployment where the classify endpoint briefly didn't exist is the usual cause). It reports how many reservations it marked, and running it again once the background pass has caught up reports zero: safe to click more than once.

A single reservation does not have to wait for either the sweep or a backfill. POST /api/reservations/admin/purpose-review/{reservation_id}/classify runs the same classifier the background pass uses, for that one reservation, and answers with its outcome as a 200: ok with the new suggestion, or timeout, transient, failed, or forbidden. It answers 503 when purpose classification is off, 409 not_eligible while the reservation has not ended yet, and 409 already_suggested when a suggestion already exists, so dismiss or override that one first. It ignores the per-reservation attempt cap on purpose, which makes it the way to retry one exhausted reservation without running Classify history, which retries every exhausted row. An admin can also run it from the UI: a finished reservation with no suggestion shows a Classify now button in its detail modal. The Purpose Review page itself lists only reservations that already carry a suggestion, and says so: "A finished reservation with no suggestion can be classified from its detail view on the Reservations page."

Marking a reservation eligible does not classify it instantly: it joins the same background queue everything else uses, so suggestions from a large backfill trickle in over the next several sweep ticks rather than appearing all at once.

HERD User Manual · Purpose review (admin)