README: the spend check compares day by day over the shared window
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
inference-admin committed 2026-11-13 20:48:02 +00:00
1 parent b30e2c8080
commit 0d5ffede05
1 file changed
+13 -6
+13 -6
View File
@@ -249,12 +249,19 @@ Four jobs run inside the container via `CloudronManifest.json` → `addons.sched
failed *soft*: its copy of the gateway's LiteLLM DB credential had gone stale, the
query returned nothing, and every surface showed $0 while looking clean — the
portal was the thing that was wrong. `check_spend_consistency()` compares two
genuinely independent reads: the portal's SpendLogs aggregate over its own DB
credential, and LiteLLM's own HTTP API (`/global/spend/keys`) over the master key.
An EMPTY/$0 portal aggregate while LiteLLM reports real spend is a FAILURE named
as the stale-credential case, and an API side with no keys is a failure rather
than agreement. Silent when they agree; a read that cannot be made is `skipped`,
never clean. On demand: `POST /admin/spend-check`.
genuinely independent reads — the portal's SpendLogs aggregate over its own DB
credential, and LiteLLM's own HTTP API (`/global/spend/teams`) over the master key
— **day by day over the window both sides cover**, which localises drift instead of
hiding it in a sum. Two traps are encoded here: LiteLLM's per-day view reaches back
only a fixed number of days (31) while our table holds everything, so a
sum-vs-all-time test reports the missing window as drift ($107.63 of it on
2026-11-13, against a real agreement of $0.07); and `/global/spend/keys` follows
each key's own budget cycle, so it is not an all-time figure either
(`/global/spend/report` would be, but is Enterprise-gated). An EMPTY/$0 portal
aggregate while LiteLLM reports real spend is a FAILURE named as the
stale-credential signature — judged *before* the window overlap, since in that
failure there are no shared days to compare. Silent when they agree; a read that
cannot be made is `skipped`, never clean. On demand: `POST /admin/spend-check`.
**Notice policy (all of the above):** email `info@` only when there is a
problem, and only about what is NEW. What a human has been told is a growing SET