Skip to content

[BUG-05] --lsp-status has two entry points with different payload shapes #33

Description

@Wolfvin

Summary

codelens --lsp-status (top-level flag) and codelens lsp-status (subcommand) return different payload shapes, despite the documentation treating them as the same operation.

Evidence

Path A — top-level flag (scripts/codelens.py:829-837):

# Handle --lsp-status as a special top-level flag (not a subcommand)
if "--lsp-status" in sys.argv:
    try:
        from hybrid_engine import get_lsp_status
        status = get_lsp_status()
        print(format_output(status, _default_format, "lsp-status"))
        sys.exit(0)
    except Exception as e:
        ...

Returns: hybrid_engine.get_lsp_status() payload.

Path B — subcommand (scripts/commands/lsp_status.py, auto-registered as "lsp-status"):
Calls lsp_client.detect_available_servers() and returns its payload.

The two functions (hybrid_engine.get_lsp_status vs lsp_client.detect_available_servers) are defined in different modules and emit different JSON shapes.

Impact

  1. User confusion: codelens --lsp-status and codelens lsp-status look interchangeable in docs but produce different output. AI agents that parse the response schema have to handle two shapes.
  2. MCP exposure: The MCP server exposes only the subcommand path (codelens_lsp_status -> lsp_client). CLI users typing --lsp-status get a different result than MCP clients calling the tool with the same name.
  3. Documentation drift: SKILL-QUICK.md mentions only lsp-status; the top-level --lsp-status flag is undocumented in the trigger map but intercepted in code.

Repro

diff <(python3 scripts/codelens.py --lsp-status --format json | python3 -m json.tool) \
     <(python3 scripts/codelens.py lsp-status --format json | python3 -m json.tool)
# Output differs (different top-level keys, different per-server fields).

Suggested fix

Pick one of:

  • (A) Consolidate on the subcommand. Remove the top-level --lsp-status interception in codelens.py:829-837. Update commands/lsp_status.py to call hybrid_engine.get_lsp_status() (the richer payload) instead of lsp_client.detect_available_servers(). This makes CLI and MCP behavior identical.
  • (B) Keep both but unify the payload. Make lsp_client.detect_available_servers() and hybrid_engine.get_lsp_status() return the same schema, and document both entry points explicitly in SKILL-QUICK.md trigger map.

Either way, add a test that asserts both invocations produce structurally-equal JSON (same top-level keys).

Files

  • scripts/codelens.py (L829-837)
  • scripts/commands/lsp_status.py
  • scripts/hybrid_engine.py (get_lsp_status)
  • scripts/lsp_client.py (detect_available_servers)
  • SKILL-QUICK.md (trigger map)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions