UAT: JSON/YAML envelope missing metadata field — spec requires top-level metadata object in envelope #5195

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

Bug Report

Feature Area: CLI Commands — JSON/YAML output envelope structure
Severity: Medium — the metadata field is missing from all JSON/YAML output; programmatic consumers expecting it will fail
Source: src/cleveragents/cli/formatting.py (_build_envelope function)


What Was Tested

Runtime testing of --format json output across multiple commands, examining the envelope structure against the spec.

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

The spec defines the JSON envelope as having a metadata field:

{
  "command": "project show",
  "status": "ok",
  "exit_code": 0,
  "data": { ... },
  "timing": { "duration_ms": 42 },
  "metadata": { ... }
}

The metadata field is listed as a required top-level key in the envelope schema.

Actual Behavior

The metadata field is completely absent from all JSON/YAML output:

{
  "command": "",
  "status": "ok",
  "exit_code": 0,
  "data": { ... },
  "timing": { "duration_ms": 0 },
  "messages": [{ "level": "ok", "text": "ok" }]
}

The envelope contains messages (which is correct) but is missing metadata.

Root Cause

In src/cleveragents/cli/formatting.py, the _build_envelope function constructs the envelope without a metadata field:

return {
    "command": command,
    "status": status,
    "exit_code": exit_code,
    "data": data,
    "timing": {"duration_ms": duration_ms},
    "messages": messages,
}

The metadata key is not included. The spec does not fully define what metadata should contain, but its presence as a top-level key is required by the envelope schema.

Steps to Reproduce

agents --format json version
# Expected: { "command": "...", "status": "ok", ..., "metadata": {...} }
# Actual:   { "command": "", "status": "ok", ..., "messages": [...] }
# Note: "metadata" key is absent

Impact

  • Programmatic consumers that check for metadata key presence will fail
  • The JSON schema does not match the documented spec
  • Future features that populate metadata (e.g., request IDs, server info, schema version) have no field to write to

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

## Bug Report **Feature Area:** CLI Commands — JSON/YAML output envelope structure **Severity:** Medium — the `metadata` field is missing from all JSON/YAML output; programmatic consumers expecting it will fail **Source:** `src/cleveragents/cli/formatting.py` (`_build_envelope` function) --- ## What Was Tested Runtime testing of `--format json` output across multiple commands, examining the envelope structure against the spec. ## Expected Behavior (from spec §Output Rendering Framework §json format) The spec defines the JSON envelope as having a `metadata` field: ```json { "command": "project show", "status": "ok", "exit_code": 0, "data": { ... }, "timing": { "duration_ms": 42 }, "metadata": { ... } } ``` The `metadata` field is listed as a required top-level key in the envelope schema. ## Actual Behavior The `metadata` field is **completely absent** from all JSON/YAML output: ```json { "command": "", "status": "ok", "exit_code": 0, "data": { ... }, "timing": { "duration_ms": 0 }, "messages": [{ "level": "ok", "text": "ok" }] } ``` The envelope contains `messages` (which is correct) but is missing `metadata`. ## Root Cause In `src/cleveragents/cli/formatting.py`, the `_build_envelope` function constructs the envelope without a `metadata` field: ```python return { "command": command, "status": status, "exit_code": exit_code, "data": data, "timing": {"duration_ms": duration_ms}, "messages": messages, } ``` The `metadata` key is not included. The spec does not fully define what `metadata` should contain, but its presence as a top-level key is required by the envelope schema. ## Steps to Reproduce ```bash agents --format json version # Expected: { "command": "...", "status": "ok", ..., "metadata": {...} } # Actual: { "command": "", "status": "ok", ..., "messages": [...] } # Note: "metadata" key is absent ``` ## Impact - Programmatic consumers that check for `metadata` key presence will fail - The JSON schema does not match the documented spec - Future features that populate `metadata` (e.g., request IDs, server info, schema version) have no field to write to --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: uat-tester
HAL9000 added this to the v3.2.0 milestone 2026-04-09 03:12:51 +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#5195
No description provided.