UAT: agents validation add --update silently overwrites a plain Tool with a Validation, violating shared namespace conflict rules #4505

Open
opened 2026-04-08 13:55:47 +00:00 by HAL9000 · 1 comment
Owner

Metadata

  • Branch: fix/validation-add-update-type-conflict
  • Commit Message: fix(cli): enforce type conflict check in validation add --update command
  • Milestone: Backlog
  • Parent Epic: #4182

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


Bug Report

Feature Area: Validation CLI — agents validation add --update type conflict enforcement

Expected Behavior (from spec)

The spec (Core Concepts > Validation > Relationship to Tool) states:

"Attempting to register a Validation with a name already taken by a plain Tool (or vice versa) results in a conflict error. This shared namespace enables unified management."

And:

"Attempting to register a Validation with a name already taken by a plain Tool (or vice versa) results in a conflict error."

This means agents validation add --update should fail with a conflict error if the existing entry with the same name is a plain Tool (not a Validation).

Actual Behavior

The agents validation add --update command in src/cleveragents/cli/commands/validation.py (add() function) does NOT check the type of the existing entry before updating:

if update:
    existing = service.get_tool(validation.name)
    if existing is not None:
        registered = service.update_tool(validation)  # No type check!
        _print_validation(registered, title="Validation Updated", fmt=fmt)
        return

If a plain Tool named local/my-tool exists and a user runs agents validation add --update --config ./my-validation.yaml (where the YAML has name: local/my-tool), the command will silently overwrite the plain Tool with a Validation, violating the spec's namespace conflict rules.

Code Location

src/cleveragents/cli/commands/validation.pyadd() function, the --update branch.

Impact

Users can accidentally overwrite plain Tools with Validations (or vice versa) using the --update flag. The spec explicitly requires a conflict error in this case. This could cause unexpected behavior in downstream systems that rely on the tool type discriminator.

Steps to Reproduce

  1. Register a plain tool: agents tool add --config ./my-tool.yaml (where name: local/my-tool)
  2. Create a validation YAML with the same name: name: local/my-tool
  3. Run: agents validation add --update --config ./my-validation.yaml
  4. Observe the command succeeds, silently overwriting the plain Tool with a Validation

Fix

Add a type check in the --update branch:

if update:
    existing = service.get_tool(validation.name)
    if existing is not None:
        # Check that the existing entry is a Validation, not a plain Tool
        existing_type = (
            existing.get("tool_type", "tool") 
            if isinstance(existing, dict) 
            else getattr(existing, "tool_type", "tool")
        )
        if str(existing_type) != "validation":
            console.print(
                f"[red]Conflict error:[/red] '{validation.name}' is registered as a "
                f"plain Tool. Cannot overwrite a Tool with a Validation."
            )
            raise typer.Abort()
        registered = service.update_tool(validation)
        _print_validation(registered, title="Validation Updated", fmt=fmt)
        return

Subtasks

  • Add type check in validation.py add() function --update branch to detect plain Tool vs Validation conflict
  • Return a clear conflict error message when a plain Tool name collision is detected
  • Write unit/behave tests covering the conflict scenario (plain Tool exists, --update with same name as Validation)
  • Verify the symmetric case: agents tool add --update should also fail if the existing entry is a Validation

Definition of Done

  • agents validation add --update raises a conflict error when the existing entry is a plain Tool
  • Error message clearly identifies the conflict and the offending name
  • Symmetric enforcement verified for agents tool add --update against existing Validations
  • Unit tests cover the conflict scenario
  • All nox stages pass
  • Coverage >= 97%

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

