cli/session: add failing test for session tell missing --format flag #10465

Open
opened 2026-04-18 09:54:37 +00:00 by HAL9000 · 1 comment
Owner

Metadata

  • Commit: test(cli/session): add failing test for session tell missing --format flag
  • Branch: test/cli-session-tell-format-flag

Background and Context

agents session tell is missing the --format flag entirely. The spec (docs/specification.md §agents session tell) explicitly requires JSON envelope output for this command, but the current implementation has no --format parameter and only outputs Rich console text. This TDD issue captures the failing tests that verify the expected behavior before the fix is applied.

Expected Behavior

  • agents session tell --format json emits a spec-compliant JSON envelope
  • agents session tell --help shows a --format flag in its usage output

Acceptance Criteria

  • Test file tests/cli/test_session_tell_json.py exists with the specified test cases
  • Tests are tagged with @tdd_issue, @tdd_issue_1, @tdd_expected_fail
  • Tests fail on the current codebase (confirming the bug exists)
  • Tests pass after the corresponding bug fix is applied

Subtasks

  • Create tests/cli/test_session_tell_json.py with test_session_tell_format_json_emits_envelope and test_session_tell_has_format_flag
  • Tag tests with @tdd_issue, @tdd_issue_1, @tdd_expected_fail
  • Confirm tests fail on current codebase
  • Confirm tests pass after fix is applied

Definition of Done

This issue should be closed when:

  1. The test file is created and merged
  2. The tests are confirmed to fail on the current codebase
  3. The corresponding bug fix (see linked bug issue) has been applied and the tests pass

Summary

Add a failing BDD/unit test that verifies agents session tell --format json emits a spec-compliant JSON envelope. The spec (docs/specification.md §agents session tell) explicitly shows a JSON envelope example for this command.

Test Specification

# tests/cli/test_session_tell_json.py
def test_session_tell_format_json_emits_envelope(runner, mock_session_service):
    """agents session tell --format json must emit JSON envelope per spec."""
    result = runner.invoke(app, [
        "session", "tell", "--session", "01HXYZ", "--format", "json", "Hello world"
    ])
    assert result.exit_code == 0
    output = json.loads(result.output)
    assert output["command"].startswith("agents session tell")
    assert output["status"] == "ok"
    assert output["exit_code"] == 0
    assert "data" in output
    assert "session" in output["data"]
    assert "response" in output["data"]
    assert "timing" in output
    assert "messages" in output

def test_session_tell_has_format_flag(runner):
    """agents session tell must accept --format flag."""
    result = runner.invoke(app, ["session", "tell", "--help"])
    assert "--format" in result.output

Tags

  • @tdd_issue
  • @tdd_issue_1
  • @tdd_expected_fail

Expected Failure

The test currently fails because session tell in src/cleveragents/cli/commands/session.py (lines ~487-529) does NOT have a --format parameter. The function signature is:

@app.command()
def tell(
    prompt: Annotated[str, typer.Argument(...)],
    session_id: Annotated[str, typer.Option("--session", ...)],
    actor: Annotated[str | None, typer.Option("--actor", ...)] = None,
    stream: Annotated[bool, typer.Option("--stream", ...)] = False,
) -> None:

No --format parameter exists. The spec (docs/specification.md) explicitly requires JSON envelope output for this command.

Specification Reference

From docs/specification.md, the agents session tell command requires JSON envelope:

{
  "command": "agents session tell --session 01HXM2A6K1 --stream \"What files were changed?\"",
  "status": "ok",
  "exit_code": 0,
  "data": {
    "session": { "id": "...", "actor": "...", "mode": "streaming" },
    "response": "...",
    "files_changed": [...],
    "usage": { "tokens": 1240, "duration_s": 3.1, "tool_calls": 2 }
  },
  "timing": { "duration_ms": 3100 },
  "messages": [{ "level": "ok", "text": "Stream complete" }]
}

Definition of Done

  • Test file created with the above test cases
  • Tests are tagged with @tdd_issue, @tdd_issue_1, @tdd_expected_fail
  • Tests fail on current codebase (confirming the bug exists)
  • Tests pass after the corresponding bug fix is applied

Automated by CleverAgents Bot
Supervisor: Bug Hunt Pool | Agent: bug-hunt-pool-supervisor

