UAT: agents resource remove blocks deletion when edges exist instead of cascade-deleting auto-discovered children #6468

Open
opened 2026-04-09 21:07:22 +00:00 by HAL9000 · 0 comments
Owner

Bug Report

Feature Area

Resource System — agents resource remove cascade deletion

Spec Reference

docs/specification.md §10949–10994 (agents resource remove)

From spec §10953–10954:

!!! danger "Cascading Deletion"
Removes a registered resource ==and all its auto-discovered child resources==. A git-checkout resource can have hundreds of child resources (files, directories). This operation fails if the resource is linked to any project — use agents project unlink-resource first.

From spec §10970–10977 (expected output):

╭─ Resource Removed ──────────────────────────────────╮
│ Name: local/api-repo                                │
│ Type: git-checkout                                  │
│ Children Removed: 395                               │
│ Projects Unlinked: 0                                │
╰─────────────────────────────────────────────────────╯
✓ OK Resource removed

From spec JSON output (§11000–11011):

{
  "command": "resource remove",
  "data": {
    "name": "local/api-repo",
    "type": "git-checkout",
    "children_removed": 395,
    "projects_unlinked": 0
  }
}

Expected Behavior (from spec)

  1. agents resource remove local/my-repo should cascade-delete all auto-discovered child resources
  2. The output should show Children Removed: N (count of deleted children)
  3. The operation should only fail if the resource is linked to a project (not if it has DAG edges)
  4. The JSON output should include children_removed and projects_unlinked fields

Actual Behavior

The current implementation in src/cleveragents/cli/commands/resource.py (lines 1345–1428):

  1. Blocks removal if ANY edges exist — checks edge_count > 0 and refuses to delete:

    if edge_count > 0:
        console.print(
            f"[red]Cannot remove resource '{res.name or res.resource_id}': "
            f"{edge_count} edge(s) still reference it.[/red]"
        )
        raise typer.Abort()
    

    This is wrong — the spec says to cascade-delete children, not block on edges.

  2. No cascade deletion — only deletes the single resource row, not its children

  3. No children_removed or projects_unlinked in output — the success message is just Removed resource: <name>

  4. Wrong failure condition — should fail only if linked to a project, not if it has DAG edges

Steps to Reproduce

  1. Add a resource with children (or manually create a DAG edge):
    agents resource add git-checkout local/test --path /app
    agents resource link-child local/test local/my-repo
    agents resource remove --yes local/test
    
  2. Observe: Cannot remove resource 'local/test': 1 edge(s) still reference it.
  3. Expected: cascade-delete local/test and all its auto-discovered children

Code Location

  • src/cleveragents/cli/commands/resource.py lines 1345–1428: resource_remove() — wrong edge check, no cascade
  • Lines 1384–1398: Edge count check that blocks deletion instead of cascading

Severity

High — The resource remove command has the wrong behavior. It blocks deletion when it should cascade, and doesn't cascade-delete children as the spec requires. This means users cannot remove resources that have any DAG relationships, even if those relationships are auto-discovered children that should be cleaned up automatically.


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

## Bug Report ### Feature Area Resource System — `agents resource remove` cascade deletion ### Spec Reference `docs/specification.md` §10949–10994 (`agents resource remove`) From spec §10953–10954: > !!! danger "Cascading Deletion" > Removes a registered resource ==and all its auto-discovered child resources==. A `git-checkout` resource can have hundreds of child resources (files, directories). This operation fails if the resource is linked to any project — use `agents project unlink-resource` first. From spec §10970–10977 (expected output): ``` ╭─ Resource Removed ──────────────────────────────────╮ │ Name: local/api-repo │ │ Type: git-checkout │ │ Children Removed: 395 │ │ Projects Unlinked: 0 │ ╰─────────────────────────────────────────────────────╯ ✓ OK Resource removed ``` From spec JSON output (§11000–11011): ```json { "command": "resource remove", "data": { "name": "local/api-repo", "type": "git-checkout", "children_removed": 395, "projects_unlinked": 0 } } ``` ### Expected Behavior (from spec) 1. `agents resource remove local/my-repo` should cascade-delete all auto-discovered child resources 2. The output should show `Children Removed: N` (count of deleted children) 3. The operation should **only fail** if the resource is linked to a project (not if it has DAG edges) 4. The JSON output should include `children_removed` and `projects_unlinked` fields ### Actual Behavior The current implementation in `src/cleveragents/cli/commands/resource.py` (lines 1345–1428): 1. **Blocks removal if ANY edges exist** — checks `edge_count > 0` and refuses to delete: ```python if edge_count > 0: console.print( f"[red]Cannot remove resource '{res.name or res.resource_id}': " f"{edge_count} edge(s) still reference it.[/red]" ) raise typer.Abort() ``` This is wrong — the spec says to cascade-delete children, not block on edges. 2. **No cascade deletion** — only deletes the single resource row, not its children 3. **No `children_removed` or `projects_unlinked` in output** — the success message is just `Removed resource: <name>` 4. **Wrong failure condition** — should fail only if linked to a project, not if it has DAG edges ### Steps to Reproduce 1. Add a resource with children (or manually create a DAG edge): ```bash agents resource add git-checkout local/test --path /app agents resource link-child local/test local/my-repo agents resource remove --yes local/test ``` 2. Observe: `Cannot remove resource 'local/test': 1 edge(s) still reference it.` 3. Expected: cascade-delete `local/test` and all its auto-discovered children ### Code Location - `src/cleveragents/cli/commands/resource.py` lines 1345–1428: `resource_remove()` — wrong edge check, no cascade - Lines 1384–1398: Edge count check that blocks deletion instead of cascading ### Severity **High** — The `resource remove` command has the wrong behavior. It blocks deletion when it should cascade, and doesn't cascade-delete children as the spec requires. This means users cannot remove resources that have any DAG relationships, even if those relationships are auto-discovered children that should be cleaned up automatically. --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: uat-tester
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#6468
No description provided.