GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — fix(server): cache the resolved git top level per workspace root by willsheldon · Pull Request #8950 · pingdotgg/t3code Conversation
|
| before | after | |
|---|---|---|
environment.orchestration.shellSnapshot |
32,954 ms | 1,744 ms |
resolveRepositoryIdentitiesForProjects |
32,499 ms | 1,638 ms |
Both after-figures are the cold startup run. Seven minutes in, 63 resolve calls had produced exactly 34 resolveRepositoryRoot spans, one per distinct root, and no more.
The added test turns a nested workspace into its own repository after the first resolve. While the root stays cached the resolver keeps answering from the outer repository, which is only possible if it did not spawn git again; past the TTL it picks up the inner one.
vp test run apps/server/src/project/RepositoryIdentityResolver.test.ts — 8 passedvp test run apps/server/src/project — 35 passedvp test run apps/server/src/orchestration/Layers/ProjectionSnapshotQuery.test.ts — 21 passedtsgo --noEmit in apps/server — cleanWritten by Claude Opus 5 in Claude Code.
Note
Low Risk
Performance-oriented caching in repository metadata resolution; remote or root changes may be stale until TTL expiry, with no auth or data-mutation impact.
Overview
Fixes snapshot/shell bootstrap slowness by caching git rev-parse --show-toplevel per workspace cwd instead of spawning git on every resolve, which previously happened even when remote identity was already cached.
RepositoryIdentityResolver now uses a separate repositoryRootCache (configurable positive/negative TTLs, default 10m / 1m) ahead of the existing identity cache. Root lookup returns null when rev-parse fails rather than falling back to cwd. DEFAULT_POSITIVE_CACHE_TTL for resolved identities is raised from 1 minute to 10 minutes.
A new test proves repeated resolves reuse the cached top level until TTL expiry (nested repo init does not change identity until the root cache refreshes).
Reviewed by Cursor Bugbot for commit c71aa17. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
RepositoryIdentityResolverrepositoryRootCache keyed by cwd that stores the result of git rev-parse --show-toplevel, with separate TTLs for positive hits (repositoryRootCacheTtl, 10 min default) and negative results (repositoryRootNegativeCacheTtl, 1 min default).resolveRepositoryRoot now returns null on failure instead of falling back to cwd, enabling distinct negative caching.DEFAULT_POSITIVE_CACHE_TTL for the identity cache from 1 minute to 10 minutes.resolve may return the identity of a previously discovered parent repository even if a nested workspace later becomes its own repository, until the root cache entry expires. Reviewers should check the repositoryRootCache TTL configuration in RepositoryIdentityResolver.ts.Macroscope summarized c71aa17.
Performance Improvements
Reliability
Sorry, something went wrong.
There was an error while loading. Please reload this page.
resolve() ran `git rev-parse --show-toplevel` on every call to derive the identity cache key, and only the `git remote -v` lookup behind that key was cached. Snapshot reads resolve every project on each call, so an install with 34 projects spawned 34 git processes per read no matter how warm the cache was. Traces show one shell snapshot spending 32.5s of its 33s inside resolveRepositoryIdentitiesForProjects for this reason. Cache the workspace-root-to-top-level mapping alongside the identity it keys, and raise the positive identity TTL to 10 minutes. A remote URL change now takes up to 10 minutes to surface; the negative TTL stays at 1 minute so a fresh `git init` is still picked up quickly. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01KX8tw6Sqs3h2oYKmi18Ptr
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe repository identity resolver now caches Git top-level roots per workspace. It adds separate positive and negative root-cache TTLs, uses ChangesRepository identity caching
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to This change reduces repeated Git process launches by caching repository roots and extends identity cache freshness to 10 minutes. No actionable merge-blocking risk remains; it is merge-ready after normal checks and review. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkExplanation The description explains the problem, the implementation, performance impact, risks, and verification results. It does not use the template headings exactly, but it contains the required change rationale and testing information, and UI sections are not applicable. Full details: Linked Issues checkExplanation The PR satisfies the repository identity caching objective in issue
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning Your free Security trial is over. An organization admin can activate Security or dismiss this notice. Comment |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
ApprovabilityVerdict: Not approved Macroscope's review found this PR not approvable — This production change adds repository-root caching and raises the default identity-cache TTL from one minute to ten minutes, reducing git process work but allowing repository metadata to remain stale longer. The altered default applies to ordinary server execution because the production layer provides no overrides. You can add or adjust custom eligibility rules. Learn more. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Closing as superseded. Main now caches repository roots in RepositoryIdentityResolver via #8187. The remaining VcsDriverRegistry cache-TTL fix stays in #8951. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
[Bug]: Repository identity and VCS detection spawn git per project on every read, stalling shellSnapshot
There was an error while loading. Please reload this page.