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.
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:
- Unclassified. No confirmed category, no AI suggestion. Genuinely untouched.
- AI-suggested. No confirmed category yet, but a suggestion exists: a distribution of categories with percentages, produced either at reservation creation (a live preview while the form is open) or at reservation end (a background pass once the reservation goes terminal). Reports in its own bucket on the Reporting page, never mixed into confirmed totals.
- Confirmed. An owner or admin has set
purpose_category, by hand or by accepting a suggestion here. This is the only state the reporting page's main Purpose chart counts.
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:
| Purpose | Owner | Dates | Suggestion | Actions |
|---|---|---|---|---|
| 4.2 regression pass | sara.k | 08-28 → 08-29 | QA regression 71% | Accept · Accept as · Dismiss |
| nightly HA suite | dmitri.r | 08-30 → 08-31 | QA regression 64% | Accept · Accept as · Dismiss |
| Purpose | Owner | Dates | Suggestion | Actions |
|---|---|---|---|---|
| repro for CASE-4821 | li.wei | 08-27 → 08-27 | Support case replication 58% | Accept · Accept as · Dismiss |
The Purpose Review page (Administration → Purpose Review): grouped by top suggested category, oldest cards expanded by default.
- Classify history. The backfill action; see below.
- A category group. Every reservation whose top suggestion is this category, with a count.
- 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
- Accept. Writes the suggestion's own top category into
purpose_category, recording you as who set it. - Accept as… Pick a different category from the same taxonomy the create modal offers, for when the AI's second- or third-ranked guess (or something it didn't mention at all) is the right call.
- Dismiss. Declines the suggestion without confirming anything. The reservation keeps its AI-suggested state and stays visible in the reporting page's suggested bucket — dismissing only stops the review queue from surfacing it again. It is not a delete.
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.