UAT: lsp/code-actions tool input schema uses position-based params instead of spec-required range params (start_line, start_col, end_line, end_col) #4880

Open
opened 2026-04-08 20:12:48 +00:00 by HAL9000 · 0 comments
Owner

Bug Report

Feature Area: LSP Integration — LSPToolAdapter

What Was Tested

Code analysis of src/cleveragents/lsp/tool_adapter.py against ADR-027 (Language Server Protocol Integration).

Expected Behavior (from spec)

ADR-027 specifies the lsp/code-actions tool signature as:

lsp/code-actions(file_path: str, start_line: int, start_col: int, end_line: int, end_col: int) -> list[CodeAction]

This is a range-based operation — code actions apply to a selection range, not a single cursor position. This matches the LSP protocol's textDocument/codeAction which takes a Range parameter with start and end positions.

Actual Behavior

In tool_adapter.py, CODE_ACTIONS is placed in _POSITION_BASED_CAPABILITIES:

_POSITION_BASED_CAPABILITIES = (
    LspCapability.HOVER,
    LspCapability.COMPLETIONS,
    LspCapability.DEFINITIONS,
    LspCapability.REFERENCES,
    LspCapability.CODE_ACTIONS,   # ← Wrong! Should be range-based
    LspCapability.SIGNATURE_HELP,
)

This generates an input schema with only file_path, line, column — missing start_line, start_col, end_line, end_col.

The _make_runtime_handler also doesn't handle CODE_ACTIONS at all (falls through to the "not yet implemented" error), so even if the schema were correct, the handler would fail.

Impact

  • Actors calling lsp/code-actions with the spec-documented parameters (start_line, start_col, end_line, end_col) will get validation errors
  • The tool schema exposed to the LLM is incorrect, causing the LLM to generate wrong tool calls
  • Code action requests (quick fixes, refactors) cannot be properly scoped to a selection range

Code Location

src/cleveragents/lsp/tool_adapter.py:

  1. CODE_ACTIONS should be removed from _POSITION_BASED_CAPABILITIES
  2. A new _RANGE_BASED_CAPABILITIES tuple should be added:
    _RANGE_BASED_CAPABILITIES = (LspCapability.CODE_ACTIONS,)
    
  3. _input_schema_for() should handle range-based capabilities with start_line, start_col, end_line, end_col parameters
  4. _make_runtime_handler() should route CODE_ACTIONS to runtime.get_code_actions(name, file_path, start_line, start_col, end_line, end_col)

Steps to Reproduce

  1. Create LspToolAdapter and call _input_schema_for(LspCapability.CODE_ACTIONS)
  2. Observe schema has file_path, line, column instead of file_path, start_line, start_col, end_line, end_col

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

## Bug Report **Feature Area:** LSP Integration — LSPToolAdapter ### What Was Tested Code analysis of `src/cleveragents/lsp/tool_adapter.py` against ADR-027 (Language Server Protocol Integration). ### Expected Behavior (from spec) ADR-027 specifies the `lsp/code-actions` tool signature as: ``` lsp/code-actions(file_path: str, start_line: int, start_col: int, end_line: int, end_col: int) -> list[CodeAction] ``` This is a **range-based** operation — code actions apply to a selection range, not a single cursor position. This matches the LSP protocol's `textDocument/codeAction` which takes a `Range` parameter with `start` and `end` positions. ### Actual Behavior In `tool_adapter.py`, `CODE_ACTIONS` is placed in `_POSITION_BASED_CAPABILITIES`: ```python _POSITION_BASED_CAPABILITIES = ( LspCapability.HOVER, LspCapability.COMPLETIONS, LspCapability.DEFINITIONS, LspCapability.REFERENCES, LspCapability.CODE_ACTIONS, # ← Wrong! Should be range-based LspCapability.SIGNATURE_HELP, ) ``` This generates an input schema with only `file_path`, `line`, `column` — missing `start_line`, `start_col`, `end_line`, `end_col`. The `_make_runtime_handler` also doesn't handle CODE_ACTIONS at all (falls through to the "not yet implemented" error), so even if the schema were correct, the handler would fail. ### Impact - Actors calling `lsp/code-actions` with the spec-documented parameters (`start_line`, `start_col`, `end_line`, `end_col`) will get validation errors - The tool schema exposed to the LLM is incorrect, causing the LLM to generate wrong tool calls - Code action requests (quick fixes, refactors) cannot be properly scoped to a selection range ### Code Location `src/cleveragents/lsp/tool_adapter.py`: 1. `CODE_ACTIONS` should be removed from `_POSITION_BASED_CAPABILITIES` 2. A new `_RANGE_BASED_CAPABILITIES` tuple should be added: ```python _RANGE_BASED_CAPABILITIES = (LspCapability.CODE_ACTIONS,) ``` 3. `_input_schema_for()` should handle range-based capabilities with `start_line`, `start_col`, `end_line`, `end_col` parameters 4. `_make_runtime_handler()` should route `CODE_ACTIONS` to `runtime.get_code_actions(name, file_path, start_line, start_col, end_line, end_col)` ### Steps to Reproduce 1. Create `LspToolAdapter` and call `_input_schema_for(LspCapability.CODE_ACTIONS)` 2. Observe schema has `file_path`, `line`, `column` instead of `file_path`, `start_line`, `start_col`, `end_line`, `end_col` --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: uat-tester
HAL9000 added this to the v3.5.0 milestone 2026-04-08 20:15:57 +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#4880
No description provided.