UAT: agents actor remove Impact section always shows 0 affected sessions/plans (not computed) #3420

Closed
opened 2026-04-05 16:38:01 +00:00 by freemo · 2 comments
Owner

Metadata

  • Branch: fix/actor-remove-impact-computation
  • Commit Message: fix(cli): compute real impact counts in agents actor remove command
  • Milestone: (none — backlog)
  • Parent Epic: #392

Background

The agents actor remove command displays an "Impact" panel after removing an actor, but the impact values are hardcoded to 0 rather than being computed from actual data.

Code location: src/cleveragents/cli/commands/actor.py, remove() function, approximately lines 700–715

# Current (broken) implementation
impact_info = (
    "[yellow]Sessions:[/yellow] 0 affected\n"
    "[yellow]Active Plans:[/yellow] 0 affected\n"
    "[yellow]Actions Referencing:[/yellow] 0"
)
impact_panel = Panel(impact_info, title="Impact", border_style="yellow")
console.print(impact_panel)

The code even contains a comment acknowledging the problem:

"Note: Computing actual impact requires deep integration with session/plan subsystems. For now, display panels with conservative estimates (0 affected)"

Expected Behavior

Per the specification for agents actor remove:

"Active plans and actions referencing this actor will lose their actor binding. Check the Impact section in the output to verify no active plans or sessions are affected."

The Impact section must show real counts of:

  • Number of active sessions using this actor
  • Number of active plans referencing this actor
  • Number of actions configured to use this actor

Actual Behavior

Impact section always shows hardcoded 0 values regardless of actual impact, which:

  1. Misleads users into thinking removal is safe when it may not be
  2. Violates the spec's intent that users can "verify no active plans or sessions are affected"
  3. Makes the warning in the spec documentation meaningless

Steps to Reproduce

  1. Create an action that references an actor (e.g., local/my-actor as strategy_actor)
  2. Run agents actor remove local/my-actor
  3. Observe: Impact panel shows Sessions: 0 affected, Active Plans: 0 affected, Actions Referencing: 0
  4. Expected: Impact panel should show actual counts of sessions, plans, and actions that reference this actor

Subtasks

  • Write a TDD issue-capture BDD scenario (tagged @tdd_expected_fail) in features/ that demonstrates the bug — run agents actor remove with a pre-seeded actor referenced by a session, plan, and action, and assert the Impact panel shows non-zero counts
  • Implement DB queries in actor.py remove() to count active sessions referencing the actor
  • Implement DB queries in actor.py remove() to count active plans referencing the actor
  • Implement DB queries in actor.py remove() to count actions configured to use the actor
  • Replace hardcoded 0 values in impact_info with the computed counts
  • Remove the misleading comment about "conservative estimates"
  • Verify the TDD scenario now passes (flip @tdd_expected_fail to passing)
  • Ensure all nox stages pass

Definition of Done

  • TDD issue-capture Behave scenario written and initially failing, demonstrating the bug
  • Impact computation implemented — DB queries return real counts for sessions, active plans, and actions referencing the removed actor
  • Impact panel in agents actor remove output displays real counts (not hardcoded 0)
  • Hardcoded 0 values and misleading comment removed from actor.py
  • All nox stages pass (nox -e lint, nox -e typecheck, nox -e unit_tests, nox -e integration_tests)
  • Coverage >= 97%

Backlog note: This issue was discovered during autonomous operation
on milestone v3.2.0. It does not block milestone completion and has been
placed in the backlog for human review and future milestone assignment.


Automated by CleverAgents Bot
Supervisor: UAT Testing | Agent: ca-uat-tester

