UAT: agents session create JSON/YAML output format doesn't match spec — missing settings, actor_details, timing, and messages wrapper fields #3499

Open
opened 2026-04-05 18:40:50 +00:00 by freemo · 0 comments
Owner

Metadata

  • Branch: fix/backlog-session-create-json-output-envelope
  • Commit Message: fix(cli): wrap session create JSON/YAML output in spec-compliant envelope
  • Milestone: None (backlog)
  • Parent Epic: #397

Backlog note: This issue was discovered during autonomous operation
on milestone v3.5.0. It does not block milestone completion and has been
placed in the backlog for human review and future milestone assignment.

Background and Context

Code-level analysis of src/cleveragents/cli/commands/session.py against docs/specification.md §"agents session create" (lines 1461–1592).

The agents session create --format json output does not match the structured format defined in the specification. The implementation outputs a flat session summary dict, while the spec requires a structured envelope with command, status, exit_code, data.session, data.settings, data.actor_details, timing, and messages fields.

Current Behavior (Actual)

When running agents session create --format json, the implementation (lines 207–210 of session.py) calls:

typer.echo(format_output(dict(data), fmt))

where data is _session_summary_dict(session) which returns:

{
  "session_id": "01HXM2A6K1P2E9Q9D4GQ7J4S7Z",
  "actor": "(none)",
  "namespace": "local",
  "messages": 0,
  "created": "2026-02-08T12:44:00Z",
  "updated": "2026-02-08T12:44:00Z"
}

Missing from the output:

  1. No command field
  2. No status field
  3. No exit_code field
  4. No data.settings object (streaming, context, memory, max_history)
  5. No data.actor_details object (provider, model, temperature, context_window)
  6. No timing field
  7. No messages array (status messages)
  8. The session fields use session_id instead of id

Expected Behavior

Per docs/specification.md §"agents session create" (lines 1531–1562):

{
  "command": "agents session create --actor local/orchestrator",
  "status": "ok",
  "exit_code": 0,
  "data": {
    "session": {
      "id": "01HXM2A6K1P2E9Q9D4GQ7J4S7Z",
      "actor": "local/orchestrator",
      "created": "2026-02-08T12:44:00Z",
      "namespace": "local"
    },
    "settings": {
      "automation": "review",
      "streaming": "off",
      "context": "default",
      "memory": "enabled",
      "max_history": 50
    },
    "actor_details": {
      "provider": "anthropic",
      "model": "claude-3.5",
      "temperature": 0.7,
      "context_window": "200K tokens"
    }
  },
  "timing": { "duration_ms": 120 },
  "messages": [{ "level": "ok", "text": "Session created" }]
}

The same issue applies to --format yaml output.

Steps to Reproduce

  1. Run: agents session create --format json
  2. Observe: flat dict with session_id, actor, namespace, messages, created, updated — missing command, status, exit_code, data.settings, data.actor_details, timing, messages wrapper

Code Location

src/cleveragents/cli/commands/session.py, create() function, lines 170–261

Subtasks

  • Wrap session create JSON output in spec-compliant envelope: command, status, exit_code, data, timing, messages
  • Use id instead of session_id in the data.session object
  • Add data.settings object with automation, streaming, context, memory, max_history fields
  • Add data.actor_details object when actor is bound
  • Add timing.duration_ms field
  • Add messages array with status message
  • Apply same fix to YAML output
  • Add Behave scenarios for JSON/YAML output format compliance
  • Run nox (all default sessions), fix any errors
  • Verify coverage >= 97%

Definition of Done

  • agents session create --format json output matches spec structure exactly
  • agents session create --format yaml output matches spec structure exactly
  • All Behave scenarios pass
  • All nox stages pass
  • Coverage >= 97%

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

