Changes · platform-docs · PR #418 · financial

Credits are decremented at request time, not after generation

GHFrom platform-docs · PR #418 · proposed by codex-ci · 2026-08-23 · replaces the active claim Credits are decremented after generation completes
You can decide now.Approving makes this the active claim and lifts the agent refusals on this topic. Evidence for the new ordering still has to be re-run afterwards; that does not block approval here.
Not yet — the source changed since this was proposed.billing.adoc was edited on main at 08:58 after this proposal was made. AgentDoc will not let a stale proposal be approved. Nothing else is blocking.
Approved here. Waiting for GitHub.Open PR #418 ↗This repository requires a GitHub approval from a code owner before knowledge changes take effect. @mira-chen approved in Cloud on 2026-08-22.

What changes

statement
beforeCredits are decremented after generation completes.
afterCredits are decremented at request time and refunded within 60 seconds if the generation fails or is cancelled.
also changes
evidenceAdds credits.reserve.spec.ts; keeps consume.use-case.ts as source.
scopeUnchanged — billing, all environments.

Why it matters written by the model · check it

This reverses when credits are taken. The active claim says after a generation completes; the code now reserves them at request time and refunds on failure. Two things depend on this: the decision Use a ledger for credit consumption and the refund procedure, which describes the old order in step 2.

Approving also settles the contradiction that has made agents refuse 14 questions on billing credits since 06:04.

Source change PR #418 · 2 files

docs/knowledge/billing.adoc
18- body: Credits are decremented after generation completes.
18+ body: Credits are decremented at request time and refunded within 60 seconds if the generation fails or is cancelled.
19+ evidence: test credits.reserve.spec.ts