feat(lsp): implement functional LSP runtime (start/stop/diagnostics/completions) #826

Closed
opened 2026-03-13 20:14:40 +00:00 by freemo · 0 comments
Owner

Metadata

  • Commit Message: feat(lsp): implement functional LSP runtime
  • Branch: feature/lsp-functional-runtime
  • Type: Feature
  • Priority: Medium
  • MoSCoW: Should have
  • Points: 13
  • Milestone: v3.6.0

Background and Context

The specification defines LSP integration as a core capability where LspRuntime manages LSP server processes and provides code intelligence (diagnostics, completions, hover, definitions, etc.) to actors. The current implementation in src/cleveragents/lsp/runtime.py raises LspNotAvailableError for every method: start_server(), stop_server(), get_diagnostics(), get_completions(). Similarly, LspToolAdapter in tool_adapter.py generates tool specifications but every handler raises LspNotAvailableError.

The actor compiler (src/cleveragents/actor/compiler.py) collects LSP bindings from actor YAML but nothing downstream consumes them. No actor activation integration exists, and no ACMS context enrichment uses LSP data.

This issue covers making the LSP runtime functional: starting real LSP server processes, communicating via the LSP protocol (JSON-RPC over stdio/TCP), and returning real diagnostics and completions.

Acceptance Criteria

  • LspRuntime.start_server(config) starts a real LSP server process using the configured command and transport
  • LspRuntime.stop_server(server_id) gracefully shuts down the LSP server process
  • LspRuntime.get_diagnostics(server_id, uri) returns real diagnostics from the running LSP server
  • LspRuntime.get_completions(server_id, uri, position) returns real completion items
  • LspToolAdapter handlers delegate to LspRuntime instead of raising errors
  • LSP server lifecycle is managed (auto-restart on crash, health checks)
  • Actor compiler LSP bindings are consumed to auto-start relevant LSP servers on actor activation
  • Language discovery (4-layer process from spec) identifies available LSP servers for a project

Definition of Done

This issue is complete when:

  • All subtasks below are completed and checked off.
  • A Git commit is created where the first line of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details about the implementation.
  • The commit is pushed to the remote on the branch matching the Branch in Metadata exactly.
  • The commit is submitted as a pull request to master, reviewed, and merged before this issue is marked done.

Subtasks

  • Implement LSP JSON-RPC protocol client (initialize, shutdown, exit lifecycle)
  • Implement stdio transport for LSP communication
  • Replace LspNotAvailableError in LspRuntime methods with real LSP protocol calls
  • Replace LspNotAvailableError in LspToolAdapter handlers with delegation to runtime
  • Implement LSP server lifecycle management (health check, auto-restart)
  • Wire actor compiler LSP bindings to auto-start servers on actor activation
  • Implement 4-layer language discovery process from spec
  • Tests (Behave): Add scenarios for LSP server start/stop/query lifecycle
  • Tests (Robot): Add integration test with a real LSP server (e.g., pyright)
  • Verify coverage >=97% via nox -s coverage_report
  • Run nox (all default sessions), fix any errors
## Metadata - **Commit Message**: `feat(lsp): implement functional LSP runtime` - **Branch**: `feature/lsp-functional-runtime` - **Type**: Feature - **Priority**: Medium - **MoSCoW**: Should have - **Points**: 13 - **Milestone**: v3.6.0 ## Background and Context The specification defines LSP integration as a core capability where `LspRuntime` manages LSP server processes and provides code intelligence (diagnostics, completions, hover, definitions, etc.) to actors. The current implementation in `src/cleveragents/lsp/runtime.py` raises `LspNotAvailableError` for every method: `start_server()`, `stop_server()`, `get_diagnostics()`, `get_completions()`. Similarly, `LspToolAdapter` in `tool_adapter.py` generates tool specifications but every handler raises `LspNotAvailableError`. The actor compiler (`src/cleveragents/actor/compiler.py`) collects LSP bindings from actor YAML but nothing downstream consumes them. No actor activation integration exists, and no ACMS context enrichment uses LSP data. This issue covers making the LSP runtime functional: starting real LSP server processes, communicating via the LSP protocol (JSON-RPC over stdio/TCP), and returning real diagnostics and completions. ## Acceptance Criteria - [x] `LspRuntime.start_server(config)` starts a real LSP server process using the configured command and transport - [x] `LspRuntime.stop_server(server_id)` gracefully shuts down the LSP server process - [x] `LspRuntime.get_diagnostics(server_id, uri)` returns real diagnostics from the running LSP server - [x] `LspRuntime.get_completions(server_id, uri, position)` returns real completion items - [x] `LspToolAdapter` handlers delegate to `LspRuntime` instead of raising errors - [x] LSP server lifecycle is managed (auto-restart on crash, health checks) - [x] Actor compiler LSP bindings are consumed to auto-start relevant LSP servers on actor activation - [x] Language discovery (4-layer process from spec) identifies available LSP servers for a project ## Definition of Done This issue is complete when: - All subtasks below are completed and checked off. - A Git commit is created where the **first line** of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details about the implementation. - The commit is pushed to the remote on the branch matching the **Branch** in Metadata exactly. - The commit is submitted as a **pull request** to `master`, reviewed, and **merged** before this issue is marked done. ## Subtasks - [x] Implement LSP JSON-RPC protocol client (initialize, shutdown, exit lifecycle) - [x] Implement stdio transport for LSP communication - [x] Replace `LspNotAvailableError` in `LspRuntime` methods with real LSP protocol calls - [x] Replace `LspNotAvailableError` in `LspToolAdapter` handlers with delegation to runtime - [x] Implement LSP server lifecycle management (health check, auto-restart) - [x] Wire actor compiler LSP bindings to auto-start servers on actor activation - [x] Implement 4-layer language discovery process from spec - [x] Tests (Behave): Add scenarios for LSP server start/stop/query lifecycle - [x] Tests (Robot): Add integration test with a real LSP server (e.g., pyright) - [x] Verify coverage >=97% via `nox -s coverage_report` - [x] Run `nox` (all default sessions), fix any errors
freemo added this to the v3.6.0 milestone 2026-03-13 20:19:59 +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.

Blocks
#824 Epic: LSP Functional Runtime
cleveragents/cleveragents-core
Reference
cleveragents/cleveragents-core#826
No description provided.