UAT: All agents resource commands produce empty command field in JSON/YAML output — format_output() called without command parameter #6481

Open
opened 2026-04-09 21:08:29 +00:00 by HAL9000 · 0 comments
Owner

Bug Report

Feature Area

Resource System — JSON/YAML output envelope command field

Spec Reference

docs/specification.md §10862–10910 (agents resource add JSON output), §11000–11011 (agents resource remove JSON output), §11092–11135 (agents resource list JSON output)

From spec §10862–10910 (JSON output for resource add):

{
  "command": "resource add",
  "status": "ok",
  ...
}

From spec §11000–11011 (JSON output for resource remove):

{
  "command": "resource remove",
  ...
}

From spec §11092–11135 (JSON output for resource list):

{
  "command": "resource list",
  ...
}

Expected Behavior (from spec)

All resource commands should include the command name in the command field of the JSON/YAML output envelope:

  • agents resource add"command": "resource add"
  • agents resource remove"command": "resource remove"
  • agents resource list"command": "resource list"
  • agents resource show"command": "resource show"
  • agents resource type add"command": "resource type add"
  • agents resource type list"command": "resource type list"
  • etc.

Actual Behavior

All resource commands produce "command": "" (empty string) in JSON/YAML output:

{
  "command": "",
  "status": "ok",
  ...
}

Root Cause (Code Analysis)

All format_output() calls in src/cleveragents/cli/commands/resource.py are missing the command parameter:

# resource.py line 252 (type_add)
console.print(format_output(data, fmt))  # Missing: command="resource type add"

# resource.py line 368 (type_list)
console.print(format_output(data, fmt))  # Missing: command="resource type list"

# resource.py line 430 (type_show)
console.print(format_output(data, fmt))  # Missing: command="resource type show"

# resource.py line 793 (resource_add)
console.print(format_output(data, fmt))  # Missing: command="resource add"

# resource.py line 859 (resource_list)
console.print(format_output(data, fmt))  # Missing: command="resource list"

# resource.py line 940 (resource_show)
console.print(format_output(data, fmt))  # Missing: command="resource show"

# resource.py line 1015 (resource_tree)
console.print(format_output(data, fmt))  # Missing: command="resource tree"

# resource.py line 1139 (resource_inspect)
console.print(format_output(data, fmt))  # Missing: command="resource inspect"

# resource.py line 1256 (resource_link_child)
console.print(format_output(data, fmt))  # Missing: command="resource link-child"

# resource.py line 1327 (resource_unlink_child)
console.print(format_output(data, fmt))  # Missing: command="resource unlink-child"

The format_output() function in src/cleveragents/cli/formatting.py accepts a command parameter (line 241) that defaults to "". All resource commands fail to pass this parameter.

Steps to Reproduce

agents resource list --format json | python3 -c "import sys,json; d=json.load(sys.stdin); print(d['command'])"
# Output: "" (empty string)
# Expected: "resource list"

Code Location

  • src/cleveragents/cli/commands/resource.py — all format_output(data, fmt) calls (lines 252, 368, 430, 793, 859, 940, 1015, 1139, 1256, 1327)
  • src/cleveragents/cli/formatting.py line 241: command: str = "" default parameter

Severity

Medium — downstream automation tools that check data["command"] to identify which command produced the output will receive an empty string instead of the expected command name.

Note: This same issue affects other command groups (plan, project, etc.) as reported in issue #6462 and #6458. This issue specifically tracks the resource commands.


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

## Bug Report ### Feature Area Resource System — JSON/YAML output envelope `command` field ### Spec Reference `docs/specification.md` §10862–10910 (`agents resource add` JSON output), §11000–11011 (`agents resource remove` JSON output), §11092–11135 (`agents resource list` JSON output) From spec §10862–10910 (JSON output for `resource add`): ```json { "command": "resource add", "status": "ok", ... } ``` From spec §11000–11011 (JSON output for `resource remove`): ```json { "command": "resource remove", ... } ``` From spec §11092–11135 (JSON output for `resource list`): ```json { "command": "resource list", ... } ``` ### Expected Behavior (from spec) All resource commands should include the command name in the `command` field of the JSON/YAML output envelope: - `agents resource add` → `"command": "resource add"` - `agents resource remove` → `"command": "resource remove"` - `agents resource list` → `"command": "resource list"` - `agents resource show` → `"command": "resource show"` - `agents resource type add` → `"command": "resource type add"` - `agents resource type list` → `"command": "resource type list"` - etc. ### Actual Behavior All resource commands produce `"command": ""` (empty string) in JSON/YAML output: ```json { "command": "", "status": "ok", ... } ``` ### Root Cause (Code Analysis) All `format_output()` calls in `src/cleveragents/cli/commands/resource.py` are missing the `command` parameter: ```python # resource.py line 252 (type_add) console.print(format_output(data, fmt)) # Missing: command="resource type add" # resource.py line 368 (type_list) console.print(format_output(data, fmt)) # Missing: command="resource type list" # resource.py line 430 (type_show) console.print(format_output(data, fmt)) # Missing: command="resource type show" # resource.py line 793 (resource_add) console.print(format_output(data, fmt)) # Missing: command="resource add" # resource.py line 859 (resource_list) console.print(format_output(data, fmt)) # Missing: command="resource list" # resource.py line 940 (resource_show) console.print(format_output(data, fmt)) # Missing: command="resource show" # resource.py line 1015 (resource_tree) console.print(format_output(data, fmt)) # Missing: command="resource tree" # resource.py line 1139 (resource_inspect) console.print(format_output(data, fmt)) # Missing: command="resource inspect" # resource.py line 1256 (resource_link_child) console.print(format_output(data, fmt)) # Missing: command="resource link-child" # resource.py line 1327 (resource_unlink_child) console.print(format_output(data, fmt)) # Missing: command="resource unlink-child" ``` The `format_output()` function in `src/cleveragents/cli/formatting.py` accepts a `command` parameter (line 241) that defaults to `""`. All resource commands fail to pass this parameter. ### Steps to Reproduce ```bash agents resource list --format json | python3 -c "import sys,json; d=json.load(sys.stdin); print(d['command'])" # Output: "" (empty string) # Expected: "resource list" ``` ### Code Location - `src/cleveragents/cli/commands/resource.py` — all `format_output(data, fmt)` calls (lines 252, 368, 430, 793, 859, 940, 1015, 1139, 1256, 1327) - `src/cleveragents/cli/formatting.py` line 241: `command: str = ""` default parameter ### Severity Medium — downstream automation tools that check `data["command"]` to identify which command produced the output will receive an empty string instead of the expected command name. Note: This same issue affects other command groups (plan, project, etc.) as reported in issue #6462 and #6458. This issue specifically tracks the resource commands. --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: uat-tester
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#6481
No description provided.