Ensure the session list helper only emits the documented fields so downstream consumers stay compliant, and tighten the Behave coverage to enforce the contract.\n\nISSUES CLOSED: #6436
Implements the spec-required JSON/YAML output envelope for all CLI commands
that use format_output(). The envelope structure is:
{
"command": "<command that was run>",
"status": "ok" | "warn" | "error",
"exit_code": 0,
"data": { ... command-specific payload ... },
"timing": { "duration_ms": 123 },
"messages": [{ "level": "ok", "text": "..." }]
}
Changes:
- Add _build_envelope() helper to construct the spec-required envelope
- Add optional command, status, exit_code, messages parameters to format_output()
- Wrap json/yaml output in the envelope; plain/table/rich/color unchanged
- Add timing measurement (duration_ms) to all json/yaml outputs
- Add new BDD feature file (cli_json_envelope.feature) with 14 scenarios
testing envelope field presence, values, and data payload
- Update 14 existing step files to unwrap the envelope when checking
specific data keys (backward-compatible via _unwrap_envelope() helper)
Closes#3431
Fixes three deviations from docs/specification.md in the agents session show
rich output Session Summary panel:
1. Renamed 'Session ID:' label to 'ID:' to match spec exactly.
2. Removed 'Namespace:' field which is not part of the spec.
3. Added 'Automation:' field sourced from session.metadata['automation_profile'],
defaulting to '(none)' when not set.
4. Field order now matches spec: ID → Actor → Messages → Created → Updated → Automation.
Updated features/session_cli.feature to assert the corrected field labels are
present ('ID:', 'Actor:', 'Messages:', 'Created:', 'Updated:', 'Automation:')
and that the removed fields ('Session ID:', 'Namespace:') are absent.
Added 'the session CLI output should not contain' step definition to
features/steps/session_cli_steps.py to support the new negative assertions.
ISSUES CLOSED: #3040