Enforce exclusive checker acquisition - #64543
Merged
Jake Bailey (jakebailey) merged 1 commit intoSep 29, 2026
Merged
Jake Bailey (jakebailey) merged 1 commit into
Jake Bailey (jakebailey) merged 1 commit into
Conversation
Request identity does not imply exclusive ownership: parallel workers inherit their parent's request ID and can otherwise mutate the same checker concurrently. Request affinity must only select idle checkers, not bypass acquisition. Nested language-service operations must share an explicitly acquired checker or finish their acquisition before the next operation. This keeps ownership independent of context propagation and avoids requiring parallel compiler operations to strip request metadata.
Jake Bailey (jakebailey)
requested review from
Andrew Branch (andrewbranch)
and
a balanced review from Copilot
September 29, 2026 21:39
Copilot started reviewing on behalf of
Jake Bailey (jakebailey)
September 29, 2026 21:39
View session
Contributor
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
The central checker-pool concurrency contract warrants final human review despite focused regression coverage.
Review effort: Balanced
Findings: None
What changed in this PR
Enforces exclusive checker acquisition while preserving released-checker affinity and removes nested acquisitions in language-service paths.
Changes:
- Prevents request IDs from bypassing checker exclusivity.
- Reuses acquired checkers or releases them before nested operations.
- Adds checker contention, diagnostics, and content-mapper regressions.
| File | Description |
|---|---|
tsc/internal/compiler/checkerpool.go |
Documents exclusive, non-reentrant acquisition. |
tsc/internal/project/checkerpool.go |
Enforces semaphore acquisition for every checkout. |
tsc/internal/project/checkerpool_test.go |
Tests affinity and same-request contention. |
tsc/internal/lsp/server_flakydiagnostics_test.go |
Covers parallel diagnostic/emit behavior. |
tsc/internal/ls/inlay_hints.go |
Releases each mapped-range checker promptly. |
tsc/internal/ls/findallreferences.go |
Passes the existing checker into nested reference logic. |
tsc/internal/ls/codeactions_importfixes.go |
Shares one checker across import-fix processing. |
tsc/internal/ls/codeactions_fixmissingtypeannotation.go |
Collects diagnostics before acquiring the fixer checker. |
tsc/internal/ls/codeactions_fixclassincorrectlyimplementsinterface.go |
Avoids diagnostic collection while holding a checker. |
tsc/internal/fourslash/tests/contentMapperInlayHints_test.go |
Adds mapped-range checker-release coverage. |
tsc/testdata/baselines/reference/fourslash/inlayHints/contentMapperInlayHintsReleaseEachRange.baseline |
Records expected inlay hints. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Andrew Branch (andrewbranch)
approved these changes
Sep 29, 2026
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.
This is a replacement for #64513.
I think it's probably not worth trying to be clever about allowing checker reuse reentrancy through request chains; as seen in the linked PR and crashes, it's easy to get into situations where the checker becomes concurrently used or mismanaged.
Dropping this is in some ways a simplification, but is generally a noop, because often the context was being passed just to eventually ask for a checker anyway. We can still reuse checkers we previously released if they're there.
Closes #64513