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

Open
opened 2026-04-06 07:10:24 +00:00 by freemo · 0 comments
Owner

Summary

The agents resource type add --update CLI command is documented to "Update if type already exists" but the implementation silently aborts with a yellow warning message instead of actually updating the resource type. The --update flag is effectively a no-op when the type already exists.

Metadata

  • Branch: fix/resource-type-add-update
  • Commit Message: fix(resource): implement --update flag for resource type add command
  • Milestone: N/A — backlog (see note below)
  • Parent Epic: #398

Subtasks

  • Implement actual update logic in type_add() when --update is passed and the type already exists
  • Add a update_type(name, config_path) method to ResourceRegistryService (or update the existing register_type to accept an update=True parameter)
  • The update should replace the existing type's fields with the new YAML config values (while preserving the built_in flag and rejecting updates to built-in types)
  • Add BDD scenario: agents resource type add --update --config ./my-type.yaml on an existing custom type updates the type definition

Definition of Done

  • agents resource type add --update --config <path> successfully updates an existing custom resource type
  • Attempting to update a built-in type with --update raises a clear error
  • Unit tests (Behave) cover the update path
  • All nox stages pass
  • Coverage >= 97%

Steps to Reproduce

Code location: src/cleveragents/cli/commands/resource.py, type_add() function

@type_app.command("add")
def type_add(config, update=False, ...):
    if update:
        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  # <-- silently aborts!
            raise
    else:
        spec = service.register_type(config)

Expected behavior:

$ agents resource type add --update --config ./my-type.yaml
Updated resource type: test/my-type

Actual behavior:

$ agents resource type add --update --config ./my-type.yaml
Resource type already exists. Update mode is not yet fully supported.
Aborted!

The command aborts with exit code 1 and the type is not updated.

Additional Context

  • The --update flag is listed in the CLI help text as "Update if type already exists" — users expect it to work
  • The register_type() method in ResourceRegistryService raises ValidationError with "already exists" when the type exists; an update path needs to be added
  • Compare with agents resource add --update which does implement the update (though via raw SQL — see issue #3872)
  • The --update flag for agents validation add is correctly implemented (calls service.update_tool())

Backlog note: This issue was discovered during autonomous operation
on milestone v3.6.0. It does not block milestone completion and has been
placed in the backlog for human review and future milestone assignment.


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


Automated by CleverAgents Bot
Supervisor: UAT Testing | Agent: ca-new-issue-creator

## Summary The `agents resource type add --update` CLI command is documented to "Update if type already exists" but the implementation silently aborts with a yellow warning message instead of actually updating the resource type. The `--update` flag is effectively a no-op when the type already exists. ## Metadata - **Branch**: `fix/resource-type-add-update` - **Commit Message**: `fix(resource): implement --update flag for resource type add command` - **Milestone**: N/A — backlog (see note below) - **Parent Epic**: #398 ## Subtasks - [ ] Implement actual update logic in `type_add()` when `--update` is passed and the type already exists - [ ] Add a `update_type(name, config_path)` method to `ResourceRegistryService` (or update the existing `register_type` to accept an `update=True` parameter) - [ ] The update should replace the existing type's fields with the new YAML config values (while preserving the `built_in` flag and rejecting updates to built-in types) - [ ] Add BDD scenario: `agents resource type add --update --config ./my-type.yaml` on an existing custom type updates the type definition ## Definition of Done - [ ] `agents resource type add --update --config <path>` successfully updates an existing custom resource type - [ ] Attempting to update a built-in type with `--update` raises a clear error - [ ] Unit tests (Behave) cover the update path - [ ] All nox stages pass - [ ] Coverage >= 97% ## Steps to Reproduce **Code location:** `src/cleveragents/cli/commands/resource.py`, `type_add()` function ```python @type_app.command("add") def type_add(config, update=False, ...): if update: 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 # <-- silently aborts! raise else: spec = service.register_type(config) ``` **Expected behavior:** ``` $ agents resource type add --update --config ./my-type.yaml Updated resource type: test/my-type ``` **Actual behavior:** ``` $ agents resource type add --update --config ./my-type.yaml Resource type already exists. Update mode is not yet fully supported. Aborted! ``` The command aborts with exit code 1 and the type is not updated. ## Additional Context - The `--update` flag is listed in the CLI help text as "Update if type already exists" — users expect it to work - The `register_type()` method in `ResourceRegistryService` raises `ValidationError` with "already exists" when the type exists; an update path needs to be added - Compare with `agents resource add --update` which does implement the update (though via raw SQL — see issue #3872) - The `--update` flag for `agents validation add` is correctly implemented (calls `service.update_tool()`) --- > **Backlog note:** This issue was discovered during autonomous operation > on milestone v3.6.0. It does not block milestone completion and has been > placed in the backlog for human review and future milestone assignment. --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-uat-tester --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-new-issue-creator
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.

Blocks
#398 Epic: Post-MVP Resources
cleveragents/cleveragents-core
Reference
cleveragents/cleveragents-core#3888
No description provided.