UAT: agents session delete non-rich output missing structured JSON/YAML — spec requires deletion_summary and cleanup keys #4876

Open
opened 2026-04-08 20:12:06 +00:00 by HAL9000 · 0 comments
Owner

Bug Report

Feature Area: Session Management — agents session delete
Severity: Medium
Found by: UAT tester, code analysis


What Was Tested

The agents session delete command's JSON/YAML output format was compared against the specification.

Expected Behavior (from spec)

Per docs/specification.md §agents session delete, the JSON output must include:

{
  "command": "agents session delete 01HXM2A6K1P2E9Q9D4GQ7J4S7Z",
  "status": "ok",
  "exit_code": 0,
  "data": {
    "deletion_summary": {
      "session": "01HXM2A6K1P2E9Q9D4GQ7J4S7Z",
      "id": "01HXM2A6K1P2E9Q9D4GQ7J4S7Z",
      "messages_removed": 6,
      "storage_freed": "18 KB",
      "plans_orphaned": 0
    },
    "cleanup": {
      "backups": "none",
      "logs": "preserved",
      "context": "cleared",
      "checkpoints": "none"
    }
  },
  "timing": { "duration_ms": 62 },
  "messages": [{ "level": "ok", "text": "Session deleted" }]
}

Actual Behavior

The delete command in src/cleveragents/cli/commands/session.py (lines 496–526):

if fmt == OutputFormat.RICH:
    # Rich output: render Deletion Summary and Cleanup panels
    ...
    console.print("[green]✓ OK[/green] Session deleted")
else:
    # Non-rich formats: simple message
    console.print(f"[green]✓ OK[/green] Session {session_id} deleted")

For non-rich formats (JSON, YAML, plain), the command only prints a plain text message like "✓ OK Session 01HXM2A6K1P2E9Q9D4GQ7J4S7Z deleted". It does not produce the structured deletion_summary and cleanup data blocks required by the spec.

Code Location

src/cleveragents/cli/commands/session.py, lines 496–526 (delete function, non-rich branch)

Steps to Reproduce

agents session delete --yes --format json <SESSION_ID>
# Actual output: "✓ OK Session <ID> deleted"  (plain text, not JSON)
# Expected output: structured JSON with deletion_summary and cleanup keys

Impact

  • agents session delete --format json does not produce valid JSON
  • Automation scripts that parse deletion output will fail
  • Inconsistent with the spec's documented JSON/YAML output format

Definition of Done

  • session delete --format json outputs valid JSON with deletion_summary and cleanup keys
  • session delete --format yaml outputs valid YAML with the same structure
  • session delete --format plain outputs human-readable text matching the spec
  • messages_removed reflects the actual count of messages deleted
  • storage_freed reflects actual storage freed (not hardcoded "0 KB")

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

## Bug Report **Feature Area:** Session Management — `agents session delete` **Severity:** Medium **Found by:** UAT tester, code analysis --- ### What Was Tested The `agents session delete` command's JSON/YAML output format was compared against the specification. ### Expected Behavior (from spec) Per `docs/specification.md` §`agents session delete`, the JSON output must include: ```json { "command": "agents session delete 01HXM2A6K1P2E9Q9D4GQ7J4S7Z", "status": "ok", "exit_code": 0, "data": { "deletion_summary": { "session": "01HXM2A6K1P2E9Q9D4GQ7J4S7Z", "id": "01HXM2A6K1P2E9Q9D4GQ7J4S7Z", "messages_removed": 6, "storage_freed": "18 KB", "plans_orphaned": 0 }, "cleanup": { "backups": "none", "logs": "preserved", "context": "cleared", "checkpoints": "none" } }, "timing": { "duration_ms": 62 }, "messages": [{ "level": "ok", "text": "Session deleted" }] } ``` ### Actual Behavior The `delete` command in `src/cleveragents/cli/commands/session.py` (lines 496–526): ```python if fmt == OutputFormat.RICH: # Rich output: render Deletion Summary and Cleanup panels ... console.print("[green]✓ OK[/green] Session deleted") else: # Non-rich formats: simple message console.print(f"[green]✓ OK[/green] Session {session_id} deleted") ``` For non-rich formats (JSON, YAML, plain), the command only prints a plain text message like `"✓ OK Session 01HXM2A6K1P2E9Q9D4GQ7J4S7Z deleted"`. It does **not** produce the structured `deletion_summary` and `cleanup` data blocks required by the spec. ### Code Location `src/cleveragents/cli/commands/session.py`, lines 496–526 (`delete` function, non-rich branch) ### Steps to Reproduce ```bash agents session delete --yes --format json <SESSION_ID> # Actual output: "✓ OK Session <ID> deleted" (plain text, not JSON) # Expected output: structured JSON with deletion_summary and cleanup keys ``` ### Impact - `agents session delete --format json` does not produce valid JSON - Automation scripts that parse deletion output will fail - Inconsistent with the spec's documented JSON/YAML output format ### Definition of Done - [ ] `session delete --format json` outputs valid JSON with `deletion_summary` and `cleanup` keys - [ ] `session delete --format yaml` outputs valid YAML with the same structure - [ ] `session delete --format plain` outputs human-readable text matching the spec - [ ] `messages_removed` reflects the actual count of messages deleted - [ ] `storage_freed` reflects actual storage freed (not hardcoded "0 KB") --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: uat-tester
HAL9000 added this to the v3.3.0 milestone 2026-04-08 20:17:19 +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.

Dependencies

No dependencies set.

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