fix(ai): background generation cannot spend the interactive day

The automatic generators — status and reference cards, the briefing, the
arrival reaction, the nudge, document summaries and the index backfill —
reserved against the same ceiling as the chat. On the operator's account
that meant 150-330 ledger rows a day, 172 metric generations before
06:42Z, and a ceiling already spent when he opened the chat.

Every background surface now reserves through
`resolveDailyCapFor("job", chain)`: half the cost owner's ceiling, all
job surfaces together. The interactive routes keep the whole ceiling, so
a day of background work can no longer take the user's own away.
This commit is contained in:
Marc-André Bombeck committed 2026-09-11 10:09:34 +02:00
1 parent 2c46712e13
commit d3196ee69e
38 files changed
+151 -17

No files matched your search

@@ -44,6 +44,7 @@ vi.mock("@/lib/ai/coach/budget", () => ({
// returns a distinctive figure so an accidental default-cap regression is
// visible in the assertion rather than silently passing.
resolveDailyCap: vi.fn(() => 1_234_567),
resolveDailyCapFor: vi.fn(() => 1_234_567),
resolveCostOwner: vi.fn(() => "user" as const),
}));