Repository navigation
feat(llm): persist provider calls and shared spending reservations - #108
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
featchange for SemVer.