fix(plugins,lsp): preserve concurrent rejections and resolve LSP cancellation on transport failure#1158
Merged
Merged
Conversation
…ellation on transport failure
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.
Summary
Two unrelated MED-severity bugs from the audit, both in the same family of "silent failure leaks state":
B7 —
LSPTransport.cancelRequestswallows transport-write errorscancelRequest(id:)previously didtry? writeMessage(data), so a failed write (transport mid-shutdown, broken pipe, etc.) caused the LSP server to never receive the cancellation. The localpendingRequests[id]entry stayed live, leaking aCheckedContinuationthat would only resolve when the LSP process terminated.The fix logs the failure and resolves the pending entry with
CancellationErrorso the local handler unwinds.R7 —
PluginManager.autoUpdateRejectedPluginsdiscards concurrent rejectionsThe old code snapshotted
rejectedPlugins.filter { !$0.isOutdated }at entry, looped throughawait updateFromRegistry(...)calls that could yield to other main-actor work, then unconditionally assignedrejectedPlugins = stillRejected. Any new rejection entries that arrived during the awaits (e.g. a concurrent manual install failingvalidateBundleVersions) were dropped.The fix tracks only the entries the loop processed and merges its outcome with the live
rejectedPlugins:stillRejected(initial-not-outdated entries plus failed-outdated outcomes) collapses into a focusedstillFailed(only the failed-outdated outcomes), since the merge-by-URL filter handles the rest.Test plan
validateBundleVersions. Confirm the new failed sideload remains in the rejected list after auto-update completes.