UAT: agents tool show does not display "Attached To" field for Validations — spec requires listing all resource attachments with scope #2973

Open
opened 2026-04-05 03:00:22 +00:00 by freemo · 1 comment
Owner

Metadata

  • Branch: fix/m3-tool-show-validation-attached-to
  • Commit Message: fix(cli): display "Attached To" attachments in agents tool show for Validations
  • Milestone: v3.7.0
  • Parent Epic: #374

Background and Context

The agents tool show CLI command (src/cleveragents/cli/commands/tool.py) is incomplete for Validations. The specification (§CLI Commands > agents tool show) explicitly requires that when showing a Validation, the output includes an "Attached To" field listing each resource attachment with its scope (direct, project-scoped, or plan-scoped). This field is entirely absent from the current implementation.

Because Validations are a subtype of Tool and share the same registry, agents tool show <validation-name> is the primary way an operator discovers where a given Validation is attached across the system. Without the "Attached To" field, the command hides critical operational information.

Current Behavior

The _print_tool() function in src/cleveragents/cli/commands/tool.py renders validation-specific fields as follows:

# Show validation-specific fields
mode = data.get("mode")
if mode:
    details += f"\n[bold]Validation Mode:[/bold] {mode}"
wraps = data.get("wraps")
if wraps:
    details += f"\n[bold]Wraps:[/bold] {wraps}"

The Mode field is shown (as "Validation Mode"), but "Attached To" is completely absent. The show command only calls service.get_tool(name) — it never queries ValidationAttachmentRepository to fetch and display resource attachments.

Steps to Reproduce

  1. Register a validation: agents tool add --config validation.yaml
  2. Attach it to a resource: agents validation attach <resource> <validation-name>
  3. Run: agents tool show <validation-name>
  4. Expected: Output includes "Attached To: resource-id (direct)" section
  5. Actual: No "Attached To" section appears

Expected Behavior

Per the specification (§CLI Commands > agents tool show):

When showing a Validation, additional validation-specific fields are displayed: Mode (required/informational) and Attached To (listing each resource attachment with its scope — direct, project-scoped, or plan-scoped).

The agents tool show <validation-name> output must include:

  • Mode: required or informational (already present)
  • Attached To: a list of resource attachments, each with its scope (direct, project-scoped, or plan-scoped) (missing)

Acceptance Criteria

  1. When agents tool show <name> is run for a Validation, the output includes an "Attached To" section.
  2. Each entry in "Attached To" shows the resource identifier and its scope (direct, project-scoped, or plan-scoped).
  3. If the Validation has no attachments, the section displays "None" or is omitted gracefully.
  4. The fix applies to both rich and json/yaml output formats.
  5. All existing agents tool show behaviour for non-Validation tools is unchanged.

Supporting Information

  • Code locations:
    • src/cleveragents/cli/commands/tool.pyshow() command: missing attachment lookup via service.list_attachments(name) (or equivalent)
    • src/cleveragents/cli/commands/tool.py_print_tool() function: missing "Attached To" display block
  • Severity: Medium — the command is incomplete for Validations, hiding important operational information about where validations are attached.
  • Spec reference: §CLI Commands > agents tool show

Subtasks

  • In show() command: detect when the tool is a Validation (tool_type == "validation")
  • Call service.list_attachments(name) (or ValidationAttachmentRepository) to fetch all resource attachments for the Validation
  • In _print_tool(): add "Attached To" display block rendering each attachment with its scope (direct, project-scoped, plan-scoped)
  • Handle the empty-attachments case gracefully (display "None" or omit section)
  • Extend json/yaml output to include attached_to key with attachment list
  • Tests (Behave): Add scenario for agents tool show on a Validation with attachments
  • Tests (Behave): Add scenario for agents tool show on a Validation with no attachments
  • Tests (Robot): Add integration test verifying "Attached To" field appears in output
  • Verify coverage ≥ 97% via nox -s coverage_report
  • Run nox (all default sessions), fix any errors

Definition of Done

This issue is complete when:

  • All subtasks above are completed and checked off.
  • A Git commit is created where the first line of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details about the implementation.
  • The commit is pushed to the remote on the branch matching the Branch in Metadata exactly.
  • The commit is submitted as a pull request to master, reviewed, and merged before this issue is marked done.
  • All nox stages pass.
  • Coverage >= 97%.

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