## Metadata - **Commit:** `test(cli/session): add failing test for session tell missing --format flag` - **Branch:** `test/cli-session-tell-format-flag` ## Background and Context `agents session tell` is missing the `--format` flag entirely. The spec (`docs/specification.md §agents session tell`) explicitly requires JSON envelope output for this command, but the current implementation has no `--format` parameter and only outputs Rich console text. This TDD issue captures the failing tests that verify the expected behavior before the fix is applied. ## Expected Behavior - `agents session tell --format json` emits a spec-compliant JSON envelope - `agents session tell --help` shows a `--format` flag in its usage output ## Acceptance Criteria - [ ] Test file `tests/cli/test_session_tell_json.py` exists with the specified test cases - [ ] Tests are tagged with `@tdd_issue`, `@tdd_issue_1`, `@tdd_expected_fail` - [ ] Tests fail on the current codebase (confirming the bug exists) - [ ] Tests pass after the corresponding bug fix is applied ## Subtasks - [ ] Create `tests/cli/test_session_tell_json.py` with `test_session_tell_format_json_emits_envelope` and `test_session_tell_has_format_flag` - [ ] Tag tests with `@tdd_issue`, `@tdd_issue_1`, `@tdd_expected_fail` - [ ] Confirm tests fail on current codebase - [ ] Confirm tests pass after fix is applied ## Definition of Done This issue should be closed when: 1. The test file is created and merged 2. The tests are confirmed to fail on the current codebase 3. The corresponding bug fix (see linked bug issue) has been applied and the tests pass --- ## Summary Add a failing BDD/unit test that verifies `agents session tell --format json` emits a spec-compliant JSON envelope. The spec (docs/specification.md §agents session tell) explicitly shows a JSON envelope example for this command. ## Test Specification ```python # tests/cli/test_session_tell_json.py def test_session_tell_format_json_emits_envelope(runner, mock_session_service): """agents session tell --format json must emit JSON envelope per spec.""" result = runner.invoke(app, [ "session", "tell", "--session", "01HXYZ", "--format", "json", "Hello world" ]) assert result.exit_code == 0 output = json.loads(result.output) assert output["command"].startswith("agents session tell") assert output["status"] == "ok" assert output["exit_code"] == 0 assert "data" in output assert "session" in output["data"] assert "response" in output["data"] assert "timing" in output assert "messages" in output def test_session_tell_has_format_flag(runner): """agents session tell must accept --format flag.""" result = runner.invoke(app, ["session", "tell", "--help"]) assert "--format" in result.output ``` ## Tags - @tdd_issue - @tdd_issue_1 - @tdd_expected_fail ## Expected Failure The test currently fails because `session tell` in `src/cleveragents/cli/commands/session.py` (lines ~487-529) does NOT have a `--format` parameter. The function signature is: ```python @app.command() def tell( prompt: Annotated[str, typer.Argument(...)], session_id: Annotated[str, typer.Option("--session", ...)], actor: Annotated[str | None, typer.Option("--actor", ...)] = None, stream: Annotated[bool, typer.Option("--stream", ...)] = False, ) -> None: ``` No `--format` parameter exists. The spec (docs/specification.md) explicitly requires JSON envelope output for this command. ## Specification Reference From docs/specification.md, the `agents session tell` command requires JSON envelope: ```json { "command": "agents session tell --session 01HXM2A6K1 --stream \"What files were changed?\"", "status": "ok", "exit_code": 0, "data": { "session": { "id": "...", "actor": "...", "mode": "streaming" }, "response": "...", "files_changed": [...], "usage": { "tokens": 1240, "duration_s": 3.1, "tool_calls": 2 } }, "timing": { "duration_ms": 3100 }, "messages": [{ "level": "ok", "text": "Stream complete" }] } ``` ## Definition of Done - [ ] Test file created with the above test cases - [ ] Tests are tagged with `@tdd_issue`, `@tdd_issue_1`, `@tdd_expected_fail` - [ ] Tests fail on current codebase (confirming the bug exists) - [ ] Tests pass after the corresponding bug fix is applied --- **Automated by CleverAgents Bot** Supervisor: Bug Hunt Pool | Agent: bug-hunt-pool-supervisor
Author
Owner

[GROOMED] Quality Analysis Complete

Analysis Summary

Issue Validity: VALID - This is a legitimate TDD issue for adding failing tests for the missing --format flag in agents session tell command.

Issue Type: Type/Testing - This issue is about adding test cases that verify expected behavior before implementation.

Current Labels:

  • Priority/High ✓
  • State/Unverified → Changed to State/Verified

⚠️ Missing Label: Type/Testing - Attempted to add but label ID could not be determined due to API restrictions. The issue clearly requires this label based on its content (adding failing tests).

Grooming Actions Taken

  1. Assessed issue validity - VALID and actionable
  2. Updated State label from State/Unverified to State/Verified
  3. ⚠️ Type/Testing label could not be added (API access restrictions)
  4. Verified no existing [GROOMED] comments
  5. Confirmed issue is not assigned to a milestone (appropriate for backlog)

Issue Assessment

Title: cli/session: add failing test for session tell missing --format flag

Context: The agents session tell command is missing the --format flag entirely, which is required by the specification (docs/specification.md §agents session tell) for JSON envelope output.

Acceptance Criteria: Well-defined with specific test cases and tags (@tdd_issue, @tdd_issue_1, @tdd_expected_fail)

Definition of Done: Clear and measurable

Recommendation: READY FOR DEVELOPMENT - This issue is well-groomed and ready to be picked up by a developer.


Automated by CleverAgents Bot
Supervisor: Grooming | Agent: grooming-pool-supervisor

[GROOMED] Quality Analysis Complete ## Analysis Summary ✅ **Issue Validity**: VALID - This is a legitimate TDD issue for adding failing tests for the missing `--format` flag in `agents session tell` command. ✅ **Issue Type**: Type/Testing - This issue is about adding test cases that verify expected behavior before implementation. ✅ **Current Labels**: - Priority/High ✓ - State/Unverified → **Changed to State/Verified** ✓ ⚠️ **Missing Label**: Type/Testing - Attempted to add but label ID could not be determined due to API restrictions. The issue clearly requires this label based on its content (adding failing tests). ## Grooming Actions Taken 1. ✅ Assessed issue validity - VALID and actionable 2. ✅ Updated State label from State/Unverified to State/Verified 3. ⚠️ Type/Testing label could not be added (API access restrictions) 4. ✅ Verified no existing [GROOMED] comments 5. ✅ Confirmed issue is not assigned to a milestone (appropriate for backlog) ## Issue Assessment **Title**: `cli/session`: add failing test for `session tell` missing `--format` flag **Context**: The `agents session tell` command is missing the `--format` flag entirely, which is required by the specification (docs/specification.md §agents session tell) for JSON envelope output. **Acceptance Criteria**: Well-defined with specific test cases and tags (@tdd_issue, @tdd_issue_1, @tdd_expected_fail) **Definition of Done**: Clear and measurable **Recommendation**: READY FOR DEVELOPMENT - This issue is well-groomed and ready to be picked up by a developer. --- **Automated by CleverAgents Bot** Supervisor: Grooming | Agent: grooming-pool-supervisor
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#10465
No description provided.