UAT: LspLifecycleManager.restart_server() does not re-open tracked documents after crash recovery #5697

Open
opened 2026-04-09 08:39:15 +00:00 by HAL9000 · 1 comment
Owner

Summary

The spec requires that when a language server crashes and is restarted, the LSP Runtime re-opens all tracked documents so the server can re-analyze them. However, LspLifecycleManager.restart_server() only performs the initialize handshake — it does not re-send textDocument/didOpen for any previously opened documents.

Expected Behavior (from spec §LSP Integration — Crash Recovery)

Crash Recovery — If a language server process crashes, the LSP Runtime restarts it automatically, re-sends the initialize handshake, re-opens tracked documents, and resumes operations without disrupting the actor's execution.

Actual Behavior

In src/cleveragents/lsp/lifecycle.py, restart_server():

def restart_server(self, name: str) -> LspClient:
    ...
    # Phase 2: Blocking I/O — no lock held
    old_transport.stop()
    transport = StdioTransport(...)
    transport.start()
    client = LspClient(transport, server_name=name)
    try:
        client.initialize(workspace_path)  # ← only initialize, no document re-open
    except Exception:
        transport.stop()
        raise
    ...

After restart, the new LspClient has an empty _diagnostics dict and no knowledge of previously opened documents. If the actor subsequently calls get_diagnostics() for a file that was open before the crash, it will get stale or empty results until the file is explicitly re-opened.

Additionally, LspLifecycleManager has no tracking of which documents are currently open — there is no _open_documents set or similar structure to know what needs to be re-opened after a restart.

Code Location

  • src/cleveragents/lsp/lifecycle.py lines 130-185 — restart_server() missing document re-open
  • src/cleveragents/lsp/lifecycle.py_ManagedServer has no open_documents tracking

Impact

After a server crash and restart, actors will get empty diagnostics for files they had previously opened, silently masking errors. The spec's guarantee of "resumes operations without disrupting the actor's execution" is not met.


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

## Summary The spec requires that when a language server crashes and is restarted, the LSP Runtime re-opens all tracked documents so the server can re-analyze them. However, `LspLifecycleManager.restart_server()` only performs the `initialize` handshake — it does not re-send `textDocument/didOpen` for any previously opened documents. ## Expected Behavior (from spec §LSP Integration — Crash Recovery) > **Crash Recovery** — If a language server process crashes, the LSP Runtime restarts it automatically, re-sends the `initialize` handshake, **re-opens tracked documents**, and resumes operations without disrupting the actor's execution. ## Actual Behavior In `src/cleveragents/lsp/lifecycle.py`, `restart_server()`: ```python def restart_server(self, name: str) -> LspClient: ... # Phase 2: Blocking I/O — no lock held old_transport.stop() transport = StdioTransport(...) transport.start() client = LspClient(transport, server_name=name) try: client.initialize(workspace_path) # ← only initialize, no document re-open except Exception: transport.stop() raise ... ``` After restart, the new `LspClient` has an empty `_diagnostics` dict and no knowledge of previously opened documents. If the actor subsequently calls `get_diagnostics()` for a file that was open before the crash, it will get stale or empty results until the file is explicitly re-opened. Additionally, `LspLifecycleManager` has no tracking of which documents are currently open — there is no `_open_documents` set or similar structure to know what needs to be re-opened after a restart. ## Code Location - `src/cleveragents/lsp/lifecycle.py` lines 130-185 — `restart_server()` missing document re-open - `src/cleveragents/lsp/lifecycle.py` — `_ManagedServer` has no `open_documents` tracking ## Impact After a server crash and restart, actors will get empty diagnostics for files they had previously opened, silently masking errors. The spec's guarantee of "resumes operations without disrupting the actor's execution" is not met. --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: uat-tester
HAL9000 added this to the v3.2.0 milestone 2026-04-09 08:46:46 +00:00
Author
Owner

Label compliance fix applied:

  • Added missing labels and/or milestone to bring issue into compliance with CONTRIBUTING.md

Automated by CleverAgents Bot
Supervisor: Backlog Grooming | Agent: backlog-groomer

Label compliance fix applied: - Added missing labels and/or milestone to bring issue into compliance with CONTRIBUTING.md --- **Automated by CleverAgents Bot** Supervisor: Backlog Grooming | Agent: backlog-groomer
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.

Reference
cleveragents/cleveragents-core#5697
No description provided.