UAT: agents session import missing --format option — cannot produce JSON/YAML output #6782

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

Background and Context

UAT code analysis of src/cleveragents/cli/commands/session.py found that the agents session import command has no --format option. The spec defines JSON and YAML output for this command, which is required for programmatic/automation use cases. All other session commands support --format; import is the odd one out.

Current Behavior

The import_session() function signature (line 724) accepts only --input/-i FILE:

def import_session(
    input_file: Annotated[
        Path,
        typer.Option("--input", "-i", help="Input JSON file path"),
    ],
) -> None:

There is no fmt parameter and no call to format_output(). Output is always Rich panels rendered directly to the console, regardless of any --format option on the parent command.

Compared to session create, session list, and session show, which all accept a --format parameter and call format_output(data, fmt).

Expected Behavior (from Spec)

Per docs/specification.md §"agents session import" JSON tab:

{
  "command": "agents session import --input /tmp/weekly-planning.json",
  "status": "ok",
  "exit_code": 0,
  "data": {
    "session_import": {
      "input": "/tmp/weekly-planning.json",
      "session_id": "01HXM3D3B2W4CQYQ3P4ZB8A5T1",
      "messages": 6,
      "schema": "v3"
    },
    "validation": {
      "checksum": "verified",
      "schema": "compatible",
      "actor_ref": "resolved"
    },
    "merge": {
      "existing": "none",
      "strategy": "create new"
    }
  },
  "timing": { "duration_ms": 210 },
  "messages": [{ "level": "ok", "text": "Import completed" }]
}

Steps to Reproduce

  1. Clone the repository and run agents init
  2. Export a session: agents session export <SESSION_ID> -o /tmp/test.json
  3. Run: agents session import -i /tmp/test.json --format json
  4. Observe: typer error — unknown option --format, or the option is silently ignored if inherited from global context

Acceptance Criteria

  • agents session import accepts a --format / -f option with values rich, color, table, plain, json, yaml
  • When --format json is passed, output is a valid JSON envelope matching the spec schema above with data.session_import, data.validation, and data.merge sub-objects
  • When --format rich (default), the existing three-panel output is preserved
  • Consistent with the --format handling in session create, session list, session show, and session delete

Supporting Information

  • Source file: src/cleveragents/cli/commands/session.py, function import_session() (line 724)
  • Spec reference: docs/specification.md §"agents session import" JSON and YAML output tabs
  • Also note: the import panel shows [bold]Session ID:[/bold] (line 759) while the spec renders Session ID: in the panel — the field label is consistent but differs from session show which uses [bold]ID:[/bold] (line 376)

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

## Background and Context UAT code analysis of `src/cleveragents/cli/commands/session.py` found that the `agents session import` command has no `--format` option. The spec defines JSON and YAML output for this command, which is required for programmatic/automation use cases. All other session commands support `--format`; `import` is the odd one out. ## Current Behavior The `import_session()` function signature (line 724) accepts only `--input/-i FILE`: ```python def import_session( input_file: Annotated[ Path, typer.Option("--input", "-i", help="Input JSON file path"), ], ) -> None: ``` There is no `fmt` parameter and no call to `format_output()`. Output is always Rich panels rendered directly to the console, regardless of any `--format` option on the parent command. Compared to `session create`, `session list`, and `session show`, which all accept a `--format` parameter and call `format_output(data, fmt)`. ## Expected Behavior (from Spec) Per `docs/specification.md` §"agents session import" JSON tab: ```json { "command": "agents session import --input /tmp/weekly-planning.json", "status": "ok", "exit_code": 0, "data": { "session_import": { "input": "/tmp/weekly-planning.json", "session_id": "01HXM3D3B2W4CQYQ3P4ZB8A5T1", "messages": 6, "schema": "v3" }, "validation": { "checksum": "verified", "schema": "compatible", "actor_ref": "resolved" }, "merge": { "existing": "none", "strategy": "create new" } }, "timing": { "duration_ms": 210 }, "messages": [{ "level": "ok", "text": "Import completed" }] } ``` ## Steps to Reproduce 1. Clone the repository and run `agents init` 2. Export a session: `agents session export <SESSION_ID> -o /tmp/test.json` 3. Run: `agents session import -i /tmp/test.json --format json` 4. Observe: typer error — unknown option `--format`, or the option is silently ignored if inherited from global context ## Acceptance Criteria - `agents session import` accepts a `--format` / `-f` option with values `rich`, `color`, `table`, `plain`, `json`, `yaml` - When `--format json` is passed, output is a valid JSON envelope matching the spec schema above with `data.session_import`, `data.validation`, and `data.merge` sub-objects - When `--format rich` (default), the existing three-panel output is preserved - Consistent with the `--format` handling in `session create`, `session list`, `session show`, and `session delete` ## Supporting Information - Source file: `src/cleveragents/cli/commands/session.py`, function `import_session()` (line 724) - Spec reference: `docs/specification.md` §"agents session import" JSON and YAML output tabs - Also note: the import panel shows `[bold]Session ID:[/bold]` (line 759) while the spec renders `Session ID:` in the panel — the field label is consistent but differs from `session show` which uses `[bold]ID:[/bold]` (line 376) --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: uat-tester
HAL9000 added this to the v3.4.0 milestone 2026-04-10 02:05:50 +00:00
HAL9000 self-assigned this 2026-04-10 06:07:15 +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#6782
No description provided.