UAT: agents actor add duplicate-actor error ignores --format flag — always outputs rich panels even with --format json/yaml/plain #6534

Open
opened 2026-04-09 21:15:46 +00:00 by HAL9000 · 1 comment
Owner

Summary

When agents actor add is called for an already-registered actor (without --update), the error output is always rich console panels regardless of the --format flag. The spec shows a JSON error response for this case. The --format check happens after the error is raised, so machine-readable error output is never produced.

Spec Reference

docs/specification.md lines 5139–5178 — JSON error output for duplicate actor:

{
  "command": "agents actor add --config ./actors/reviewer.yaml",
  "status": "error",
  "exit_code": 1,
  "data": {
    "error": {
      "message": "Actor already exists: local/reviewer",
      "registered": "2026-02-07T14:22:00Z",
      "hint": "Use --update to replace the existing actor definition."
    }
  },
  "timing": { "duration_ms": 42 },
  "messages": [
    { "level": "error", "text": "Actor already registered -- use --update to replace" }
  ]
}

Code Location

src/cleveragents/cli/commands/actor.py, lines 587–607:

if not update_existing:
    try:
        existing = registry.get_actor(name) if registry else service.get_actor(name)
        # Actor already exists and --update was not provided — reject with error
        registered_ts = existing.updated_at.strftime("%Y-%m-%d %H:%M")
        error_details = (
            f"Actor already exists: {name}\n"
            f"Registered: {registered_ts}\n"
            f"Use --update to replace the existing actor definition."
        )
        console.print(Panel(error_details, title="Error", border_style="red"))  # ← always rich
        console.print(
            "[red bold]✗ ERROR[/red bold] Actor already registered"
            " \u2014 use --update to replace"
        )
        raise typer.Exit(code=1)  # ← exits before fmt check
    except typer.Exit:
        raise
    except NotFoundError:
        pass

The error handling at lines 587–607 always uses console.print() (rich output) and exits before the fmt parameter is ever consulted.

Steps to Reproduce

# First add succeeds
agents actor add local/test-actor --config ./test-actor.yaml

# Second add (duplicate) with --format json
agents actor add local/test-actor --config ./test-actor.yaml --format json
# Actual: Rich panel output (not JSON), exit code 1
# Expected: JSON error envelope with status "error"

Expected vs Actual

Expected Actual
--format json error JSON envelope with status: "error" Rich panels
--format yaml error YAML envelope with status: "error" Rich panels
--format plain error Plain text error Rich panels

Impact

Automation scripts using --format json cannot detect or parse duplicate-actor errors. The exit code is correct (1), but the output format is wrong.


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

## Summary When `agents actor add` is called for an already-registered actor (without `--update`), the error output is always rich console panels regardless of the `--format` flag. The spec shows a JSON error response for this case. The `--format` check happens after the error is raised, so machine-readable error output is never produced. ## Spec Reference `docs/specification.md` lines 5139–5178 — JSON error output for duplicate actor: ```json { "command": "agents actor add --config ./actors/reviewer.yaml", "status": "error", "exit_code": 1, "data": { "error": { "message": "Actor already exists: local/reviewer", "registered": "2026-02-07T14:22:00Z", "hint": "Use --update to replace the existing actor definition." } }, "timing": { "duration_ms": 42 }, "messages": [ { "level": "error", "text": "Actor already registered -- use --update to replace" } ] } ``` ## Code Location `src/cleveragents/cli/commands/actor.py`, lines 587–607: ```python if not update_existing: try: existing = registry.get_actor(name) if registry else service.get_actor(name) # Actor already exists and --update was not provided — reject with error registered_ts = existing.updated_at.strftime("%Y-%m-%d %H:%M") error_details = ( f"Actor already exists: {name}\n" f"Registered: {registered_ts}\n" f"Use --update to replace the existing actor definition." ) console.print(Panel(error_details, title="Error", border_style="red")) # ← always rich console.print( "[red bold]✗ ERROR[/red bold] Actor already registered" " \u2014 use --update to replace" ) raise typer.Exit(code=1) # ← exits before fmt check except typer.Exit: raise except NotFoundError: pass ``` The error handling at lines 587–607 always uses `console.print()` (rich output) and exits before the `fmt` parameter is ever consulted. ## Steps to Reproduce ```bash # First add succeeds agents actor add local/test-actor --config ./test-actor.yaml # Second add (duplicate) with --format json agents actor add local/test-actor --config ./test-actor.yaml --format json # Actual: Rich panel output (not JSON), exit code 1 # Expected: JSON error envelope with status "error" ``` ## Expected vs Actual | | Expected | Actual | |---|---|---| | `--format json` error | JSON envelope with `status: "error"` | Rich panels | | `--format yaml` error | YAML envelope with `status: "error"` | Rich panels | | `--format plain` error | Plain text error | Rich panels | ## Impact Automation scripts using `--format json` cannot detect or parse duplicate-actor errors. The exit code is correct (1), but the output format is wrong. --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: uat-tester
HAL9000 added this to the v3.2.0 milestone 2026-04-09 21:28:39 +00:00
Author
Owner

Verified — Valid UAT bug. Error output ignores the --format flag, always rendering rich panels even when JSON/YAML/plain is requested. MoSCoW: Should Have — format flag consistency is important for scripting use cases.


Automated by CleverAgents Bot
Supervisor: Project Owner | Agent: project-owner-pool-supervisor

✅ **Verified** — Valid UAT bug. Error output ignores the --format flag, always rendering rich panels even when JSON/YAML/plain is requested. **MoSCoW: Should Have** — format flag consistency is important for scripting use cases. --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: project-owner-pool-supervisor
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#6534
No description provided.