Skip to content

Fix: surface a mid-indexing tsserver crash instead of returning {} - #1848

Open
AmirF194 wants to merge 1 commit into
oraios:mainfrom
AmirF194:fix/1814-tsserver-crash-silent-empty-result
Open

Fix: surface a mid-indexing tsserver crash instead of returning {}#1848
AmirF194 wants to merge 1 commit into
oraios:mainfrom
AmirF194:fix/1814-tsserver-crash-silent-empty-result

Conversation

@AmirF194

Copy link
Copy Markdown
Contributor

Root cause

_wait_for_indexing_start_or_completion (and its underlying wait_for_indexing) infer
project-indexing completion purely from $/progress token bookkeeping: when the active
token set drains, _indexing_complete is set and the wait returns True. When tsserver
aborts (e.g. a V8 heap OOM mid cross-file query), typescript-language-server sends a
$/progress "end" for the in-flight token as part of tearing its connection down, which
is structurally identical to a normal completion. _wait_for_cross_file_references_if_needed
then logs "TypeScript cross-file indexing complete" and find_referencing_symbols returns
{} with isError: false, indistinguishable from a symbol that genuinely has no references.

The crash is already observed independently, via window/logMessage (type: 1/Error,
"[tsserver] Exited. Code: null. Signal: SIGABRT"), but the handler only logged it.

Fix

Wire that already-received signal into a _crash_message flag (set from
window_log_message via a small _tsserver_exit_message classifier), and raise a new
TypeScriptServerCrashedError from every path that would otherwise report indexing as
complete: wait_for_indexing, and both early-return branches of
_wait_for_indexing_start_or_completion (not just its tail call into wait_for_indexing,
since a crash observed within the same poll interval as its own $/progress begin/end can
take either early-return branch). This covers the Vue and Svelte companion TypeScript
servers too, since both hold a TypeScriptLanguageServer instance and inherit
window_log_message via _start_server.

Verification

  • test/solidlsp/test_typescript_timeout_policy.py::TestTsserverCrashDetection (new): drives
    the reporter's exact $/progress begin -> crash window/logMessage -> $/progress end
    sequence and pins that wait_for_indexing, both branches of
    _wait_for_indexing_start_or_completion, and _wait_for_cross_file_references_if_needed
    all now raise TypeScriptServerCrashedError instead of returning True/{}; also pins
    that an ordinary completion (no crash message) is unaffected.
  • Full test_typescript_timeout_policy.py suite (29 tests, all pre-existing + new): passes
    in a clean python:3.11-slim container.
  • ruff format --check, ruff check, ty check (pinned ruff==0.12.5, matching CI): clean
    on both changed files.
  • Not verified: the actual window/logMessage handler registered inside _start_server
    against a real tsserver crash, since that requires a live language-server process. The
    classification logic it delegates to (_tsserver_exit_message) is unit-tested directly.

Fixes #1814

typescript-language-server sends a $/progress "end" for the in-flight
token as part of tearing its connection down after tsserver aborts (e.g.
a V8 heap OOM). _wait_for_indexing_start_or_completion could not
distinguish that from a real completion, so find_referencing_symbols
logged "TypeScript cross-file indexing complete" and returned {} with
isError: false, indistinguishable from a symbol genuinely having no
references.

The crash is already observed independently via window/logMessage
(type Error, "[tsserver] Exited"), but the handler only logged it. Wire
that signal into a _crash_message flag and raise TypeScriptServerCrashedError
from every path that would otherwise report indexing as complete
(wait_for_indexing and both early-return branches of
_wait_for_indexing_start_or_completion), so a crash propagates as a tool
error instead of a silent empty result.

Fixes oraios#1814
@AmirF194
AmirF194 force-pushed the fix/1814-tsserver-crash-silent-empty-result branch from 5bd0150 to ffcb66b Compare August 13, 2026 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

find_referencing_symbols silently returns {} after tsserver dies of OOM — reported as "cross-file indexing complete", isError: false

1 participant