GeezerVison is showing github.com — fix(server): memoise git top-level lookup in repository identity resolver by leorivastech · Pull Request #3166 · pingdotgg/t3code
Conversation
What Changed
RepositoryIdentityResolver.resolve ran git rev-parse --show-toplevel on every call. That top-level lookup sat outside the existing identity cache, so it spawned a git subprocess every time, even for the same workspace. This memoises the cwd to top-level mapping in its own cache keyed by cwd, so repeated resolves reuse the result.
Only a resolved top-level is cached (positive TTL). A failed or timed-out lookup is not cached, so the next resolve retries rev-parse and recovers the real root instead of pinning the identity rootPath to a nested path; this keeps the pre-change behaviour for the failure path. Behaviour is otherwise unchanged.
Why
This is the Fix 1 quick win from #2037. replayEvents enriches every project.* event on each reconnect, and that enrichment calls RepositoryIdentityResolver.resolve once per project. With the top-level lookup uncached, a replay burst spawned one git process per project event every time, which is a big part of what pushed replayEvents past the 15s SLOW_RPC_ACK_THRESHOLD_MS and triggered the persistent "Some requests are slow" toast.
#2083 already landed Fix 2 (the negative cache TTL) from the same issue; this takes the next small, self-contained slice. It does not close #2037, which still tracks the remaining proposed fixes.
Regression tests use a counting ProcessRunner: resolving the same workspace twice runs git rev-parse --show-toplevel once instead of twice, and a transient first-call timeout still retries on the next resolve and reports the top-level root.
Checklist
- This PR is small and focused
- I explained what changed and why
- I included before/after screenshots for any UI changes
- I included a video for animation/interaction changes
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
…lver
resolve() ran `git rev-parse --show-toplevel` on every call, outside the
existing identity cache, so it spawned a git subprocess each time even for
the same workspace. During replayEvents enrichment that means one git
process per project event on every reconnect, a big contributor to the
"Some requests are slow" toast.
Memoise the cwd -> top-level mapping in its own cache. A resolved
top-level uses the positive TTL; an unresolved cwd (not a repo / git
timed out) uses the negative TTL so a directory that later becomes a repo
is still picked up. Adds a regression test counting process invocations.
Part of pingdotgg#2037.
coderabbitai
Bot
commented
Jun 19, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Important
Review skipped
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: ede62f2c-76e1-4275-9a54-8a6974e0afb5
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
✨ Finishing Touches
🧪 Generate unit tests (beta)
- Create PR with unit tests
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.
❤️ Share
Comment @coderabbitai help to get the list of available commands and usage tips.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 2ef76ff. Configure here.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Approvability
Verdict: Approved
Performance optimization that adds memoization for git subprocess lookups to reduce repeated calls during replay events. Changes are self-contained, well-tested, and don't modify user-facing behavior beyond performance improvement.
You can customize Macroscope's approvability policy. Learn more.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
A failed or timed-out `git rev-parse --show-toplevel` previously cached the
cwd fallback for the negative TTL. Because `git remote -v` still resolves
from a nested workspace, that pinned the repository identity rootPath to the
nested directory until the entry expired. Cache only resolved top-levels and
retry on the next resolve otherwise, matching the pre-cache behaviour.
|
Pushed a follow-up commit (a911c15) that addresses the Cursor Bugbot comment above.
Failed or timed-out git rev-parse --show-toplevel lookups are no longer cached. Only a resolved top-level gets the positive TTL; otherwise the next resolve re-runs rev-parse and recovers the real root, which keeps the behaviour from before this PR. I also added a regression test that times out the first lookup and asserts the second resolve retries and reports the top-level rootPath instead of the nested path.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Closing this since #2037 has already been resolved in main. Thanks!
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Labels
size:M
30-99 changed lines (additions + deletions).
vouch:unvouched
Author is not yet trusted in the VOUCHED list.
Milestone
No milestone
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.
|