Skip to content

Budgets: one consumption record, the AS as usage caller, settlement (#120) - #138

Merged
dickhardt merged 2 commits into
mainfrom
budgets-settlement
Sep 6, 2026
Merged

dickhardt merged 2 commits into
mainfrom
budgets-settlement

Conversation

@dickhardt

Copy link
Copy Markdown
Owner

Replaces #133, which GitHub closed when its base branch was deleted after #128 merged; content unchanged, rebased onto main.

Stacked on #128 (branch consent-presentation), which carries the Unreported Allocations section and the comma fix this builds on. Retarget to main once #128 merges.

Three changes to draft-hardt-aauth-budgets.md:

One consumption record (#120). budget_consumed becomes a single {jti, consumed} object for the auth token presented on the request the resource token answers. Every other record duplicated a figure the issuer already had or would settle from a usage reading; the list cost about a kilobyte in the 401 header and told an agent what was spent under tokens it never held. The jti stays: an issuer holding several live allocations for one agent cannot attribute an amount alone, and attributing by agent key would make the conservative fallback the normal case for concurrent agents. New: a record is as of its resource token's iat, and is the token's final figure only when that is at or after the auth token's exp. A record stated while the token was live is a snapshot and releases nothing, which is also why a record on an insufficient-budget challenge cannot free the old token's remainder (the token stays spendable). Rationale section Why One Record.

The AS as a usage endpoint caller. The endpoint was PS-only on the assumption that an AS sits in the resource's trust domain. A general-purpose AS (access.aauth.dev fronting resources it does not operate) does not, and it sizes allocations against a ceiling of its own, so it needs the same channel. The existing authorization rule generalizes: the resource answers for values seen in auth tokens whose iss or ps names the caller. Response aud names whichever issuer asked.

Settlement. New subsection under Unreported Allocations: how an issuer gets out from under the conservative rule. A final record settles one token early. A usage reading settles every allocation expired by its as_of in aggregate, free = ceiling − metered − Σ unsettled allocations, without naming any of them; the only over-count is spend under still-live tokens, which vanishes as they expire. An issuer with a calendar-period ceiling SHOULD clip allocations to the period boundary, after which the period settles itself with no query.

The model is implemented and tested in the access module (allocation ledger DO, settlement by record and by reading on an alarm, randomized many-token simulation asserting the issuer never over-authorizes). The simulation is what surfaced the record-finality rule.

🤖 Generated with Claude Code

https://claude.ai/code/session_01KQ7zzXWHFJ4pEjbmF5DnkW

dickhardt and others added 2 commits September 6, 2026 14:05
- budget_consumed is one record, the presented token's, with jti kept
  so concurrent allocations settle exactly. A record is as of its
  resource token's iat and final only when that is at or after the auth
  token's exp. Rationale in Why One Record. Addresses #120.
- The usage endpoint admits an access server as caller; the response
  aud names whichever issuer asked. A general-purpose AS sizes
  allocations against a ceiling of its own and is not in the resource's
  trust domain.
- Settlement under Unreported Allocations: a final record settles one
  token early; a usage reading settles every allocation expired by its
  as_of in aggregate; a calendar ceiling settles itself when allocations
  are clipped to the period boundary.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KQ7zzXWHFJ4pEjbmF5DnkW
@dickhardt
dickhardt merged commit 58b2a26 into main Sep 6, 2026
2 checks passed
@dickhardt
dickhardt deleted the budgets-settlement branch September 6, 2026 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant