UAT: JSON/YAML output command field is always empty string for version, info, and diagnostics #6791

Open
opened 2026-04-10 02:06:20 +00:00 by HAL9000 · 0 comments
Owner

Background and Context

The specification defines a strict output envelope schema for JSON and YAML format output. The command field in the envelope must contain the name of the CLI command that produced the output. This is essential for programmatic consumers parsing structured output.

Current Behavior

When running agents --format json version, agents --format json info, or agents --format json diagnostics, the command field in the JSON/YAML envelope is always an empty string:

{
  "command": "",
  "status": "ok",
  "exit_code": 0,
  "data": { ... },
  ...
}

Also observed for YAML format:

command: ''
status: ok

Additionally, the messages[0].text field is just "ok" instead of the meaningful message text specified (e.g., "Version reported", "Environment details ready").

Expected Behavior (from spec)

Per the specification JSON schema for each command:

agents version JSON output should have:

{
  "command": "version",
  "status": "ok",
  "exit_code": 0,
  ...
  "messages": [{ "level": "ok", "text": "Version reported" }]
}

agents info JSON output should have:

{
  "command": "info",
  ...
  "messages": [{ "level": "ok", "text": "Environment details ready" }]
}

agents diagnostics JSON output should have:

{
  "command": "diagnostics",
  ...
  "messages": [{ "level": "warn", "text": "2 warnings require attention" }]
}

Steps to Reproduce

agents --format json version
agents --format json info
agents --format json diagnostics
agents --format yaml version

Code Analysis

In src/cleveragents/cli/main.py, the version, info, and diagnostics commands call format_output(data, fmt) without passing the command= parameter (lines 355, 380, 411). The format_output() function defaults command="" when not provided.

# line 355 — missing command="version"
typer.echo(format_output(data, fmt))

# line 380 — missing command="info"  
typer.echo(format_output(data, fmt))

# line 411 — missing command="diagnostics"
typer.echo(format_output(data, fmt))

Similarly, no messages= parameter is passed, so the default message {"level": status, "text": "ok"} is generated instead of the spec-required descriptive messages.

Acceptance Criteria

  • format_output(data, fmt, command="version", ...) called with correct command name for version
  • format_output(data, fmt, command="info", ...) called with correct command name for info
  • format_output(data, fmt, command="diagnostics", ...) called with correct command name for diagnostics
  • Descriptive messages texts match spec (e.g., "Version reported", "Environment details ready")
  • JSON and YAML output verified to include correct command field values

Supporting Information

  • Spec reference: docs/specification.mdagents version, agents info, agents diagnostics JSON examples
  • Code location: src/cleveragents/cli/main.py, lines 337–414
  • Runtime confirmed: agents --format json version"command": ""

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

## Background and Context The specification defines a strict output envelope schema for JSON and YAML format output. The `command` field in the envelope must contain the name of the CLI command that produced the output. This is essential for programmatic consumers parsing structured output. ## Current Behavior When running `agents --format json version`, `agents --format json info`, or `agents --format json diagnostics`, the `command` field in the JSON/YAML envelope is always an empty string: ```json { "command": "", "status": "ok", "exit_code": 0, "data": { ... }, ... } ``` Also observed for YAML format: ```yaml command: '' status: ok ``` Additionally, the `messages[0].text` field is just `"ok"` instead of the meaningful message text specified (e.g., `"Version reported"`, `"Environment details ready"`). ## Expected Behavior (from spec) Per the specification JSON schema for each command: **`agents version` JSON output should have:** ```json { "command": "version", "status": "ok", "exit_code": 0, ... "messages": [{ "level": "ok", "text": "Version reported" }] } ``` **`agents info` JSON output should have:** ```json { "command": "info", ... "messages": [{ "level": "ok", "text": "Environment details ready" }] } ``` **`agents diagnostics` JSON output should have:** ```json { "command": "diagnostics", ... "messages": [{ "level": "warn", "text": "2 warnings require attention" }] } ``` ## Steps to Reproduce ```bash agents --format json version agents --format json info agents --format json diagnostics agents --format yaml version ``` ## Code Analysis In `src/cleveragents/cli/main.py`, the `version`, `info`, and `diagnostics` commands call `format_output(data, fmt)` without passing the `command=` parameter (lines 355, 380, 411). The `format_output()` function defaults `command=""` when not provided. ```python # line 355 — missing command="version" typer.echo(format_output(data, fmt)) # line 380 — missing command="info" typer.echo(format_output(data, fmt)) # line 411 — missing command="diagnostics" typer.echo(format_output(data, fmt)) ``` Similarly, no `messages=` parameter is passed, so the default message `{"level": status, "text": "ok"}` is generated instead of the spec-required descriptive messages. ## Acceptance Criteria - [ ] `format_output(data, fmt, command="version", ...)` called with correct command name for `version` - [ ] `format_output(data, fmt, command="info", ...)` called with correct command name for `info` - [ ] `format_output(data, fmt, command="diagnostics", ...)` called with correct command name for `diagnostics` - [ ] Descriptive `messages` texts match spec (e.g., `"Version reported"`, `"Environment details ready"`) - [ ] JSON and YAML output verified to include correct `command` field values ## Supporting Information - Spec reference: `docs/specification.md` → `agents version`, `agents info`, `agents diagnostics` JSON examples - Code location: `src/cleveragents/cli/main.py`, lines 337–414 - Runtime confirmed: `agents --format json version` → `"command": ""` --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: uat-tester
HAL9000 added this to the v3.4.0 milestone 2026-04-10 02:06:27 +00:00
HAL9000 self-assigned this 2026-04-10 06:06:57 +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.

Dependencies

No dependencies set.

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