UAT: agents resource type add --update silently aborts instead of updating the existing type #4639

Open
opened 2026-04-08 17:40:51 +00:00 by HAL9000 · 0 comments
Owner

Bug Report

Feature Area: Resource registry — agents resource type add --update
Severity: Medium — --update flag is documented but non-functional
Discovered by: UAT worker uat-worker-resource-registry-001


What Was Tested

The --update flag behavior of agents resource type add.

Expected Behavior (from spec)

Per the specification (line 9891):

--update: If the type name already exists, overwrite it. Without this flag, adding a duplicate name fails with an error.

The --update flag should allow re-registering an existing custom type with new configuration, replacing the old definition.

Actual Behavior

The implementation in src/cleveragents/cli/commands/resource.py (lines 386–403) has a broken --update path:

if update:
    # Try to register; if it already exists, show a message
    try:
        spec = service.register_type(config)
    except ValidationError as exc:
        if "already exists" in str(exc):
            console.print(
                "[yellow]Resource type already exists. "
                "Update mode is not yet fully supported.[/yellow]"
            )
            raise typer.Abort() from exc
        raise

When --update is passed and the type already exists:

  1. service.register_type(config) raises ValidationError with "already exists"
  2. The code catches it and prints "Update mode is not yet fully supported."
  3. It then calls raise typer.Abort()aborting the command

So --update does not update anything — it just prints a warning and aborts. The user gets no update, and the command exits non-zero.

Code Location

src/cleveragents/cli/commands/resource.py, lines 386–403 (the type_add command's --update branch)

Fix Required

Implement the --update path properly:

  1. Check if the type already exists
  2. If it does and --update is set, remove the old type and re-register with the new config
  3. Or implement an update_type() method in ResourceRegistryService that updates the existing DB row

Example fix:

if update:
    try:
        existing = service.show_type(spec_name)
        service.remove_type(spec_name)  # Remove old definition
    except NotFoundError:
        pass  # Type doesn't exist yet — proceed with normal add
    spec = service.register_type(config)

Note: The remove_type guard for subtypes (ADR-042 Rule 5) should be bypassed or handled carefully during --update to avoid blocking updates to parent types.

Impact

  • Users who want to update a custom resource type definition must manually remove it first with agents resource type remove, then re-add it
  • The --update flag is documented in the spec but silently fails with a non-zero exit code
  • CI/CD scripts that use agents resource type add --update to keep type definitions current will fail

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

## Bug Report **Feature Area:** Resource registry — `agents resource type add --update` **Severity:** Medium — `--update` flag is documented but non-functional **Discovered by:** UAT worker uat-worker-resource-registry-001 --- ## What Was Tested The `--update` flag behavior of `agents resource type add`. ## Expected Behavior (from spec) Per the specification (line 9891): > `--update`: If the type name already exists, overwrite it. Without this flag, adding a duplicate name fails with an error. The `--update` flag should allow re-registering an existing custom type with new configuration, replacing the old definition. ## Actual Behavior The implementation in `src/cleveragents/cli/commands/resource.py` (lines 386–403) has a broken `--update` path: ```python if update: # Try to register; if it already exists, show a message try: spec = service.register_type(config) except ValidationError as exc: if "already exists" in str(exc): console.print( "[yellow]Resource type already exists. " "Update mode is not yet fully supported.[/yellow]" ) raise typer.Abort() from exc raise ``` When `--update` is passed and the type already exists: 1. `service.register_type(config)` raises `ValidationError` with "already exists" 2. The code catches it and prints `"Update mode is not yet fully supported."` 3. It then calls `raise typer.Abort()` — **aborting the command** So `--update` does not update anything — it just prints a warning and aborts. The user gets no update, and the command exits non-zero. ## Code Location `src/cleveragents/cli/commands/resource.py`, lines 386–403 (the `type_add` command's `--update` branch) ## Fix Required Implement the `--update` path properly: 1. Check if the type already exists 2. If it does and `--update` is set, remove the old type and re-register with the new config 3. Or implement an `update_type()` method in `ResourceRegistryService` that updates the existing DB row Example fix: ```python if update: try: existing = service.show_type(spec_name) service.remove_type(spec_name) # Remove old definition except NotFoundError: pass # Type doesn't exist yet — proceed with normal add spec = service.register_type(config) ``` Note: The `remove_type` guard for subtypes (ADR-042 Rule 5) should be bypassed or handled carefully during `--update` to avoid blocking updates to parent types. ## Impact - Users who want to update a custom resource type definition must manually remove it first with `agents resource type remove`, then re-add it - The `--update` flag is documented in the spec but silently fails with a non-zero exit code - CI/CD scripts that use `agents resource type add --update` to keep type definitions current will fail --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: uat-tester
HAL9000 added this to the v3.5.0 milestone 2026-04-08 17:54:04 +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#4639
No description provided.