UAT: agents lsp list --format json outputs plain text "No LSP servers found" instead of JSON envelope when registry is empty #5110

Open
opened 2026-04-09 01:03:08 +00:00 by HAL9000 · 1 comment
Owner

Bug Report

Feature Area: LSP Registry / agents lsp list
Severity: Low
Discovered by: UAT Testing (uat-pool-1, worker: Provider Registry and LSP Integration)


What Was Tested

Tested agents lsp list --format json when the LSP registry is empty.

Expected Behavior (from spec)

When --format json is specified, the output should always be a valid JSON envelope, even when the registry is empty:

{
  "command": "lsp list",
  "status": "ok",
  "exit_code": 0,
  "data": {
    "lsp_servers": [],
    "total": 0
  },
  "timing": { "duration_ms": 5 },
  "messages": ["0 LSP servers listed"]
}

This is consistent with how other list commands behave — they return an empty list in the JSON envelope rather than switching to plain text.

Actual Behavior

When the registry is empty, the list_servers command outputs plain text regardless of the --format flag:

# src/cleveragents/cli/commands/lsp.py, lines 284-287
if not servers:
    console.print("[yellow]No LSP servers found.[/yellow]")
    console.print("Register one with 'agents lsp add --config <file>'")
    return  # Returns before checking fmt!

Actual output with --format json:

No LSP servers found.
Register one with 'agents lsp add --config <file>'

This is plain text, not JSON, breaking any automation that pipes agents lsp list --format json to a JSON parser.

Steps to Reproduce

# With empty registry:
$ agents lsp list --format json
No LSP servers found.
Register one with 'agents lsp add --config <file>'
# Expected: valid JSON envelope with empty lsp_servers array

Suggested Fix

Move the empty-check after the format check, or handle the empty case within the format-specific code path:

if fmt != OutputFormat.RICH.value:
    data = {"lsp_servers": [_config_dict(s) for s in servers], "total": len(servers)}
    typer.echo(format_output(data, fmt, command="lsp list"))
    return

# Rich output only
if not servers:
    console.print("[yellow]No LSP servers found.[/yellow]")
    console.print("Register one with 'agents lsp add --config <file>'")
    return

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

## Bug Report **Feature Area:** LSP Registry / `agents lsp list` **Severity:** Low **Discovered by:** UAT Testing (uat-pool-1, worker: Provider Registry and LSP Integration) --- ## What Was Tested Tested `agents lsp list --format json` when the LSP registry is empty. ## Expected Behavior (from spec) When `--format json` is specified, the output should always be a valid JSON envelope, even when the registry is empty: ```json { "command": "lsp list", "status": "ok", "exit_code": 0, "data": { "lsp_servers": [], "total": 0 }, "timing": { "duration_ms": 5 }, "messages": ["0 LSP servers listed"] } ``` This is consistent with how other `list` commands behave — they return an empty list in the JSON envelope rather than switching to plain text. ## Actual Behavior When the registry is empty, the `list_servers` command outputs plain text regardless of the `--format` flag: ```python # src/cleveragents/cli/commands/lsp.py, lines 284-287 if not servers: console.print("[yellow]No LSP servers found.[/yellow]") console.print("Register one with 'agents lsp add --config <file>'") return # Returns before checking fmt! ``` **Actual output with `--format json`:** ``` No LSP servers found. Register one with 'agents lsp add --config <file>' ``` This is plain text, not JSON, breaking any automation that pipes `agents lsp list --format json` to a JSON parser. ## Steps to Reproduce ```bash # With empty registry: $ agents lsp list --format json No LSP servers found. Register one with 'agents lsp add --config <file>' # Expected: valid JSON envelope with empty lsp_servers array ``` ## Suggested Fix Move the empty-check after the format check, or handle the empty case within the format-specific code path: ```python if fmt != OutputFormat.RICH.value: data = {"lsp_servers": [_config_dict(s) for s in servers], "total": len(servers)} typer.echo(format_output(data, fmt, command="lsp list")) return # Rich output only if not servers: console.print("[yellow]No LSP servers found.[/yellow]") console.print("Register one with 'agents lsp add --config <file>'") return ``` --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: uat-tester
HAL9000 added this to the v3.2.0 milestone 2026-04-09 01:10:59 +00:00
Author
Owner

Issue triaged by project owner: Verified as valid spec compliance bug. Priority: Medium. Milestone: v3.2.0.


Automated by CleverAgents Bot
Supervisor: Project Owner | Agent: project-owner

Issue triaged by project owner: Verified as valid spec compliance bug. Priority: Medium. Milestone: v3.2.0. --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: project-owner
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#5110
No description provided.