feat(spend-control): evaluation, enforcement, and usage-trigger runtime - #4548
Conversation
|
There was a problem hiding this comment.
All reported issues were addressed across 19 files
Tip: instead of fixing issues one by one fix them all with cubic
Re-trigger cubic
26b1225 to
02e06f8
Compare
c1e019d to
178dacd
Compare
02e06f8 to
0da7498
Compare
Stacked on the spend-control management API PR. Adds the runtime that evaluates and enforces budget rules: - Background evaluator: temporal workflow/activity computing per-actor window spend and opening/closing warning + breach circuits. - Hooks spend gate: blocks over-budget actors on the ingest path. - Telemetry usage trigger: throttled per-org re-evaluation on fresh spend-relevant telemetry, wired via a telemetry LogObserver. - Wires the concrete evaluation signaler into the spend rules API service and registers the worker-side activity + observers. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
0da7498 to
0edd554
Compare
- UsageTrigger: fire signals off the telemetry write path in a bounded, cancellation-detached context, so a slow Redis/Temporal dependency can't stall LogBulk, a canceled poll activity still wakes enforcement, and graceful shutdown stays within its drain deadline. - EvaluateOrg: fail loudly instead of panicking when the worker has no ClickHouse connection; surface transient event-write failures so the activity retries (events dedupe on their unique index); log-and-skip per-rule logic errors rather than aborting the org. - Gate: reject a nil cache at construction (fail-open contract), and bound the compiled-CEL cache so repeated rule edits can't grow memory. - Raise the gate snapshot TTL to 4x the evaluation interval so a slow scheduled sweep does not let snapshots expire and enforcement fail open. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
0edd554 to
bcb5853
Compare
There was a problem hiding this comment.
All reported issues were addressed across 15 files (changes from recent commits).
Tip: instead of fixing issues one by one fix them all with cubic
Re-trigger cubic
There was a problem hiding this comment.
All reported issues were addressed across 9 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Fix all with cubic | Re-trigger cubic
Co-authored-by: Cursor <cursoragent@cursor.com>
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
All reported issues were addressed across 8 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Fix all with cubic | Re-trigger cubic
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Summary by cubic
Ships Budgets v1: a spend-rules API, dashboard, and a runtime that evaluates spend and enforces blocks within seconds. Enforcement is behind the Budgets flag and applies to Claude only.
New Features
@gram/clienthooks included.Bug Fixes
Written for commit 8952dfb. Summary will update on new commits.