Repository navigation
fix(repos): forget remote-identity deadlines for removed repo locations - #14672
Merged
Merged
Conversation
`probeRetryAfterByLocation` is keyed by connection and path and was written for both resolved and unresolved probes, but never pruned — a removed repo or a retired SSH host kept its deadline for the life of the process. `isIdentityRefreshDue` also seeds an entry for every resolved repo on first sight, so the map grew with repository and host churn even with no probe activity. The candidate sweep already enumerates every live repo, so it now reconciles the deadline map against those location keys. `getRepos()` reads a hydrated in-memory array, so a repo is never transiently absent mid-sweep and cannot lose its startup delay or its backoff. Locations with a probe still in flight are kept, since that probe re-adds its own key when it settles.
Contributor
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe enrichment scheduler now prunes retry deadlines for removed repository locations and retired hosts after it enumerates live non-folder repositories. It retains deadlines for locations with active probes. Tests cover re-adding a removed repository and preserving refresh backoff for a surviving repository when a sibling is removed. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
… prune The exemption's own comment named the reason it was unnecessary: a probe re-adds its deadline when it settles, so skipping its key produced the same map state as deleting it, and only live repos are ever candidates so nothing read the entry in between. Removing it also stops a probe that never settles from pinning its deadline forever — the location's `git remote -v` can already hang with no timeout, and the exemption turned that one stranded entry into two.
9 tasks done
enrick-dev
pushed a commit
to enrick-dev/orca
that referenced
this pull request
Oct 15, 2026
…ns (stablyai#14672) * fix(repos): forget remote-identity deadlines for removed repo locations `probeRetryAfterByLocation` is keyed by connection and path and was written for both resolved and unresolved probes, but never pruned — a removed repo or a retired SSH host kept its deadline for the life of the process. `isIdentityRefreshDue` also seeds an entry for every resolved repo on first sight, so the map grew with repository and host churn even with no probe activity. The candidate sweep already enumerates every live repo, so it now reconciles the deadline map against those location keys. `getRepos()` reads a hydrated in-memory array, so a repo is never transiently absent mid-sweep and cannot lose its startup delay or its backoff. Locations with a probe still in flight are kept, since that probe re-adds its own key when it settles. * refactor(repos): drop the no-op in-flight exemption from the deadline prune The exemption's own comment named the reason it was unnecessary: a probe re-adds its deadline when it settles, so skipping its key produced the same map state as deleting it, and only live repos are ever candidates so nothing read the entry in between. Removing it also stops a probe that never settles from pinning its deadline forever — the location's `git remote -v` can already hang with no timeout, and the exemption turned that one stranded entry into two.
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.
Fixes STA-4350.
Problem
probeRetryAfterByLocationis keyed byconnectionId\0pathand written on both resolved and unresolved probes, but never pruned — only the test reset cleared it. A removed repo, a retired SSH host, or a repo whosepath/connectionIdchanged kept its deadline for the life of the process.isIdentityRefreshDuealso seeds an entry for every resolved repo the first time it is seen, so the map grew with repository and host churn even with no probe activity at all.The sharper statement of the defect: the map is not merely unpruned, it is process-global, while the repo list it describes belongs to a
Storeinstance. Nothing tied its lifetime to the thing it was caching decisions about.Change
The candidate sweep already enumerates every live repo, so it now reconciles the deadline map against those location keys — no new plumbing, O(n) on a list that was already being walked, and no exported signature changes.
Two things that make this safe:
getRepos()is a synchronous map over an already-in-memory array, andthis.stateis assigned exactly once, in theStoreconstructor — there is no in-place reload that could transiently shrink the list. A repo therefore cannot be absent fromgetRepos()mid-sweep and lose its 5-minute startup delay or its 6h backoff to a prune-then-reseed. (Both of those deadlines are suppressors in any case: dropping one costs another quiet interval, it never forces a probe.)The prune must stay per-sweep rather than being hoisted to a one-shot at startup — that is what collects the orphan left behind when a repo is removed while its probe is still running.
Why reconcile rather than a bounded cache
The repo has a tested LRU (
BoundedMap,src/shared/bounded-map.ts) and it is the wrong tool here.get()mutates recency, and capacity eviction can drop a live repo's deadline — which for an unresolved repo means an immediate extragit remote -v, reintroducing exactly the spurious-probe cost the TTL constants at the top of this file exist to prevent. A fixed cap also has nothing principled to be set to: the legitimate working set is "however many repos the user has", which is precisely what reconciling against live keys expresses and what anymaxEntrieswould have to guess.Severity
Honest assessment: this is hygiene, not a memory problem. Entries cost roughly 100-150 bytes (Map slot plus key string plus load factor), and cardinality is bounded by the repo store — keys are minted only from
getRepos(), and the only writer to that array isStore.addRepovia user-initiated add/clone/create flows. No discovery loop auto-registers repos, and worktrees are notReporecords, so worktree churn contributes zero keys. Steady state is the live repo count (5-30 KB); orphans over a desktop process lifetime are realistically under 15 KB.So this is P3/P4 rather than P2, and it is worth shipping mainly because the fix is six lines and the rest of this file reasons carefully about lifetimes — this was the one loose end.
Tests
All 18 tests in the file pass.
Known adjacent gap (pre-existing, not fixed here)
probeGitRemoteIdentityrunsgit remote -vwith no timeout (src/main/git/runner.ts:1082only forwards a caller-supplied one). If that hangs on a wedged mount or SSH transport, itsinFlightProbesByLocationentry never clears. That map self-clears on settle and is unaffected by this change, so it is out of scope — but a probe timeout would be a reasonable follow-up.