Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): extend negative repository identity cache ttl #2083

Mergedm-mohamed(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/2083/headmerged by juliusmarminge View on GitHub

What Changed

This PR implements Fix 2 proposed by @mei-the-dev in #2037, taking the smallest cache-only slice of that issue. RepositoryIdentityResolver now keeps null repository identities for 60 seconds instead of 10 seconds. I also tightened the resolver regression test so repeated resolves continue to reuse the cached null identity until the negative TTL expires.

Validated locally with bun run test -- src/project/Layers/RepositoryIdentityResolver.test.ts and bun run typecheck in apps/server.

Why

In #2037, @mei-the-dev traced the persistent "Some requests are slow" toast back to replay-time repository identity enrichment and called out the 10-second negative TTL as one of the quick-win fixes. This PR implements that specific Fix 2 only: it stretches the negative cache window to 60 seconds so projects without remotes reuse the same null lookup across reconnect churn instead of refreshing every 10 seconds, while keeping behavior localized to the existing cache. The updated test demonstrates the cached null result is stable across repeated resolves and only refreshes after TTL expiry.

UI Changes

Not applicable.

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

Note

Low Risk Small, localized change to cache TTL and its test coverage; main behavioral impact is delaying detection of newly-added remotes for up to 1 minute.

Overview RepositoryIdentityResolver now caches null (no identity/no remote) lookups for 1 minute instead of 10 seconds, reducing repeated git-remote resolution work during churn.

Updates the late-remote regression test to assert repeated resolve() calls continue returning the cached null identity until the negative TTL elapses, after which the identity is recomputed and returned.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 54f6322196e7ce22647ee0969caa492d4cd0cbac. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

Note

Extend negative repository identity cache TTL from 10 seconds to 1 minute

Increases DEFAULT_NEGATIVE_CACHE_TTL in RepositoryIdentityResolver.ts from 10 seconds to 1 minute. The test in RepositoryIdentityResolver.test.ts is updated to perform three consecutive resolve calls expecting a null identity before advancing the clock past the new TTL. Behavioral Change: null identities are now cached 6× longer, reducing re-resolution attempts for missing repositories.

Macroscope summarized 54f6322.
    1. 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: 70e04e2f-4682-4c4e-ba2f-24ecf7135658

      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:

      • 🔍 Trigger review
      ✨ 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.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    3. Approvability

      Verdict: Approved

      This PR extends a cache timeout constant from 10 seconds to 1 minute and updates a test to match. The change is a simple, low-risk configuration tweak with no broader side effects.

      You can customize Macroscope's approvability policy. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. juliusmarminge merged thisd90e15d

    5. juliusmarminge closed this

    6. Thank You for writing the PR :) @m-mohamed

Sign in to join this conversation.