## Metadata - **Branch**: `fix/backlog-session-create-json-output-envelope` - **Commit Message**: `fix(cli): wrap session create JSON/YAML output in spec-compliant envelope` - **Milestone**: None (backlog) - **Parent Epic**: #397 > **Backlog note:** This issue was discovered during autonomous operation > on milestone v3.5.0. It does not block milestone completion and has been > placed in the backlog for human review and future milestone assignment. ## Background and Context Code-level analysis of `src/cleveragents/cli/commands/session.py` against `docs/specification.md` §"agents session create" (lines 1461–1592). The `agents session create --format json` output does not match the structured format defined in the specification. The implementation outputs a flat session summary dict, while the spec requires a structured envelope with `command`, `status`, `exit_code`, `data.session`, `data.settings`, `data.actor_details`, `timing`, and `messages` fields. ## Current Behavior (Actual) When running `agents session create --format json`, the implementation (lines 207–210 of `session.py`) calls: ```python typer.echo(format_output(dict(data), fmt)) ``` where `data` is `_session_summary_dict(session)` which returns: ```json { "session_id": "01HXM2A6K1P2E9Q9D4GQ7J4S7Z", "actor": "(none)", "namespace": "local", "messages": 0, "created": "2026-02-08T12:44:00Z", "updated": "2026-02-08T12:44:00Z" } ``` Missing from the output: 1. No `command` field 2. No `status` field 3. No `exit_code` field 4. No `data.settings` object (streaming, context, memory, max_history) 5. No `data.actor_details` object (provider, model, temperature, context_window) 6. No `timing` field 7. No `messages` array (status messages) 8. The session fields use `session_id` instead of `id` ## Expected Behavior Per `docs/specification.md` §"agents session create" (lines 1531–1562): ```json { "command": "agents session create --actor local/orchestrator", "status": "ok", "exit_code": 0, "data": { "session": { "id": "01HXM2A6K1P2E9Q9D4GQ7J4S7Z", "actor": "local/orchestrator", "created": "2026-02-08T12:44:00Z", "namespace": "local" }, "settings": { "automation": "review", "streaming": "off", "context": "default", "memory": "enabled", "max_history": 50 }, "actor_details": { "provider": "anthropic", "model": "claude-3.5", "temperature": 0.7, "context_window": "200K tokens" } }, "timing": { "duration_ms": 120 }, "messages": [{ "level": "ok", "text": "Session created" }] } ``` The same issue applies to `--format yaml` output. ## Steps to Reproduce 1. Run: `agents session create --format json` 2. Observe: flat dict with `session_id`, `actor`, `namespace`, `messages`, `created`, `updated` — missing `command`, `status`, `exit_code`, `data.settings`, `data.actor_details`, `timing`, `messages` wrapper ## Code Location `src/cleveragents/cli/commands/session.py`, `create()` function, lines 170–261 ## Subtasks - [ ] Wrap session create JSON output in spec-compliant envelope: `command`, `status`, `exit_code`, `data`, `timing`, `messages` - [ ] Use `id` instead of `session_id` in the `data.session` object - [ ] Add `data.settings` object with `automation`, `streaming`, `context`, `memory`, `max_history` fields - [ ] Add `data.actor_details` object when actor is bound - [ ] Add `timing.duration_ms` field - [ ] Add `messages` array with status message - [ ] Apply same fix to YAML output - [ ] Add Behave scenarios for JSON/YAML output format compliance - [ ] Run `nox` (all default sessions), fix any errors - [ ] Verify coverage >= 97% ## Definition of Done - [ ] `agents session create --format json` output matches spec structure exactly - [ ] `agents session create --format yaml` output matches spec structure exactly - [ ] All Behave scenarios pass - [ ] All nox stages pass - [ ] Coverage >= 97% --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-uat-tester
freemo added this to the v3.7.0 milestone 2026-04-05 20:36:11 +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.

Blocks
#397 Epic: Server & Autonomy Infrastructure
cleveragents/cleveragents-core
Reference
cleveragents/cleveragents-core#3499
No description provided.