UAT: agents project delete JSON/YAML output missing deletion_summary, index_cleanup, backups sections; no active-plan guard #6314

Closed
opened 2026-04-09 20:09:30 +00:00 by HAL9000 · 0 comments
Owner

Summary

The agents project delete command has two distinct spec violations:

  1. Output format wrong: Non-rich output emits {deleted: "name", success: true} but the spec requires a structured envelope with deletion_summary, index_cleanup, and backups sub-objects.
  2. No active-plan guard: The implementation only checks for linked resources (not active plans) before deleting. The spec requires blocking delete when active plans exist and returning a structured error with delete_blocked and resolution fields (unless --force is used).

Spec References

  • Success output: docs/specification.md lines 3490–3543
  • Active-plan block error: docs/specification.md lines 3589–3638
  • Force-delete with plan cancellation: lines 3640+

Code Location

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

  • delete() command (lines 925–980)
  • Lines 955–960: guard only checks proj.linked_resources (linked resource count), not active plans
    if proj.linked_resources and not force:
        err_console.print(...)
        raise typer.Exit(1)
    
  • Lines 977–980: success output for non-rich path:
    console.print(format_output({"deleted": name, "success": True}, output_format))
    

Actual Behavior

Issue 1 — Wrong success output

Non-rich output:

{ "deleted": "local/docs", "success": true }

Spec requires:

{
  "command": "agents project delete local/docs",
  "status": "ok",
  "exit_code": 0,
  "data": {
    "deletion_summary": {
      "project": "local/docs",
      "resources_unlinked": 1,
      "data_dir": "/repos/docs/.cleveragents"
    },
    "index_cleanup": {
      "text_index": "cleared",
      "vectors": "240 removed",
      "graph_triples": "none",
      "storage_freed_mb": 12
    },
    "backups": {
      "snapshot": "/backups/local-docs-2026-02-08.tgz",
      "retention_days": 7
    }
  },
  "timing": { "duration_ms": 530 },
  "messages": [{ "level": "ok", "text": "Project deleted" }]
}

Issue 2 — Missing active-plan guard

The spec (lines 3545–3638) requires that deleting a project with active plans (without --force) returns exit_code 1 with:

{
  "status": "error",
  "data": {
    "delete_blocked": {
      "reason": "project has active plans",
      "active_plans": [...]
    },
    "resolution": [...]
  }
}

The current code only blocks on linked resources (line 955). No active-plan check exists. With --force, the spec requires cancelling active plans first (lines 3640+); current code simply calls repo.delete(name) unconditionally.

Steps to Reproduce

Inspect project.py lines 925–980 (delete command).

Expected vs Actual

Behavior Expected Actual
Success JSON deletion_summary + index_cleanup + backups {deleted, success}
Rich success output 3 panels (Deletion Summary / Index Cleanup / Backups) Single success line
Active plan guard Block unless --force Not implemented (only resource check)
Error JSON on block delete_blocked + resolution with plan list Not implemented
--force behavior Cancel active plans then delete Delete without cancelling

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

## Summary The `agents project delete` command has two distinct spec violations: 1. **Output format wrong**: Non-rich output emits `{deleted: "name", success: true}` but the spec requires a structured envelope with `deletion_summary`, `index_cleanup`, and `backups` sub-objects. 2. **No active-plan guard**: The implementation only checks for linked resources (not active plans) before deleting. The spec requires blocking delete when active plans exist and returning a structured error with `delete_blocked` and `resolution` fields (unless `--force` is used). ## Spec References - Success output: `docs/specification.md` lines 3490–3543 - Active-plan block error: `docs/specification.md` lines 3589–3638 - Force-delete with plan cancellation: lines 3640+ ## Code Location `src/cleveragents/cli/commands/project.py`: - `delete()` command (lines 925–980) - Lines 955–960: guard only checks `proj.linked_resources` (linked resource count), **not active plans** ```python if proj.linked_resources and not force: err_console.print(...) raise typer.Exit(1) ``` - Lines 977–980: success output for non-rich path: ```python console.print(format_output({"deleted": name, "success": True}, output_format)) ``` ## Actual Behavior ### Issue 1 — Wrong success output Non-rich output: ```json { "deleted": "local/docs", "success": true } ``` Spec requires: ```json { "command": "agents project delete local/docs", "status": "ok", "exit_code": 0, "data": { "deletion_summary": { "project": "local/docs", "resources_unlinked": 1, "data_dir": "/repos/docs/.cleveragents" }, "index_cleanup": { "text_index": "cleared", "vectors": "240 removed", "graph_triples": "none", "storage_freed_mb": 12 }, "backups": { "snapshot": "/backups/local-docs-2026-02-08.tgz", "retention_days": 7 } }, "timing": { "duration_ms": 530 }, "messages": [{ "level": "ok", "text": "Project deleted" }] } ``` ### Issue 2 — Missing active-plan guard The spec (lines 3545–3638) requires that deleting a project with active plans (without `--force`) returns exit_code 1 with: ```json { "status": "error", "data": { "delete_blocked": { "reason": "project has active plans", "active_plans": [...] }, "resolution": [...] } } ``` The current code only blocks on linked resources (line 955). No active-plan check exists. With `--force`, the spec requires cancelling active plans first (lines 3640+); current code simply calls `repo.delete(name)` unconditionally. ## Steps to Reproduce Inspect `project.py` lines 925–980 (delete command). ## Expected vs Actual | Behavior | Expected | Actual | |----------|----------|--------| | Success JSON | `deletion_summary + index_cleanup + backups` | `{deleted, success}` | | Rich success output | 3 panels (Deletion Summary / Index Cleanup / Backups) | Single success line | | Active plan guard | Block unless `--force` | Not implemented (only resource check) | | Error JSON on block | `delete_blocked + resolution` with plan list | Not implemented | | `--force` behavior | Cancel active plans then delete | Delete without cancelling | --- **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#6314
No description provided.