Repository navigation
fix(lsp): hold tsserver during editor refreshes and fail fast on a stalled assertion - #264
Merged
Merged
Conversation
…alled assertion On a warm disk cache, Bazel deletes a changed output and writes its cached replacement within about a millisecond. When tsserver handles the deletion in that window, its fs-event watcher finds the path missing and falls back to a poller whose first stat already sees the new file. That poller reports only creations, so tsserver keeps the stale declaration for the rest of the session, and the editor test retried it until the enclosing test deadline. The editor test now stops both tsserver processes while a refresh runs, so they handle each replacement only after it is complete. A check that fails with the same assertion for 30 s now throws instead of waiting for the deadline. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Problem
//tests/integration:lsp_testintermittently runs into its 3600 s timeout in CI. It fails three times out of three on some branches; onmainit passes or fails depending on cache state.During its editor session, a generated member is deleted and
refresh_generatedruns. tsserver then keeps offering the deleted member, e.g.awaiting assertion: removedMembers.removed: completion membership.generated_editor_test.mjsretries that check every 250 ms until the test deadline, with logging off once the message repeats, so a precise assertion failure became a silent one-hour timeout.Root cause
It only happens with a warm disk cache, which CI's shared integration cache provides.
first.d.tsdeleted, thenChanging watcher to MissingFileSystemEntryWatcher, and no "created" event ever follows. In the next phase the file is replaced on disk with no event at all. SendingreloadProjectsmakes the stuck check pass immediately.What changes
tests/lsp/generated_editor_test.mjspauses the running tsserver processes (SIGSTOP) for the duration of each refresh and resumes them (SIGCONT, in afinally). tsserver then handles each replacement only once it is complete: its existence check finds the new file and it watches the new inode.docs/getting-started/ide-setup.mddocuments the editor-side limitation: after a refresh served from a cache, tsserver's own watcher can keep a stale generated declaration until the TS server restarts.The ruleset's refresh is unchanged. Rewriting or touching the file cannot help once the watcher has died: a dead watcher ignores "changed", and "created" only fires if a poll sees the path missing. Disabling the disk cache for the test rebuilt about 1,350 actions per pass and still hit the timeout once.
Verification
All on the remote runner. A "warm pass" reruns the test with a shared
RULES_TS_IT_SCRATCH, so its nested Bazel sees a warm disk cache.//tests/lsp/...passes 11 of 11, and//tests/integration:lsp_testpasses with its normal settings.Risks
🤖 Generated with Claude Code