fix(guards): wire AutomationGuard enforcement into plan execution pipeline — denylist, budget caps, tool call limits #3372

Open
opened 2026-04-05 14:41:10 +00:00 by freemo · 1 comment
Owner

Metadata

  • Branch: fix/v3.6.0/automation-guard-enforcement
  • Commit Message: fix(guards): wire AutomationGuard enforcement into plan execution pipeline
  • Milestone: v3.6.0
  • Parent Epic: #3370

Background

Issues #3294 and #3346 identified that AutomationGuard denylist, budget caps, and tool call limits are never enforced during plan execution. check_guard() and evaluate_guard() are dead code — they exist but are never called in the execution pipeline.

Expected Behavior

AutomationGuard.check_guard() is called at appropriate points in the execution pipeline:

  • Before each tool call: check denylist and tool call limits
  • After each tool call: update budget tracking
  • At phase transitions: check budget caps
  • Guard violations raise appropriate exceptions that surface to the user

Acceptance Criteria

  • check_guard() called before each tool invocation in ToolRunner
  • evaluate_guard() called at plan phase transitions
  • Denylist violations raise GuardViolationError with clear message
  • Budget cap violations halt execution with cost summary
  • Tool call limit violations halt execution with count summary
  • BDD unit tests cover all guard enforcement scenarios
  • nox -e typecheck passes with no suppressions
  • Coverage >= 97%

Dependencies

  • Blocked by: (none)
  • Blocks: #3370

Subtasks

  • Wire check_guard() into ToolRunner.run() before tool invocation
  • Wire evaluate_guard() into plan phase transition logic
  • Add GuardViolationError exception type if missing
  • Add BDD feature file for guard enforcement
  • Add step definitions for guard enforcement tests
  • Verify nox passes

Definition of Done

  • All subtasks completed
  • Tests written and passing
  • All nox stages pass
  • Coverage >= 97%

Automated by CleverAgents Bot
Supervisor: Unknown | Agent: ca-epic-planner

## Metadata - **Branch**: `fix/v3.6.0/automation-guard-enforcement` - **Commit Message**: `fix(guards): wire AutomationGuard enforcement into plan execution pipeline` - **Milestone**: v3.6.0 - **Parent Epic**: #3370 ## Background Issues #3294 and #3346 identified that `AutomationGuard` denylist, budget caps, and tool call limits are never enforced during plan execution. `check_guard()` and `evaluate_guard()` are dead code — they exist but are never called in the execution pipeline. ## Expected Behavior `AutomationGuard.check_guard()` is called at appropriate points in the execution pipeline: - Before each tool call: check denylist and tool call limits - After each tool call: update budget tracking - At phase transitions: check budget caps - Guard violations raise appropriate exceptions that surface to the user ## Acceptance Criteria - [ ] `check_guard()` called before each tool invocation in `ToolRunner` - [ ] `evaluate_guard()` called at plan phase transitions - [ ] Denylist violations raise `GuardViolationError` with clear message - [ ] Budget cap violations halt execution with cost summary - [ ] Tool call limit violations halt execution with count summary - [ ] BDD unit tests cover all guard enforcement scenarios - [ ] `nox -e typecheck` passes with no suppressions - [ ] Coverage >= 97% ## Dependencies - Blocked by: (none) - Blocks: #3370 ## Subtasks - [ ] Wire `check_guard()` into `ToolRunner.run()` before tool invocation - [ ] Wire `evaluate_guard()` into plan phase transition logic - [ ] Add `GuardViolationError` exception type if missing - [ ] Add BDD feature file for guard enforcement - [ ] Add step definitions for guard enforcement tests - [ ] Verify `nox` passes ## Definition of Done - [ ] All subtasks completed - [ ] Tests written and passing - [ ] All nox stages pass - [ ] Coverage >= 97% --- **Automated by CleverAgents Bot** Supervisor: Unknown | Agent: ca-epic-planner
freemo added this to the v3.6.0 milestone 2026-04-05 14:41:37 +00:00
Author
Owner

Issue triaged by project owner:

  • State: Verified
  • Priority: Critical — Guard enforcement is dead code per UAT findings (#3294, #3346). check_guard() and evaluate_guard() are implemented but never called. This means denylist, budget caps, and tool call limits are completely non-functional. This is a security and safety gap.
  • Milestone: v3.6.0 (already set)
  • Story Points: 8 — XL — Requires wiring guard checks into the tool execution pipeline, implementing guard result handling, tracking cost/calls state, and comprehensive test coverage for all guard evaluation paths. Estimated 2-4 days.
  • MoSCoW: Must Have — Guard enforcement is an explicit v3.5.0 acceptance criterion ("Guard enforcement works (denylist, budget caps, tool call limits)") that remains unmet. This is a blocking safety issue.
  • Parent Epic: #3370

Note: This issue overlaps significantly with #3346 (v3.5.0). Issue #3346 describes the same bug from a UAT perspective and is linked to Epic #397. This issue (#3372) was created as part of Epic #3370 planning. The implementation should close both issues. Recommend the implementer references both #3346 and #3372 in the PR.


Automated by CleverAgents Bot
Supervisor: Project Owner | Agent: ca-project-owner

Issue triaged by project owner: - **State**: Verified - **Priority**: Critical — Guard enforcement is dead code per UAT findings (#3294, #3346). `check_guard()` and `evaluate_guard()` are implemented but never called. This means denylist, budget caps, and tool call limits are completely non-functional. This is a security and safety gap. - **Milestone**: v3.6.0 (already set) - **Story Points**: 8 — XL — Requires wiring guard checks into the tool execution pipeline, implementing guard result handling, tracking cost/calls state, and comprehensive test coverage for all guard evaluation paths. Estimated 2-4 days. - **MoSCoW**: Must Have — Guard enforcement is an explicit v3.5.0 acceptance criterion ("Guard enforcement works (denylist, budget caps, tool call limits)") that remains unmet. This is a blocking safety issue. - **Parent Epic**: #3370 Note: This issue overlaps significantly with #3346 (v3.5.0). Issue #3346 describes the same bug from a UAT perspective and is linked to Epic #397. This issue (#3372) was created as part of Epic #3370 planning. The implementation should close both issues. Recommend the implementer references both #3346 and #3372 in the PR. --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: ca-project-owner
freemo removed this from the v3.6.0 milestone 2026-04-06 23:52:45 +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.

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