You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 480b8e1
Browse filesBrowse the repository at this point in the historyBrowse files
hzq
committed
Reset API key usage in bounded settlement slices
Fence new work on the resetting key while draining terminal accounting. Commit the quota and zeroed usage together with a receipt, and verify uncertain commits before publishing either change.
Copy file name to clipboardExpand all lines: docs/operations.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -178,6 +178,8 @@ Creating a run commits its initial event, key usage, any platform hold and its w
178
178
179
179
On `GET /metrics`, `oaa_run_outcomes_total{agent,status}` is the counter for completion and failure rates. It counts transitions into terminal states and survives history pruning and restarts. At first upgrade it starts from the terminal runs still retained, not already-deleted history. The older `oaa_runs_total`, `oaa_run_errors_total`, `oaa_run_tokens_total` and `oaa_tokens_total` series retain their names and snapshot values, but are gauges: do not apply `rate()` to them.
180
180
181
+
Resetting an API key through `POST /v1/keys/{id}/quota` with `reset_usage: true` settles its pending terminal runs in short batches before clearing its usage. During the reset, new runs and resumes for that key, and other quota changes to it, return `503 key_quota_busy`. Other keys are not paused. Runs that are still active at the reset boundary remain active and can accrue usage afterward. On `409 effect_outcome_unknown`, inspect the current quota and usage before retrying; the final write is checked in the background, not replayed.
182
+
181
183
Nothing is deleted automatically unless you ask for it. `oaa prune [--older-than 30d] [--dry-run] [--vacuum]` deletes finished runs older than the given age with their events, steps, artifacts and webhook approval announcements, plus uploads (including stored image inputs) and session workspaces that no kept run uses. Queued, running, waiting and `interrupted` runs are never touched, nor is a run whose developer-platform ledger line is still unsettled. Ledger lines, key usage totals, memories and webhook delivery logs are records and stay. To prune on a schedule, set `"retention": {"runsDays": 30}` in `config.json`; `oaa doctor` and `oaa status` warn when the database grows past `retention.warnDatabaseMb` (default 1024).
182
184
183
185
Before a schema migration the gateway copies the database to `backups/state-v<old>-before-subjects-<time>.sqlite`; only the newest 3 copies per source version are kept. Details, measured soak results and crash-recovery semantics: [stability.md](stability.md).
Copy file name to clipboardExpand all lines: docs/protocol.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -727,6 +727,7 @@ Error codes and response shapes do not depend on language; only the text of `mes
727
727
|`rate_limited`| 429 | The key exceeded its requests per minute (600 by default) |
728
728
|`concurrency_limit`| 429 | The owner has too many active requests |
729
729
|`admission_busy`| 503 | No run was created: the database writer wait expired or the admission queue was full. Respect `Retry-After` and reuse the same idempotency key. |
730
+
|`key_quota_busy`| 503 | The API key is undergoing a quota reset, or the reset cannot currently acquire the database writer. Respect `Retry-After`. |
730
731
|`upload_busy`| 503 | The upload exhausted its wait budget, its previous quota reader has not released the scan, or repeated changes prevented a consistent count. No new file was accepted; respect `Retry-After`. |
731
732
|`file_commit_unconfirmed`| 409 | The file metadata commit could not be confirmed or read back. Inspect the supplied `file_id` before uploading again; do not assume that no file exists. |
732
733
|`subject_concurrency_limit`| 429 | The same caller (subject) reached `maxActiveRunsPerSubject` unfinished requests |
rate_limited: ['This key exceeded its requests-per-minute limit (600 by default).','Retry later, or ask the owner to raise this key\'s per-minute limit.'],
19
19
concurrency_limit: ['The owner has too many active requests.','Retry after some in-flight requests finish.'],
20
20
admission_busy: ['The gateway could not acquire the run admission writer in time or the wait queue is full.','Retry later with the same idempotency key.'],
21
+
key_quota_busy: ['The API key is undergoing a quota reset, or the reset could not acquire the writer.','Retry after the current operation finishes.'],
21
22
upload_busy:['File publication did not obtain the database writer within its wait budget.','Retry the upload later.'],
22
23
file_commit_unconfirmed:['The file publication outcome is unconfirmed.','Inspect the returned file ID before uploading again.'],
23
24
subject_concurrency_limit: ['This caller has reached its limit of unfinished requests.','Retry after some in-flight requests finish.'],
0 commit comments