Skip to content

feat(llm): persist provider calls and shared spending reservations - #108

Merged
nosam1998 merged 1 commit into
mainfrom
feat/llm-ledger
Oct 4, 2026
Merged

nosam1998 merged 1 commit into
mainfrom
feat/llm-ledger

Conversation

@nosam1998

Copy link
Copy Markdown
Member

Paid model calls need durable dispatch authorization and accounting before the server can safely resume matches. Add a credential-free call journal and shared match, provider-key, and optional benchmark-run spending accounts to SQLite and PostgreSQL.

Reservations, call records, and all affected balances commit together. Existing call IDs never authorize another dispatch; uncertain calls retain their reservation across restart. Settlement charges immutable pricing exactly once, preserves the original response, and records actual usage even when the host underestimated its reservation. Seat-scoped transcript pages bound both record count and payload size.

This provides the persistence port for LLM seats; enabling server-driven model players is a separate feature. The host remains responsible for selecting a conservative reservation and authorizing transcript readers.

Validation: 11 SQLite tests and both PostgreSQL integration tests pass, including simultaneous reservations and settlements, cross-scope rollback, shared run budgets, restart recovery, overspend accounting, and large transcript pagination. SQLx metadata checks pass for both backends; Clippy, formatting, and workspace dependency checks pass. Additive feat change for SemVer.

@nosam1998
nosam1998 marked this pull request as ready for review October 4, 2026 07:45
@nosam1998
nosam1998 merged commit b104347 into main Oct 4, 2026
14 checks passed
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