UAT: agents actor remove Cleanup panel always shows 0 orphaned contexts — not computing actual orphaned context count #3800

Open
opened 2026-04-06 06:25:36 +00:00 by freemo · 0 comments
Owner

Metadata

  • Branch: fix/actor-remove-orphaned-context-count
  • Commit Message: fix(cli): compute actual orphaned context count in actor remove cleanup panel
  • Milestone: (none — see backlog note below)
  • Parent Epic: #392

Summary

The agents actor remove command's Cleanup panel always displays 0 orphaned for the Contexts field, regardless of how many actor contexts actually exist. The implementation hardcodes this value instead of computing it.

Specification

Per docs/specification.md lines 5300-5303, the Cleanup panel should show the actual count of orphaned contexts:

╭─ Cleanup ──────────────╮
│ Config: kept on disk   │
│ Contexts: 1 orphaned   │
╰────────────────────────╯

The spec shows Contexts: 1 orphaned — meaning the system should count how many actor contexts become orphaned when the actor is removed.

Actual Behavior

In src/cleveragents/cli/commands/actor.py, the remove() command hardcodes the cleanup info:

cleanup_info = (
    "[blue]Config:[/blue] kept on disk\n[blue]Contexts:[/blue] 0 orphaned"
)

The value 0 orphaned is always hardcoded, never computed from actual context data.

Expected Behavior

The remove() command should:

  1. Query the context storage for contexts associated with the actor being removed
  2. Count how many contexts will become orphaned
  3. Display the actual count in the Cleanup panel

Impact

  • Operators cannot see how many contexts will be orphaned when removing an actor
  • The cleanup panel provides misleading information (always shows 0)
  • Users may not realize they have orphaned context data after actor removal

Steps to Reproduce

  1. Register an actor: agents actor add local/my-actor --config ./my-actor.yaml
  2. Create some contexts for the actor: agents actor context ...
  3. Remove the actor: agents actor remove local/my-actor
  4. Observe: Cleanup panel shows Contexts: 0 orphaned even though contexts exist

Code Location

src/cleveragents/cli/commands/actor.py:

  • remove() function — cleanup_info variable hardcodes 0 orphaned
  • _compute_actor_impact() function — computes session/plan/action counts but NOT context counts

Subtasks

  • Add context count computation to _compute_actor_impact() or a new helper
  • Query actor contexts associated with the actor name before removal
  • Display the actual orphaned context count in the Cleanup panel
  • Add Behave BDD unit test scenario for context count computation
  • Add Robot Framework integration test verifying the displayed count matches actual contexts
  • Ensure nox -e typecheck passes (no # type: ignore suppressions)
  • Ensure nox -e lint passes
  • Ensure nox -e unit_tests and nox -e integration_tests pass
  • Verify nox -e coverage_report reports coverage ≥ 97%

Definition of Done

  • agents actor remove <NAME> shows the actual count of orphaned contexts
  • The count is computed by querying actual context storage
  • Tests verify the count is accurate (Behave unit + Robot integration)
  • All nox stages pass
  • 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-new-issue-creator

## Metadata - **Branch**: `fix/actor-remove-orphaned-context-count` - **Commit Message**: `fix(cli): compute actual orphaned context count in actor remove cleanup panel` - **Milestone**: *(none — see backlog note below)* - **Parent Epic**: #392 ## Summary The `agents actor remove` command's Cleanup panel always displays `0 orphaned` for the Contexts field, regardless of how many actor contexts actually exist. The implementation hardcodes this value instead of computing it. ## Specification Per `docs/specification.md` lines 5300-5303, the Cleanup panel should show the actual count of orphaned contexts: ``` ╭─ Cleanup ──────────────╮ │ Config: kept on disk │ │ Contexts: 1 orphaned │ ╰────────────────────────╯ ``` The spec shows `Contexts: 1 orphaned` — meaning the system should count how many actor contexts become orphaned when the actor is removed. ## Actual Behavior In `src/cleveragents/cli/commands/actor.py`, the `remove()` command hardcodes the cleanup info: ```python cleanup_info = ( "[blue]Config:[/blue] kept on disk\n[blue]Contexts:[/blue] 0 orphaned" ) ``` The value `0 orphaned` is always hardcoded, never computed from actual context data. ## Expected Behavior The `remove()` command should: 1. Query the context storage for contexts associated with the actor being removed 2. Count how many contexts will become orphaned 3. Display the actual count in the Cleanup panel ## Impact - Operators cannot see how many contexts will be orphaned when removing an actor - The cleanup panel provides misleading information (always shows 0) - Users may not realize they have orphaned context data after actor removal ## Steps to Reproduce 1. Register an actor: `agents actor add local/my-actor --config ./my-actor.yaml` 2. Create some contexts for the actor: `agents actor context ...` 3. Remove the actor: `agents actor remove local/my-actor` 4. Observe: Cleanup panel shows `Contexts: 0 orphaned` even though contexts exist ## Code Location `src/cleveragents/cli/commands/actor.py`: - `remove()` function — `cleanup_info` variable hardcodes `0 orphaned` - `_compute_actor_impact()` function — computes session/plan/action counts but NOT context counts ## Subtasks - [ ] Add context count computation to `_compute_actor_impact()` or a new helper - [ ] Query actor contexts associated with the actor name before removal - [ ] Display the actual orphaned context count in the Cleanup panel - [ ] Add Behave BDD unit test scenario for context count computation - [ ] Add Robot Framework integration test verifying the displayed count matches actual contexts - [ ] Ensure `nox -e typecheck` passes (no `# type: ignore` suppressions) - [ ] Ensure `nox -e lint` passes - [ ] Ensure `nox -e unit_tests` and `nox -e integration_tests` pass - [ ] Verify `nox -e coverage_report` reports coverage ≥ 97% ## Definition of Done - [ ] `agents actor remove <NAME>` shows the actual count of orphaned contexts - [ ] The count is computed by querying actual context storage - [ ] Tests verify the count is accurate (Behave unit + Robot integration) - All nox stages pass - 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-new-issue-creator
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#3800
No description provided.