## Metadata - **Branch**: `fix/actor-remove-impact-computation` - **Commit Message**: `fix(cli): compute real impact counts in agents actor remove command` - **Milestone**: *(none — backlog)* - **Parent Epic**: #392 ## Background The `agents actor remove` command displays an "Impact" panel after removing an actor, but the impact values are hardcoded to `0` rather than being computed from actual data. **Code location**: `src/cleveragents/cli/commands/actor.py`, `remove()` function, approximately lines 700–715 ```python # Current (broken) implementation impact_info = ( "[yellow]Sessions:[/yellow] 0 affected\n" "[yellow]Active Plans:[/yellow] 0 affected\n" "[yellow]Actions Referencing:[/yellow] 0" ) impact_panel = Panel(impact_info, title="Impact", border_style="yellow") console.print(impact_panel) ``` The code even contains a comment acknowledging the problem: > "Note: Computing actual impact requires deep integration with session/plan subsystems. For now, display panels with conservative estimates (0 affected)" ## Expected Behavior Per the specification for `agents actor remove`: > "Active plans and actions referencing this actor will lose their actor binding. Check the **Impact** section in the output to verify no active plans or sessions are affected." The Impact section must show **real counts** of: - Number of active sessions using this actor - Number of active plans referencing this actor - Number of actions configured to use this actor ## Actual Behavior Impact section always shows hardcoded `0` values regardless of actual impact, which: 1. Misleads users into thinking removal is safe when it may not be 2. Violates the spec's intent that users can "verify no active plans or sessions are affected" 3. Makes the warning in the spec documentation meaningless ## Steps to Reproduce 1. Create an action that references an actor (e.g., `local/my-actor` as `strategy_actor`) 2. Run `agents actor remove local/my-actor` 3. **Observe**: Impact panel shows `Sessions: 0 affected`, `Active Plans: 0 affected`, `Actions Referencing: 0` 4. **Expected**: Impact panel should show actual counts of sessions, plans, and actions that reference this actor ## Subtasks - [ ] Write a TDD issue-capture BDD scenario (tagged `@tdd_expected_fail`) in `features/` that demonstrates the bug — run `agents actor remove` with a pre-seeded actor referenced by a session, plan, and action, and assert the Impact panel shows non-zero counts - [ ] Implement DB queries in `actor.py` `remove()` to count active sessions referencing the actor - [ ] Implement DB queries in `actor.py` `remove()` to count active plans referencing the actor - [ ] Implement DB queries in `actor.py` `remove()` to count actions configured to use the actor - [ ] Replace hardcoded `0` values in `impact_info` with the computed counts - [ ] Remove the misleading comment about "conservative estimates" - [ ] Verify the TDD scenario now passes (flip `@tdd_expected_fail` to passing) - [ ] Ensure all nox stages pass ## Definition of Done - [ ] TDD issue-capture Behave scenario written and initially failing, demonstrating the bug - [ ] Impact computation implemented — DB queries return real counts for sessions, active plans, and actions referencing the removed actor - [ ] Impact panel in `agents actor remove` output displays real counts (not hardcoded `0`) - [ ] Hardcoded `0` values and misleading comment removed from `actor.py` - [ ] All nox stages pass (`nox -e lint`, `nox -e typecheck`, `nox -e unit_tests`, `nox -e integration_tests`) - [ ] Coverage >= 97% --- > **Backlog note:** This issue was discovered during autonomous operation > on milestone v3.2.0. It does not block milestone completion and has been > placed in the backlog for human review and future milestone assignment. --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-uat-tester
Author
Owner

PR #3463 created on branch fix/actor-remove-impact-computation. I will monitor and handle all review feedback until merged.

Implementation summary:

  • Added _compute_actor_impact() helper in actor.py that queries sessions, lifecycle plans, and actions for real counts
  • Sessions: filtered by actor_name == removed_actor
  • Active Plans: filtered by processing_state in {queued, processing} AND actor referenced in strategy_actor or execution_actor
  • Actions: filtered by actor referenced in any actor field
  • Removed the misleading "conservative estimates" comment
  • Added BDD feature file and step definitions for the new behavior
  • Updated existing test step definitions to mock _compute_actor_impact

Quality gates passed: lint , typecheck


Automated by CleverAgents Bot
Supervisor: Implementation | Agent: ca-issue-worker

PR #3463 created on branch `fix/actor-remove-impact-computation`. I will monitor and handle all review feedback until merged. **Implementation summary:** - Added `_compute_actor_impact()` helper in `actor.py` that queries sessions, lifecycle plans, and actions for real counts - Sessions: filtered by `actor_name == removed_actor` - Active Plans: filtered by `processing_state in {queued, processing}` AND actor referenced in `strategy_actor` or `execution_actor` - Actions: filtered by actor referenced in any actor field - Removed the misleading "conservative estimates" comment - Added BDD feature file and step definitions for the new behavior - Updated existing test step definitions to mock `_compute_actor_impact` **Quality gates passed:** lint ✅, typecheck ✅ --- **Automated by CleverAgents Bot** Supervisor: Implementation | Agent: ca-issue-worker
Author
Owner

PR #3463 has been merged successfully! 🎉

Summary:

  • Implementation: _compute_actor_impact() helper added to actor.py
  • Sessions: queried via session_service.list() filtered by actor_name
  • Active Plans: queried via lifecycle_plans.list_plans() filtered by processing_state in {queued, processing} and actor fields
  • Actions: queried via plan_lifecycle_service.list_actions() filtered by any actor field
  • Hardcoded 0 values and misleading comment removed
  • BDD feature file and step definitions added
  • Existing tests updated to mock _compute_actor_impact

Quality gates verified locally:

  • nox -e lint
  • nox -e typecheck

Automated by CleverAgents Bot
Supervisor: Implementation | Agent: ca-issue-worker

PR #3463 has been merged successfully! 🎉 **Summary:** - Implementation: `_compute_actor_impact()` helper added to `actor.py` - Sessions: queried via `session_service.list()` filtered by `actor_name` - Active Plans: queried via `lifecycle_plans.list_plans()` filtered by `processing_state in {queued, processing}` and actor fields - Actions: queried via `plan_lifecycle_service.list_actions()` filtered by any actor field - Hardcoded `0` values and misleading comment removed - BDD feature file and step definitions added - Existing tests updated to mock `_compute_actor_impact` **Quality gates verified locally:** - `nox -e lint` ✅ - `nox -e typecheck` ✅ --- **Automated by CleverAgents Bot** Supervisor: Implementation | Agent: ca-issue-worker
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.

Blocks
#392 Epic: Actor YAML & Compiler
cleveragents/cleveragents-core
Reference
cleveragents/cleveragents-core#3420
No description provided.