Repository navigation
fix: flip parentFieldRetried inside probe IIFE before resolveProbe() (re-lands #1456) - #1514
Merged
Merged
Conversation
Closes the race where siblings awaiting parentFieldProbeInFlight wake between resolveProbe() and the deferred parentFieldRetriedByOwner.add() in the outer block, see parentFieldProbeInFlight=null + parentFieldRetriedByOwner without scopeKey, and issue duplicate with-parent probes. Originally raised in #1456, but that PR branched off pre-#1465 main and its diff against current main reverted #1465's owner-keyed parent-field caches back to global flags. This re-applies the fix on current main. Refs #1456
This was referenced May 7, 2026
enrick-dev
pushed a commit
to enrick-dev/orca
that referenced
this pull request
Oct 15, 2026
…tablyai#1514) Closes the race where siblings awaiting parentFieldProbeInFlight wake between resolveProbe() and the deferred parentFieldRetriedByOwner.add() in the outer block, see parentFieldProbeInFlight=null + parentFieldRetriedByOwner without scopeKey, and issue duplicate with-parent probes. Originally raised in stablyai#1456, but that PR branched off pre-stablyai#1465 main and its diff against current main reverted stablyai#1465's owner-keyed parent-field caches back to global flags. This re-applies the fix on current main. Refs stablyai#1456 Co-authored-by: nwparker <[email protected]>
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
Re-lands the fix originally proposed in #1456, on current
main.The race itself is real: in
fetchAllItems(), sibling callers awaitingparentFieldProbeInFlight.get(scopeKey)are woken byresolveProbe()inside the probe IIFE'sfinallyblock, butparentFieldRetriedByOwner.add(scopeKey)was set afterawait probePromisein the outer block. That gap lets siblings observeparentFieldProbeInFlightcleared andparentFieldRetriedByOwnernot-yet-set → each issues its own duplicate with-parent probe.This patch flips
parentFieldRetriedByOwner.add(scopeKey)inside the probe IIFE, beforeresolveProbe(), eliminating the gap.Why a new PR instead of merging #1456
#1456 branched off pre-#1465 main. Its effective diff against current
mainwould have reverted #1465's owner-keyed parent-field caches (parentFieldRetriedByOwnerSet,parentFieldWarningLoggedByOwnerSet,parentFieldProbeInFlightMap,ownerScopeKey()helper) back to the original global flags — a silent regression hidden inside ~700 lines of unrelated formatting noise. GitHub flagged itmergeStateStatus: DIRTY.Closing #1456; this PR carries forward only the actual race fix.
Verification
pnpm typecheck:node— cleanpnpm lint— clean (7 pre-existing warnings unchanged)npx vitest run src/main/github/project-view.test.ts— 22/22 passDiff
@@ probePromise = (async () => { try { - return await fetchItemsPageWithRaw({...}) + const result = await fetchItemsPageWithRaw({...}) + // Why: flip parentFieldRetriedByOwner BEFORE resolveProbe()/clearing + // parentFieldProbeInFlight so siblings that awoke on `inFlight.catch()` + // observe the updated flag. + if (!result.ok && errorsIndicateParentField(result.rawErrors, result.stderr)) { + parentFieldRetriedByOwner.add(scopeKey) + } + return result } finally { resolveProbe() parentFieldProbeInFlight.delete(scopeKey) } })()Closes #1456