BUG-HUNT: [error-handling] Silent failure on invalid LSP binding configuration #1316

Open
opened 2026-04-02 16:49:06 +00:00 by freemo · 0 comments
Owner

Bug Report: [error-handling] — Silent failure on invalid LSP binding configuration

Severity Assessment

  • Impact: Invalid LSP binding configurations are silently ignored, which can lead to unexpected behavior and make it difficult to debug actor configurations.
  • Likelihood: Medium. A user could easily make a mistake in the LSP binding configuration.
  • Priority: Medium

Location

  • File: src/cleveragents/actor/compiler.py
  • Function/Class: _extract_lsp_bindings
  • Lines: 135-140

Description

The _extract_lsp_bindings function in compiler.py checks if raw_bindings is a list and if each entry is a dictionary. If these checks fail, the function silently returns an empty list. This can hide configuration errors from the user.

Evidence

def _extract_lsp_bindings(node: NodeDefinition) -> list[LspBinding]:
    """Extract LSP bindings from a node config block."""
    bindings: list[LspBinding] = []
    raw_bindings = node.config.get("lsp_bindings", [])
    if not isinstance(raw_bindings, list):
        return bindings
    for entry in raw_bindings:
        if not isinstance(entry, dict):
            continue
        server = entry.get("lsp_server_name", "")
        if not server or not isinstance(server, str):
            continue
        bindings.append(
            LspBinding(
                node_name=node.id,
                lsp_server_name=server,
                languages=entry.get("languages", []),
                auto_detect=entry.get("auto_detect", True),
            )
        )
    return bindings

Expected Behavior

The function should log a warning or raise an exception when it encounters an invalid LSP binding configuration.

Actual Behavior

The function silently ignores the invalid configuration and returns an empty list.

Suggested Fix

Log a warning or raise a ValidationError when the LSP binding configuration is invalid.

Category

error-handling

## Bug Report: [error-handling] — Silent failure on invalid LSP binding configuration ### Severity Assessment - **Impact**: Invalid LSP binding configurations are silently ignored, which can lead to unexpected behavior and make it difficult to debug actor configurations. - **Likelihood**: Medium. A user could easily make a mistake in the LSP binding configuration. - **Priority**: Medium ### Location - **File**: `src/cleveragents/actor/compiler.py` - **Function/Class**: `_extract_lsp_bindings` - **Lines**: 135-140 ### Description The `_extract_lsp_bindings` function in `compiler.py` checks if `raw_bindings` is a list and if each entry is a dictionary. If these checks fail, the function silently returns an empty list. This can hide configuration errors from the user. ### Evidence ```python def _extract_lsp_bindings(node: NodeDefinition) -> list[LspBinding]: """Extract LSP bindings from a node config block.""" bindings: list[LspBinding] = [] raw_bindings = node.config.get("lsp_bindings", []) if not isinstance(raw_bindings, list): return bindings for entry in raw_bindings: if not isinstance(entry, dict): continue server = entry.get("lsp_server_name", "") if not server or not isinstance(server, str): continue bindings.append( LspBinding( node_name=node.id, lsp_server_name=server, languages=entry.get("languages", []), auto_detect=entry.get("auto_detect", True), ) ) return bindings ``` ### Expected Behavior The function should log a warning or raise an exception when it encounters an invalid LSP binding configuration. ### Actual Behavior The function silently ignores the invalid configuration and returns an empty list. ### Suggested Fix Log a warning or raise a `ValidationError` when the LSP binding configuration is invalid. ### Category error-handling
freemo self-assigned this 2026-04-02 18:45:24 +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#1316
No description provided.