UAT: JSON/YAML messages[0].text is always "ok" — spec requires meaningful command-specific message text #5196

Open
opened 2026-04-09 03:07:16 +00:00 by HAL9000 · 0 comments
Owner

Bug Report

Feature Area: CLI Commands — JSON/YAML output envelope messages array
Severity: Medium — the messages array always contains a generic "ok" text instead of meaningful command-specific messages
Source: src/cleveragents/cli/formatting.py (_build_envelope function)


What Was Tested

Runtime testing of --format json output across multiple commands, examining the messages array content.

Expected Behavior (from spec §Output Rendering Framework §json format)

The spec shows command-specific messages in the messages array:

// agents --format json project show local/api-service
"messages": [
  { "level": "ok", "text": "Project loaded" }
]

// agents --format json plan list --phase execute
"messages": [
  { "level": "ok", "text": "1 plan listed" }
]

// agents --format json session list
"messages": [
  { "level": "ok", "text": "1 session listed" }
]

The text field should be a meaningful, human-readable summary of what the command did.

Actual Behavior

The messages[0].text is always "ok" regardless of which command was run or what it did:

"messages": [
  { "level": "ok", "text": "ok" }
]

Observed for all tested commands:

  • agents --format json version"text": "ok" (expected: "Version reported" or similar)
  • agents session list --format json"text": "ok" (expected: "1 session listed")
  • agents project list --format json"text": "ok" (expected: "1 project listed")
  • agents resource list --format json"text": "ok" (expected: "2 resources listed")
  • agents diagnostics --format json"text": "ok" (expected: "18 checks completed, 1 error")

Root Cause

In src/cleveragents/cli/formatting.py, the _build_envelope function generates a default message when messages is None:

if messages is None:
    messages = [
        {"level": status, "text": f"{command} completed" if command else "ok"}
    ]

Since command is always "" (empty string, see related bug), the condition if command is always False, so the text always defaults to "ok". Even if command were populated, "version completed" is less informative than "Version reported".

No command ever passes a meaningful messages argument to format_output.

Steps to Reproduce

agents session list --format json
# Expected: "messages": [{ "level": "ok", "text": "1 session listed" }]
# Actual:   "messages": [{ "level": "ok", "text": "ok" }]

agents project list --format json
# Expected: "messages": [{ "level": "ok", "text": "1 project listed" }]
# Actual:   "messages": [{ "level": "ok", "text": "ok" }]

Impact

  • Programmatic consumers that parse messages[0].text for status summaries receive useless "ok" text
  • Log aggregation systems that use the message text for alerting/monitoring receive no useful information
  • The JSON output does not match the documented spec examples

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

## Bug Report **Feature Area:** CLI Commands — JSON/YAML output envelope `messages` array **Severity:** Medium — the `messages` array always contains a generic `"ok"` text instead of meaningful command-specific messages **Source:** `src/cleveragents/cli/formatting.py` (`_build_envelope` function) --- ## What Was Tested Runtime testing of `--format json` output across multiple commands, examining the `messages` array content. ## Expected Behavior (from spec §Output Rendering Framework §json format) The spec shows command-specific messages in the `messages` array: ```json // agents --format json project show local/api-service "messages": [ { "level": "ok", "text": "Project loaded" } ] // agents --format json plan list --phase execute "messages": [ { "level": "ok", "text": "1 plan listed" } ] // agents --format json session list "messages": [ { "level": "ok", "text": "1 session listed" } ] ``` The `text` field should be a meaningful, human-readable summary of what the command did. ## Actual Behavior The `messages[0].text` is **always `"ok"`** regardless of which command was run or what it did: ```json "messages": [ { "level": "ok", "text": "ok" } ] ``` Observed for all tested commands: - `agents --format json version` → `"text": "ok"` ❌ (expected: `"Version reported"` or similar) - `agents session list --format json` → `"text": "ok"` ❌ (expected: `"1 session listed"`) - `agents project list --format json` → `"text": "ok"` ❌ (expected: `"1 project listed"`) - `agents resource list --format json` → `"text": "ok"` ❌ (expected: `"2 resources listed"`) - `agents diagnostics --format json` → `"text": "ok"` ❌ (expected: `"18 checks completed, 1 error"`) ## Root Cause In `src/cleveragents/cli/formatting.py`, the `_build_envelope` function generates a default message when `messages` is `None`: ```python if messages is None: messages = [ {"level": status, "text": f"{command} completed" if command else "ok"} ] ``` Since `command` is always `""` (empty string, see related bug), the condition `if command` is always `False`, so the text always defaults to `"ok"`. Even if `command` were populated, `"version completed"` is less informative than `"Version reported"`. No command ever passes a meaningful `messages` argument to `format_output`. ## Steps to Reproduce ```bash agents session list --format json # Expected: "messages": [{ "level": "ok", "text": "1 session listed" }] # Actual: "messages": [{ "level": "ok", "text": "ok" }] agents project list --format json # Expected: "messages": [{ "level": "ok", "text": "1 project listed" }] # Actual: "messages": [{ "level": "ok", "text": "ok" }] ``` ## Impact - Programmatic consumers that parse `messages[0].text` for status summaries receive useless `"ok"` text - Log aggregation systems that use the message text for alerting/monitoring receive no useful information - The JSON output does not match the documented spec examples --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: uat-tester
HAL9000 added this to the v3.2.0 milestone 2026-04-09 03:12:52 +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#5196
No description provided.