UAT: LSP context enrichment (lsp_context_enrichment) not wired to ACMS hot context — diagnostics and type annotations are never injected #2476

Open
opened 2026-04-03 18:36:43 +00:00 by freemo · 1 comment
Owner

Metadata

Status: To Do
Priority: High
Effort:
Parent Epic: #824
Dependencies:

Summary

The LspContextEnrichment model exists in src/cleveragents/actor/schema.py and is referenced in the actor YAML schema (lsp_context_enrichment field), but there is no code anywhere in the codebase that actually reads this configuration and injects LSP diagnostics or type annotations into the ACMS hot context. The spec requires that LSP diagnostics and type info be automatically injected into the ACMS context when an actor activates with LSP bindings.

What Was Tested

  • Code analysis of src/cleveragents/actor/schema.py
  • Code analysis of src/cleveragents/lsp/runtime.py
  • Code analysis of src/cleveragents/application/services/ (all services)
  • Grep for lsp_context_enrichment across the entire codebase
  • Specification review of LSP context enrichment requirements

Expected Behavior (from spec)

Per docs/specification.md (lines 20529, 63):

"LSP capabilities — diagnostics, type information, symbol navigation, completions, references, rename, code actions, and more — are exposed to the actor as callable tools (via the LSPToolAdapter) and as automatic context enrichment (diagnostics and type annotations injected into the ACMS hot context)."

Per docs/specification.md (line 20310):

lsp_context_enrichment | object | No | Controls automatic LSP context enrichment. Keys: diagnostics (bool, default true), type_annotations (bool, default false), max_diagnostics_per_file (int, default 50).

When an actor activates with LSP bindings and lsp_context_enrichment.diagnostics: true (the default), the LSP runtime should:

  1. Retrieve diagnostics for files in the actor's workspace
  2. Inject them into the ACMS hot context as context fragments
  3. When type_annotations: true, also inject type annotation information

Actual Behavior

The LspContextEnrichment model is defined in src/cleveragents/actor/schema.py (lines 344-357) and referenced in ActorSchema.lsp_context_enrichment (line 766), but:

  1. No code in src/cleveragents/lsp/runtime.py reads lsp_context_enrichment configuration
  2. No code in src/cleveragents/application/services/ injects LSP diagnostics into ACMS context
  3. A grep for lsp_context_enrichment across src/ finds only the schema definition — no consumer

The LspContextEnrichment model is a dead field: it is parsed from YAML but never used.

Code Locations

  • src/cleveragents/actor/schema.py lines 344-357: LspContextEnrichment model (defined but never consumed)
  • src/cleveragents/actor/schema.py line 766: lsp_context_enrichment field on ActorSchema
  • src/cleveragents/lsp/runtime.py: no inject_context or enrichment method
  • src/cleveragents/application/services/: no service reads lsp_context_enrichment

Impact

Actors that rely on automatic LSP context enrichment (the default behavior) will not receive diagnostics or type annotations in their ACMS context. This silently degrades code intelligence for all actors with LSP bindings, since the primary value of LSP integration is context enrichment — not just on-demand tool calls.

Subtasks

  • Add enrich_context() method to LspRuntime that reads LspContextEnrichment config and fetches diagnostics/type info
  • Wire enrich_context() into the actor activation flow (when actor activates with LSP bindings)
  • Implement ACMS context fragment injection for LSP diagnostics (respecting max_diagnostics_per_file)
  • Implement ACMS context fragment injection for type annotations (when type_annotations: true)
  • Add BDD tests for context enrichment behavior
  • Verify all CI checks pass

Definition of Done

  • When an actor activates with LSP bindings and lsp_context_enrichment.diagnostics: true, LSP diagnostics are injected into the ACMS hot context
  • When type_annotations: true, type annotation info is also injected
  • max_diagnostics_per_file cap is respected
  • BDD tests cover the enrichment behavior
  • All CI checks pass
  • All nox stages pass
  • Coverage >= 97%

Branch & Commit

  • Branch: feat/lsp-context-enrichment-acms
  • Commit Message: feat(lsp): wire lsp_context_enrichment to ACMS hot context injection

Automated by CleverAgents Bot
Supervisor: UAT Testing | Agent: ca-new-issue-creator

