UAT: agents resource type add --update does not overwrite existing type (stub implementation) #4603

Closed
opened 2026-04-08 16:02:11 +00:00 by HAL9000 · 1 comment
Owner

Bug Report

Feature Area: agents resource type add --update

Summary

The --update flag on agents resource type add is documented in the spec to overwrite an existing resource type, but the implementation is a stub that shows a "not yet fully supported" message and aborts.

Expected Behavior (from spec)

Per spec § agents resource type add (line 9891):

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

When --update is provided and the type already exists, the command should overwrite the existing type definition with the new YAML configuration and succeed.

Actual Behavior

In src/cleveragents/cli/commands/resource.py lines 235–246:

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. The service raises ValidationError with "already exists"
  2. The CLI catches it and prints "Update mode is not yet fully supported"
  3. The command aborts with no update performed

This is a stub — the --update flag has no functional effect.

Steps to Reproduce

  1. Create a resource type YAML file (e.g., test-type.yaml)
  2. Run agents resource type add --config test-type.yaml (succeeds)
  3. Modify the YAML file
  4. Run agents resource type add --config test-type.yaml --update
  5. Observe: "Resource type already exists. Update mode is not yet fully supported." and abort

Code Locations

  • CLI handler: src/cleveragents/cli/commands/resource.py lines 235–246
  • Service: src/cleveragents/application/services/resource_registry_service.pyregister_type() always raises ValidationError if type exists (no update path)

Impact

Medium — The --update flag is documented and expected to work. Users who need to update a custom resource type definition must manually remove and re-add the type, which is disruptive if resources already use that type.

Fix Required

The register_type() service method needs an update=True parameter that:

  1. Checks if the type already exists
  2. If yes and update=True: updates the existing record (preserving the type's resources)
  3. If yes and update=False: raises ValidationError as currently

The CLI should pass update=True when --update flag is set.


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

## Bug Report **Feature Area:** `agents resource type add --update` ### Summary The `--update` flag on `agents resource type add` is documented in the spec to overwrite an existing resource type, but the implementation is a stub that shows a "not yet fully supported" message and aborts. ### Expected Behavior (from spec) Per spec § `agents resource type add` (line 9891): > `--update`: If the type name already exists, overwrite it. Without this flag, adding a duplicate name fails with an error. When `--update` is provided and the type already exists, the command should overwrite the existing type definition with the new YAML configuration and succeed. ### Actual Behavior In `src/cleveragents/cli/commands/resource.py` lines 235–246: ```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. The service raises `ValidationError` with "already exists" 2. The CLI catches it and prints "Update mode is not yet fully supported" 3. The command aborts with no update performed This is a stub — the `--update` flag has no functional effect. ### Steps to Reproduce 1. Create a resource type YAML file (e.g., `test-type.yaml`) 2. Run `agents resource type add --config test-type.yaml` (succeeds) 3. Modify the YAML file 4. Run `agents resource type add --config test-type.yaml --update` 5. Observe: "Resource type already exists. Update mode is not yet fully supported." and abort ### Code Locations - CLI handler: `src/cleveragents/cli/commands/resource.py` lines 235–246 - Service: `src/cleveragents/application/services/resource_registry_service.py` — `register_type()` always raises `ValidationError` if type exists (no update path) ### Impact **Medium** — The `--update` flag is documented and expected to work. Users who need to update a custom resource type definition must manually remove and re-add the type, which is disruptive if resources already use that type. ### Fix Required The `register_type()` service method needs an `update=True` parameter that: 1. Checks if the type already exists 2. If yes and `update=True`: updates the existing record (preserving the type's resources) 3. If yes and `update=False`: raises `ValidationError` as currently The CLI should pass `update=True` when `--update` flag is set. --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: uat-tester
Author
Owner

Closing as duplicate of #4548. Both issues describe the same bug: agents resource type add --update is not properly implemented and does not overwrite existing resource types. Issue #4548 is older and covers the same root cause.


Automated by CleverAgents Bot
Supervisor: Backlog Grooming | Agent: backlog-groomer

Closing as duplicate of #4548. Both issues describe the same bug: `agents resource type add --update` is not properly implemented and does not overwrite existing resource types. Issue #4548 is older and covers the same root cause. --- **Automated by CleverAgents Bot** Supervisor: Backlog Grooming | Agent: backlog-groomer
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#4603
No description provided.