-
Notifications
You must be signed in to change notification settings - Fork 2.3k
fix(lsp): add poll retry for push-only diagnostics servers #1731
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 issue found across 4 files
Confidence score: 4/5
- Safe to merge with low risk; the only issue is a low‑severity polling behavior and no other concerns were flagged.
- In
src/tools/lsp/lsp-client.ts, the polling loop treats empty diagnostics as missing, which can force a full timeout even when the server reports a clean file, potentially slowing feedback. - Pay close attention to
src/tools/lsp/lsp-client.ts- polling loop ignores valid empty diagnostics and may wait unnecessarily.
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="src/tools/lsp/lsp-client.ts">
<violation number="1" location="src/tools/lsp/lsp-client.ts:114">
P2: Polling loop ignores valid empty diagnostics, forcing full timeout even when server reports a clean file.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
…gyu#1522) Closes code-yeongyu#1522 ## Summary - After pull diagnostics fails, poll diagnosticsStore every 200ms for up to 3s - Fixes timing race where push diagnostics arrive after pull fails but before store read - Returns immediately if push arrives during poll window - Falls back to empty after timeout ceiling (same behavior as before, just with retry) - Servers like Godot that only support push diagnostics now work correctly Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <[email protected]>
729db1c to
3a717b3
Compare
|
@cubic-dev-ai recheck |
@potb I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 issues found across 2 files
Confidence score: 4/5
- Behavioral impact is limited: the polling loop in
src/tools/lsp/lsp-client.tstreats empty diagnostics as no update, so error-free files may wait an extra 3s before being considered updated. - Test suite slowdown in
src/tools/lsp/client.test.tsis minor and non-blocking, but it does add avoidable wait time each run. - Pay close attention to
src/tools/lsp/lsp-client.tsandsrc/tools/lsp/client.test.ts- polling logic and timer usage can introduce delays.
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="src/tools/lsp/lsp-client.ts">
<violation number="1" location="src/tools/lsp/lsp-client.ts:114">
P2: Polling loop ignores valid empty diagnostics updates, forcing a 3s timeout delay for error-free files.</violation>
</file>
<file name="src/tools/lsp/client.test.ts">
<violation number="1" location="src/tools/lsp/client.test.ts:302">
P3: This test will wait for the full diagnostics poll timeout (~3.5s) every run because timers aren’t mocked; it slows the test suite unnecessarily. Consider mocking setTimeout/using fake timers or overriding the timeout to keep the test fast.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
… tests Poll loop now checks `items !== undefined` instead of `items && items.length > 0`, so clean files with zero diagnostics are recognized immediately rather than forcing a full 3s timeout. Tests mock setTimeout/Date.now to avoid real timer waits. Addresses review feedback identified by cubic on code-yeongyu#1731.
Closes #1522
Push-only LSP servers (e.g. Godot) return nothing on pull requests. When pull fails, we just return empty — but push diagnostics often arrive moments later.
Added a poll retry: on pull failure, check the diagnostics store every 200ms for up to 3s. Returns immediately when data arrives, falls back to empty on timeout (same as before).