From 726f48ad39d2b7eb8038422c6ca9f62425f2e2a7 Mon Sep 17 00:00:00 2001 From: HAL9000 Date: Mon, 27 Apr 2026 11:50:10 +0000 Subject: [PATCH] fix(actor): read lsp_binding from NodeDefinition field instead of config dict in compiler The _extract_lsp_bindings() function now reads from the dedicated typed node.lsp_binding (NodeLspBinding) field and converts it to LspBinding records. Also maintains backward compatibility by checking the config dict for legacy lsp_bindings configuration. Fixes the issue where per-node LSP bindings configured via the lsp_binding: YAML key were being silently ignored during actor graph compilation. ISSUES CLOSED: #1432 --- src/cleveragents/actor/compiler.py | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/cleveragents/actor/compiler.py b/src/cleveragents/actor/compiler.py index 7c381552d..bcdedc1dd 100644 --- a/src/cleveragents/actor/compiler.py +++ b/src/cleveragents/actor/compiler.py @@ -156,11 +156,36 @@ def _map_edge(edge: EdgeDefinition) -> lg_nodes.Edge: def _extract_lsp_bindings(node: NodeDefinition) -> list[LspBinding]: - """Extract LSP bindings from a node config block.""" + """Extract LSP bindings from a node's dedicated lsp_binding field. + + Reads from the typed ``node.lsp_binding`` (NodeLspBinding) field and + converts to LspBinding records. Also checks config dict for backward + compatibility with legacy ``lsp_bindings`` config key. + + Args: + node: The node definition to extract bindings from. + + Returns: + List of LspBinding records for this node. + """ bindings: list[LspBinding] = [] + + # Primary path: read from the dedicated typed field (NodeLspBinding) + if node.lsp_binding is not None: + bindings.append( + LspBinding( + node_name=node.id, + lsp_server_name=node.lsp_binding.server or "", + languages=node.lsp_binding.languages or [], + auto_detect=node.lsp_binding.auto if node.lsp_binding.auto is not None else True, + ) + ) + + # Fallback path: check config dict for backward compatibility 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 @@ -175,6 +200,7 @@ def _extract_lsp_bindings(node: NodeDefinition) -> list[LspBinding]: auto_detect=entry.get("auto_detect", True), ) ) + return bindings