feat(governance): implement cost and session budget tracking and enforcement #8609

Open
opened 2026-04-13 21:15:06 +00:00 by HAL9000 · 0 comments
Owner

Metadata

  • Commit message type: feat
  • Scope: governance
  • Branch name prefix: feat/v3.6.0-cost-session-budget-tracking

Background and Context

As part of Epic #8569 (Cost Budgets, Safety Profiles & Plugin Architecture), cost and session budgets must be tracked and enforced at the plan and session level. This prevents runaway costs in autonomous execution.

This issue blocks Epic #8569.

Expected Behavior

  • Cost budgets are configurable per-plan and per-session (max USD spend)
  • Session budgets are configurable (max total cost for a session)
  • Budget tracking is updated after each LLM call with actual cost
  • Budget enforcement halts execution when the budget is exceeded
  • Budget status is visible in the TUI

Acceptance Criteria

  • Cost budget is configurable per-plan and per-session
  • Budget tracking is updated after each LLM call
  • BudgetExceededError is raised when budget is exceeded
  • Budget status is queryable (current spend, remaining budget)
  • Integration tests verify budget tracking and enforcement
  • Unit tests achieve >= 97% coverage

Subtasks

  • Design cost budget configuration schema
  • Implement cost tracking (update after each LLM call)
  • Implement session-level budget aggregation
  • Implement budget enforcement (raise BudgetExceededError)
  • Implement budget status query
  • Write integration tests for budget tracking
  • Write unit tests for budget enforcement

Definition of Done

  1. Cost/session budget tracking and enforcement is functional
  2. Integration tests verify budget enforcement
  3. Unit tests pass with >= 97% coverage
  4. Code reviewed and merged to main branch

Automated by CleverAgents Bot
Supervisor: Epic Planning | Agent: epic-planning-pool-supervisor

## Metadata - **Commit message type**: `feat` - **Scope**: `governance` - **Branch name prefix**: `feat/v3.6.0-cost-session-budget-tracking` ## Background and Context As part of Epic #8569 (Cost Budgets, Safety Profiles & Plugin Architecture), cost and session budgets must be tracked and enforced at the plan and session level. This prevents runaway costs in autonomous execution. This issue blocks Epic #8569. ## Expected Behavior - Cost budgets are configurable per-plan and per-session (max USD spend) - Session budgets are configurable (max total cost for a session) - Budget tracking is updated after each LLM call with actual cost - Budget enforcement halts execution when the budget is exceeded - Budget status is visible in the TUI ## Acceptance Criteria - [ ] Cost budget is configurable per-plan and per-session - [ ] Budget tracking is updated after each LLM call - [ ] `BudgetExceededError` is raised when budget is exceeded - [ ] Budget status is queryable (current spend, remaining budget) - [ ] Integration tests verify budget tracking and enforcement - [ ] Unit tests achieve >= 97% coverage ## Subtasks - [ ] Design cost budget configuration schema - [ ] Implement cost tracking (update after each LLM call) - [ ] Implement session-level budget aggregation - [ ] Implement budget enforcement (raise `BudgetExceededError`) - [ ] Implement budget status query - [ ] Write integration tests for budget tracking - [ ] Write unit tests for budget enforcement ## Definition of Done 1. Cost/session budget tracking and enforcement is functional 2. Integration tests verify budget enforcement 3. Unit tests pass with >= 97% coverage 4. Code reviewed and merged to main branch --- **Automated by CleverAgents Bot** Supervisor: Epic Planning | Agent: epic-planning-pool-supervisor
HAL9000 added this to the v3.6.0 milestone 2026-04-13 21:15:36 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
cleveragents/cleveragents-core#8609
No description provided.