Skip to content

fix: a language server that reports a progress no longer hangs in a headless application - #2344

Merged
lagergren merged 1 commit into
redhat-developer:mainfrom
lagergren:fix/progress-headless
Nov 30, 2026
Merged

lagergren merged 1 commit into
redhat-developer:mainfrom
lagergren:fix/progress-headless

Conversation

@lagergren

Copy link
Copy Markdown
Collaborator

Fixes #2342, for 0.30.3.

Behaviour change

Commit Change
fix: a language server that reports a progress no longer hangs in a headless application A $/progress task now starts on a pooled thread, not on the thread that reads the language server's messages. In a headless application, such as the tests of a plugin built on LSP4IJ or a headless run of the IDE, the platform used to run the task in the reading thread. That thread then read no further message, so every request waited forever. With a UI, the task already ran in the background, so the IDE behaves as before.

Tests

  • ProgressInHeadlessModeTest: the mock language server reports a progress, then the client asks for a hover, and the answer must arrive within 10 s. Against main it fails, because the answer is never read.
  • Workspace diagnostics tests: 67 tests, which report partial results through $/progress, pass.
  • Full suite: passes on macOS with IC 2024.2: 2,653 tests, 0 failures, 0 errors, 7 skipped.
  • Live check: in a headless test IDE, with gopls 0.24.0, rust-analyzer 2026-11-22 and jdtls 1.64.0-SNAPSHOT, which all report progress at start. Before the fix gopls hung. With it, all three answer, and their progress goes through LSPProgressManager.

Not checked

  • The progress bar in the IDE with a UI, where the task now starts one hop later, from a pooled thread.

…eadless application

LSPProgressManager started the task of a progress with
ProgressManager.run(Task.Backgroundable) in the thread that notifies it,
which reads the messages of the language server. In a headless
application, as in the tests of a plugin built on LSP4IJ or a headless run
of the IDE, the platform runs a background task in the thread that starts
it, so that thread looped on the progress and read no further message,
its end included: every request to the language server waited forever.
The task is now started from a pooled thread. With a UI, it ran in the
background already.

Fixes redhat-developer#2342
@lagergren lagergren added this to the 0.30.3 milestone Nov 28, 2026
@lagergren lagergren added bug Something isn't working $/progress https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#progress labels Nov 28, 2026
@coderabbitai

coderabbitai Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Bug Fixes
    • Fixed an issue where language-server responses, such as hover results, could stall while progress was being reported in headless mode. Progress handling now runs in the background, allowing responses to complete without waiting for that work and improving reliability when language servers report progress alongside requests.

LSPProgressManager now submits progress tasks to the application executor. A headless-mode test checks that a hover response completes within the configured timeout while the language server reports progress.

Changes: Headless progress handling

Layer / File(s) Summary
Schedule progress tasks asynchronously
src/main/java/com/redhat/devtools/lsp4ij/features/progress/LSPProgressManager.java, src/test/java/com/redhat/devtools/lsp4ij/features/progress/ProgressInHeadlessModeTest.java
The progress manager stores the background task and submits it to the application executor. The headless test checks hover completion while progress is active and ends progress in a finally block.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Sequence Diagram(s)

sequenceDiagram
  participant Server as Language server
  participant Reader as LSP4J message reader
  participant Client as LanguageClientImpl
  participant Manager as LSPProgressManager
  participant Executor as AppExecutorUtil
  participant Task as Backgroundable progress task
  Server->>Reader: Send progress notification
  Reader->>Client: Deliver notification
  Client->>Manager: Call notifyProgress
  Manager->>Executor: Submit ProgressManager.run(task)
  Executor->>Task: Run progress task
  Server->>Reader: Send progress report or end
  Reader->>Client: Deliver report or end
Loading

Suggested reviewers: angelozerr

Merge Risk: Minimal · up to db110

This change stops headless language-server progress from blocking message reads, which fixes the hover/highlighting hang. No concrete merge-blocking risk was found. The progress bar in an IDE with a UI was not checked by the author, but the impact is small.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: a language server that reports progress no longer hangs in a headless application. The change moves the $/progress task to a pooled thread in LSPProgressManager, which…
Description check Passed The description states the fix (progress task starts on a pooled thread), links issue #2342, and describes the new ProgressInHeadlessModeTest and the verification performed. It relates directly to the…
Linked Issues check Passed Directly linked issue #2342 requires that a $/progress task in headless mode must not run on the thread that reads language server messages. Reviewed head LSPProgressManager.createTask now wraps `…
Out of Scope Changes check Passed The change set consists of a modification to LSPProgressManager.createTask (thread handoff for the progress task) and the new test ProgressInHeadlessModeTest. The thread handoff implements #2342 d…
Full details: Title check

Explanation

The title names the main change: a language server that reports progress no longer hangs in a headless application. The change moves the $/progress task to a pooled thread in LSPProgressManager, which fixes that hang. The title is specific and matches the changeset.

Full details: Description check

Explanation

The description states the fix (progress task starts on a pooled thread), links issue #2342, and describes the new ProgressInHeadlessModeTest and the verification performed. It relates directly to the changeset.

Full details: Linked Issues check

Explanation

Directly linked issue #2342 requires that a $/progress task in headless mode must not run on the thread that reads language server messages. Reviewed head LSPProgressManager.createTask now wraps ProgressManager.getInstance().run(task) in AppExecutorUtil.getAppExecutorService().execute(...). The task therefore starts on a pooled thread. In headless mode, ProgressManager.run runs the task in the calling thread, which is now the pooled thread, so the LSP4J reader thread returns and keeps reading report and end notifications. This matches the fix the issue proposes (start from a pooled thread). The begin path, isTaskStarted guard, cancellation, and end handling are unchanged. The author reports that ProgressInHeadlessModeTest fails on main and passes with the change, and that gopls, rust-analyzer, and jdtls answer in a headless IDE. I did not run these tests. The test file was not read. The full diff could not be read, so the base-to-head change was confirmed from the head file and the supplied summary only. Code evidence supports the requirement.

Full details: Out of Scope Changes check

Explanation

The change set consists of a modification to LSPProgressManager.createTask (thread handoff for the progress task) and the new test ProgressInHeadlessModeTest. The thread handoff implements #2342 directly. The test verifies the same behavior (hover answered while progress is reported in headless mode). No unrelated functional changes appear in the supplied summary or in the reviewed head file. Limitation: the base-to-head diff could not be read, so completeness of the change set rests on the supplied summary (+7/-2 in LSPProgressManager, +71 for the test).

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8deed266-50c9-4016-9be8-d640d40a92bc
Commits

Reviewing files that changed from the base of the PR and between 7c6d061 and db1100d.

Files selected for processing: 2

  • src/main/java/com/redhat/devtools/lsp4ij/features/progress/LSPProgressManager.java
  • src/test/java/com/redhat/devtools/lsp4ij/features/progress/ProgressInHeadlessModeTest.java

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.

@codecov

codecov Bot commented Nov 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 58.84%. Comparing base (7c6d061) to head (db1100d).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2344      +/-   ##
==========================================
+ Coverage   58.64%   58.84%   +0.19%     
==========================================
  Files         849      849              
  Lines       36719    36720       +1     
  Branches     7609     7609              
==========================================
+ Hits        21535    21608      +73     
+ Misses      12186    12098      -88     
- Partials     2998     3014      +16     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@lagergren
lagergren merged commit 628f790 into redhat-developer:main Nov 30, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working $/progress https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#progress

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Headless, a language server that sends $/progress hangs: the progress task runs in the thread that reads its messages

1 participant