Fix: surface a mid-indexing tsserver crash instead of returning {} - #1848
Open
AmirF194 wants to merge 1 commit into
Open
Fix: surface a mid-indexing tsserver crash instead of returning {}#1848AmirF194 wants to merge 1 commit into
AmirF194 wants to merge 1 commit into
Conversation
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
force-pushed
the
fix/1814-tsserver-crash-silent-empty-result
branch
from
August 13, 2026 12:18
5bd0150 to
ffcb66b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Root cause
_wait_for_indexing_start_or_completion(and its underlyingwait_for_indexing) inferproject-indexing completion purely from
$/progresstoken bookkeeping: when the activetoken set drains,
_indexing_completeis set and the wait returnsTrue. Whentsserveraborts (e.g. a V8 heap OOM mid cross-file query),
typescript-language-serversends a$/progress"end" for the in-flight token as part of tearing its connection down, whichis structurally identical to a normal completion.
_wait_for_cross_file_references_if_neededthen logs "TypeScript cross-file indexing complete" and
find_referencing_symbolsreturns{}withisError: 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_messageflag (set fromwindow_log_messagevia a small_tsserver_exit_messageclassifier), and raise a newTypeScriptServerCrashedErrorfrom every path that would otherwise report indexing ascomplete:
wait_for_indexing, and both early-return branches of_wait_for_indexing_start_or_completion(not just its tail call intowait_for_indexing,since a crash observed within the same poll interval as its own
$/progressbegin/end cantake either early-return branch). This covers the Vue and Svelte companion TypeScript
servers too, since both hold a
TypeScriptLanguageServerinstance and inheritwindow_log_messagevia_start_server.Verification
test/solidlsp/test_typescript_timeout_policy.py::TestTsserverCrashDetection(new): drivesthe reporter's exact
$/progress begin-> crashwindow/logMessage->$/progress endsequence and pins that
wait_for_indexing, both branches of_wait_for_indexing_start_or_completion, and_wait_for_cross_file_references_if_neededall now raise
TypeScriptServerCrashedErrorinstead of returningTrue/{}; also pinsthat an ordinary completion (no crash message) is unaffected.
test_typescript_timeout_policy.pysuite (29 tests, all pre-existing + new): passesin a clean
python:3.11-slimcontainer.ruff format --check,ruff check,ty check(pinnedruff==0.12.5, matching CI): cleanon both changed files.
window/logMessagehandler registered inside_start_serveragainst a real
tsservercrash, since that requires a live language-server process. Theclassification logic it delegates to (
_tsserver_exit_message) is unit-tested directly.Fixes #1814