## Metadata - **Branch**: `fix/validation-add-update-type-conflict` - **Commit Message**: `fix(cli): enforce type conflict check in validation add --update command` - **Milestone**: Backlog - **Parent Epic**: #4182 > **Backlog note:** This issue was discovered during autonomous operation on milestone (UAT Testing). It does not block milestone completion and has been placed in the backlog for human review and future milestone assignment. --- ## Bug Report **Feature Area:** Validation CLI — `agents validation add --update` type conflict enforcement ### Expected Behavior (from spec) The spec (Core Concepts > Validation > Relationship to Tool) states: > "Attempting to register a Validation with a name already taken by a plain Tool (or vice versa) results in a conflict error. This shared namespace enables unified management." And: > "Attempting to register a Validation with a name already taken by a plain Tool (or vice versa) results in a conflict error." This means `agents validation add --update` should fail with a conflict error if the existing entry with the same name is a plain Tool (not a Validation). ### Actual Behavior The `agents validation add --update` command in `src/cleveragents/cli/commands/validation.py` (`add()` function) does NOT check the type of the existing entry before updating: ```python if update: existing = service.get_tool(validation.name) if existing is not None: registered = service.update_tool(validation) # No type check! _print_validation(registered, title="Validation Updated", fmt=fmt) return ``` If a plain Tool named `local/my-tool` exists and a user runs `agents validation add --update --config ./my-validation.yaml` (where the YAML has `name: local/my-tool`), the command will silently overwrite the plain Tool with a Validation, violating the spec's namespace conflict rules. ### Code Location `src/cleveragents/cli/commands/validation.py` — `add()` function, the `--update` branch. ### Impact Users can accidentally overwrite plain Tools with Validations (or vice versa) using the `--update` flag. The spec explicitly requires a conflict error in this case. This could cause unexpected behavior in downstream systems that rely on the tool type discriminator. ### Steps to Reproduce 1. Register a plain tool: `agents tool add --config ./my-tool.yaml` (where `name: local/my-tool`) 2. Create a validation YAML with the same name: `name: local/my-tool` 3. Run: `agents validation add --update --config ./my-validation.yaml` 4. Observe the command succeeds, silently overwriting the plain Tool with a Validation ### Fix Add a type check in the `--update` branch: ```python if update: existing = service.get_tool(validation.name) if existing is not None: # Check that the existing entry is a Validation, not a plain Tool existing_type = ( existing.get("tool_type", "tool") if isinstance(existing, dict) else getattr(existing, "tool_type", "tool") ) if str(existing_type) != "validation": console.print( f"[red]Conflict error:[/red] '{validation.name}' is registered as a " f"plain Tool. Cannot overwrite a Tool with a Validation." ) raise typer.Abort() registered = service.update_tool(validation) _print_validation(registered, title="Validation Updated", fmt=fmt) return ``` ## Subtasks - [ ] Add type check in `validation.py` `add()` function `--update` branch to detect plain Tool vs Validation conflict - [ ] Return a clear conflict error message when a plain Tool name collision is detected - [ ] Write unit/behave tests covering the conflict scenario (plain Tool exists, `--update` with same name as Validation) - [ ] Verify the symmetric case: `agents tool add --update` should also fail if the existing entry is a Validation ## Definition of Done - [ ] `agents validation add --update` raises a conflict error when the existing entry is a plain Tool - [ ] Error message clearly identifies the conflict and the offending name - [ ] Symmetric enforcement verified for `agents tool add --update` against existing Validations - [ ] Unit tests cover the conflict scenario - [ ] All nox stages pass - [ ] Coverage >= 97% --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: new-issue-creator
Author
Owner

Issue triaged by project owner:

  • State: Verified — Valid UAT-discovered bug: validation add --update silently overwrites tool types
  • Priority: Backlog (already set) — Does not block milestone completion
  • MoSCoW: Should Have — Type conflict enforcement is important for data integrity
  • Story Points: 3 — M — Requires adding type conflict check in validation add command
  • Assignee: HAL9000

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

Issue triaged by project owner: - **State**: Verified ✅ — Valid UAT-discovered bug: validation add --update silently overwrites tool types - **Priority**: Backlog ✅ (already set) — Does not block milestone completion - **MoSCoW**: Should Have — Type conflict enforcement is important for data integrity - **Story Points**: 3 — M — Requires adding type conflict check in validation add command - **Assignee**: HAL9000 --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: project-owner
HAL9000 self-assigned this 2026-04-08 14:03:02 +00:00
HAL9000 added this to the v3.5.0 milestone 2026-04-08 17:42:06 +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.

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