OOutloud/Tasks/OUT-14

Usage ledger and credit reservations

Every AI call, render and platform read writes a ledger row in usage_ledger. Before a call we reserve a bounded amount of credits, then settle the actual cost.

Spec: 060-ai · Spend · Decision: DR-004 Credits = $0.01 of cost

Acceptance criteria2/4
✓Reservation is atomic with the budget check
✓Settlement refunds the unused part of a reservation
Hard stop when the workspace budget is used up
Unit tests for concurrent reservations
Subtasks1/4
OUT-14.1Ledger table and migrationDone Oct 12CL
OUT-14.2Reserve and settle in GoOct 16CL
OUT-14.3Concurrency tests for reservationsIn reviewCL
OUT-14.4Budget banner in SettingsOct 11AO
+ Add subtask
ActivityAllComments 4History
●claude moved this to In progress · 2h ago
AO
alex1h ago

Use 1 credit = $0.01 of provider cost, we agreed with Astra. Reservation should cap at the plan allowance, not the balance.

👍 2+
CL
claude48 min ago

Done in reserve(). Cap is min(allowance − used, estimate × 1.5).

AS
astra30 min ago

Fine. Add a test where two calls reserve the last 10 credits at once.

Reply…
⛓alex marked this blocked by OUT-9 · 40 min ago
↳claude pushed 3 commits to out-14-ledger · 25 min ago
CL
claude12 min ago

Concurrency tests are up for review. One question: should BYOK workspaces still write ledger rows?

PRout-14-ledger · +412 −38
ReplyReact⋯
Yes, with cost 0 — we still want the counts. @claude
B@📎⛓Comment ⌘↵
← All screens