## Metadata - **Branch**: `fix/m3-tool-show-validation-attached-to` - **Commit Message**: `fix(cli): display "Attached To" attachments in agents tool show for Validations` - **Milestone**: v3.7.0 - **Parent Epic**: #374 ## Background and Context The `agents tool show` CLI command (`src/cleveragents/cli/commands/tool.py`) is incomplete for Validations. The specification (§CLI Commands > agents tool show) explicitly requires that when showing a Validation, the output includes an **"Attached To"** field listing each resource attachment with its scope (direct, project-scoped, or plan-scoped). This field is entirely absent from the current implementation. Because Validations are a subtype of Tool and share the same registry, `agents tool show <validation-name>` is the primary way an operator discovers where a given Validation is attached across the system. Without the "Attached To" field, the command hides critical operational information. ## Current Behavior The `_print_tool()` function in `src/cleveragents/cli/commands/tool.py` renders validation-specific fields as follows: ```python # Show validation-specific fields mode = data.get("mode") if mode: details += f"\n[bold]Validation Mode:[/bold] {mode}" wraps = data.get("wraps") if wraps: details += f"\n[bold]Wraps:[/bold] {wraps}" ``` The `Mode` field is shown (as "Validation Mode"), but **"Attached To" is completely absent**. The `show` command only calls `service.get_tool(name)` — it never queries `ValidationAttachmentRepository` to fetch and display resource attachments. ### Steps to Reproduce 1. Register a validation: `agents tool add --config validation.yaml` 2. Attach it to a resource: `agents validation attach <resource> <validation-name>` 3. Run: `agents tool show <validation-name>` 4. **Expected**: Output includes "Attached To: resource-id (direct)" section 5. **Actual**: No "Attached To" section appears ## Expected Behavior Per the specification (§CLI Commands > agents tool show): > When showing a Validation, additional validation-specific fields are displayed: `Mode` (required/informational) and `Attached To` (listing each resource attachment with its scope — direct, project-scoped, or plan-scoped). The `agents tool show <validation-name>` output must include: - `Mode`: required or informational *(already present)* - `Attached To`: a list of resource attachments, each with its scope (direct, project-scoped, or plan-scoped) *(missing)* ## Acceptance Criteria 1. When `agents tool show <name>` is run for a Validation, the output includes an "Attached To" section. 2. Each entry in "Attached To" shows the resource identifier and its scope (direct, project-scoped, or plan-scoped). 3. If the Validation has no attachments, the section displays "None" or is omitted gracefully. 4. The fix applies to both `rich` and `json`/`yaml` output formats. 5. All existing `agents tool show` behaviour for non-Validation tools is unchanged. ## Supporting Information - **Code locations**: - `src/cleveragents/cli/commands/tool.py` — `show()` command: missing attachment lookup via `service.list_attachments(name)` (or equivalent) - `src/cleveragents/cli/commands/tool.py` — `_print_tool()` function: missing "Attached To" display block - **Severity**: Medium — the command is incomplete for Validations, hiding important operational information about where validations are attached. - **Spec reference**: §CLI Commands > `agents tool show` ## Subtasks - [ ] In `show()` command: detect when the tool is a Validation (`tool_type == "validation"`) - [ ] Call `service.list_attachments(name)` (or `ValidationAttachmentRepository`) to fetch all resource attachments for the Validation - [ ] In `_print_tool()`: add "Attached To" display block rendering each attachment with its scope (direct, project-scoped, plan-scoped) - [ ] Handle the empty-attachments case gracefully (display "None" or omit section) - [ ] Extend `json`/`yaml` output to include `attached_to` key with attachment list - [ ] Tests (Behave): Add scenario for `agents tool show` on a Validation with attachments - [ ] Tests (Behave): Add scenario for `agents tool show` on a Validation with no attachments - [ ] Tests (Robot): Add integration test verifying "Attached To" field appears in output - [ ] Verify coverage ≥ 97% via `nox -s coverage_report` - [ ] Run `nox` (all default sessions), fix any errors ## Definition of Done This issue is complete when: - All subtasks above are completed and checked off. - A Git commit is created where the **first line** of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details about the implementation. - The commit is pushed to the remote on the branch matching the **Branch** in Metadata exactly. - The commit is submitted as a **pull request** to `master`, reviewed, and **merged** before this issue is marked done. - All nox stages pass. - Coverage >= 97%. --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-new-issue-creator
freemo added this to the v3.7.0 milestone 2026-04-05 03:01:06 +00:00
Author
Owner

Issue triaged by project owner:

  • State: Verified
  • Priority: Confirmed
  • MoSCoW: Should Have

Valid finding verified during batch triage.


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

Issue triaged by project owner: - **State**: Verified - **Priority**: Confirmed - **MoSCoW**: Should Have Valid finding verified during batch triage. --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: ca-project-owner
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#2973
No description provided.