Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): detect git repo from subdirectories so diffs and checkpoints work in monorepos #2443

Closedimabdulazeez(GitHub profile, opens in a new tab)wants to merge 4 commits intomain fromrefs/pull/2443/headopened View on GitHub

What Changed

  • isGitRepository(cwd) in apps/server/src/git/Utils.ts now walks up the directory tree until it finds a .git entry or hits the filesystem root, instead of only checking cwd/.git.
  • No behavioral change at the repo root — same result for cwds that already had .git directly inside them.

Why

Closes #2441.

When a workspace cwd points at a sub-package of a git repo (e.g. apps/server in a monorepo), the previous one-level check returned false, so:

  • CheckpointReactor (apps/server/src/orchestration/Layers/CheckpointReactor.ts:152) treated the workspace as non-git and skipped checkpoint capture.
  • ProviderRuntimeIngestion (apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.ts:569) skipped git ingestion.
  • CheckpointStore.isGitRepository (apps/server/src/checkpointing/Layers/CheckpointStore.ts:78) inherited the same blind spot.

The user-visible symptom is an empty diff panel and missing checkpoints for any thread whose cwd isn't the repo root, even though git status works fine from that same cwd. Walking parents matches git's own discovery behavior and fixes the gated features without changing any other code paths.

UI Changes

Not directly, but the visible effect is that the existing diff panel and checkpoint UI now start populating for sub-package workspaces. Tested the change based on the same repo in the issue #2441

Checkpoint button

image

Diff view

image

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes (Only after images, before images are highlighted in #2441
  • I included a video for animation/interaction changes (N/A)

Note

Fix isGitRepository to detect git repos from subdirectories for monorepo support

Previously, isGitRepository in Utils.ts only returned true if the provided directory itself contained a .git folder. It now walks up the directory tree using a do-while loop, checking each ancestor until it finds .git or reaches the filesystem root. This fixes diffs and checkpoints when the working directory is a subdirectory within a monorepo.

Macroscope summarized 14169b8.
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      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: c5983499-a0b6-49f4-8e3d-90748805a472

      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. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Needs human review

      An unresolved review comment identifies a critical bug: the loop structure skips checking the initial directory for .git, which would break detection when the starting path is the repo root. This logic error needs to be addressed before merging.

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

      Verdict: Needs human review

      An unresolved review comment identifies a critical bug: the loop structure skips checking the initial directory for .git, which would break detection when the starting path is the repo root. This logic error needs to be addressed before merging.

      You can customize Macroscope's approvability policy. Learn more.

      This has been addressed too. thanks

    5. gameroman(GitHub profile, opens in a new tab) approved these changes

    6. Hi @juliusmarminge -- Friendly reminder to review if possible. This is making working with monorepos a bit difficult and this should fix it :)

Sign in to join this conversation.