## Metadata ```yaml Status: To Do Priority: High Effort: Parent Epic: #824 Dependencies: ``` ## Summary The `LspContextEnrichment` model exists in `src/cleveragents/actor/schema.py` and is referenced in the actor YAML schema (`lsp_context_enrichment` field), but there is no code anywhere in the codebase that actually reads this configuration and injects LSP diagnostics or type annotations into the ACMS hot context. The spec requires that LSP diagnostics and type info be automatically injected into the ACMS context when an actor activates with LSP bindings. ## What Was Tested - Code analysis of `src/cleveragents/actor/schema.py` - Code analysis of `src/cleveragents/lsp/runtime.py` - Code analysis of `src/cleveragents/application/services/` (all services) - Grep for `lsp_context_enrichment` across the entire codebase - Specification review of LSP context enrichment requirements ## Expected Behavior (from spec) Per `docs/specification.md` (lines 20529, 63): > "LSP capabilities — diagnostics, type information, symbol navigation, completions, references, rename, code actions, and more — are exposed to the actor as callable tools (via the `LSPToolAdapter`) and as **automatic context enrichment** (diagnostics and type annotations injected into the ACMS hot context)." Per `docs/specification.md` (line 20310): > `lsp_context_enrichment` | object | No | Controls automatic LSP context enrichment. Keys: `diagnostics` (bool, default `true`), `type_annotations` (bool, default `false`), `max_diagnostics_per_file` (int, default `50`). When an actor activates with LSP bindings and `lsp_context_enrichment.diagnostics: true` (the default), the LSP runtime should: 1. Retrieve diagnostics for files in the actor's workspace 2. Inject them into the ACMS hot context as context fragments 3. When `type_annotations: true`, also inject type annotation information ## Actual Behavior The `LspContextEnrichment` model is defined in `src/cleveragents/actor/schema.py` (lines 344-357) and referenced in `ActorSchema.lsp_context_enrichment` (line 766), but: 1. No code in `src/cleveragents/lsp/runtime.py` reads `lsp_context_enrichment` configuration 2. No code in `src/cleveragents/application/services/` injects LSP diagnostics into ACMS context 3. A grep for `lsp_context_enrichment` across `src/` finds only the schema definition — no consumer The `LspContextEnrichment` model is a dead field: it is parsed from YAML but never used. ## Code Locations - `src/cleveragents/actor/schema.py` lines 344-357: `LspContextEnrichment` model (defined but never consumed) - `src/cleveragents/actor/schema.py` line 766: `lsp_context_enrichment` field on `ActorSchema` - `src/cleveragents/lsp/runtime.py`: no `inject_context` or enrichment method - `src/cleveragents/application/services/`: no service reads `lsp_context_enrichment` ## Impact Actors that rely on automatic LSP context enrichment (the default behavior) will not receive diagnostics or type annotations in their ACMS context. This silently degrades code intelligence for all actors with LSP bindings, since the primary value of LSP integration is context enrichment — not just on-demand tool calls. ## Subtasks - [ ] Add `enrich_context()` method to `LspRuntime` that reads `LspContextEnrichment` config and fetches diagnostics/type info - [ ] Wire `enrich_context()` into the actor activation flow (when actor activates with LSP bindings) - [ ] Implement ACMS context fragment injection for LSP diagnostics (respecting `max_diagnostics_per_file`) - [ ] Implement ACMS context fragment injection for type annotations (when `type_annotations: true`) - [ ] Add BDD tests for context enrichment behavior - [ ] Verify all CI checks pass ## Definition of Done - [ ] When an actor activates with LSP bindings and `lsp_context_enrichment.diagnostics: true`, LSP diagnostics are injected into the ACMS hot context - [ ] When `type_annotations: true`, type annotation info is also injected - [ ] `max_diagnostics_per_file` cap is respected - [ ] BDD tests cover the enrichment behavior - [ ] All CI checks pass - [ ] All nox stages pass - [ ] Coverage >= 97% ## Branch & Commit - **Branch**: `feat/lsp-context-enrichment-acms` - **Commit Message**: `feat(lsp): wire lsp_context_enrichment to ACMS hot context injection` --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-new-issue-creator
freemo added this to the v3.6.0 milestone 2026-04-03 18:36:48 +00:00
Author
Owner

Issue triaged by project owner:

  • State: Verified
  • MoSCoW: Should Have — Spec compliance or quality improvement that should be included in the milestone.

Automated by CleverAgents Bot
Supervisor: Project Owner | Agent: ca-project-owner

Issue triaged by project owner: - **State**: Verified - **MoSCoW**: Should Have — Spec compliance or quality improvement that should be included in the milestone. --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: ca-project-owner
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#2476
No description provided.