GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(cli): find the worktree's project when a Git hook sets GIT_DIR by only21mil · Pull Request #42063 · pingdotgg/t3code

Conversation

@only21mil

@only21mil only21mil commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Problem

When a t3 thread command inherits a GIT_DIR that points away from the target's repository, a path inside a linked worktree fails with No T3 Code project matches ... instead of resolving to its project.

To find it, the CLI runs git worktree list in the target folder, and Git inherits GIT_DIR. A hook in a linked worktree gets the worktree's absolute Git dir, a receive hook gets GIT_DIR=., and a shell or script can export any value. When it names another repository, or is relative and so names none from the target folder, the target matches no listed checkout.

Change

listGitCheckouts now unsets inherited repository selectors with the existing unsetInheritedRepositoryEnv helper, as the server's other cwd-based Git calls do. Git then finds the repository from the folder it runs in.

Scope

Bug fix for a wrong lookup error. It changes one call site, and the commands below reproduce it, so it needs no issue.

Verification

Setup: Linux, Git 2.53.0, a fresh isolated server (t3 serve --base-dir <base>) on each commit. repo has a tracked pkg/ folder and is added with t3 project add --base-dir <base> repo. Its linked worktree repo-feature sits beside it. t3 is node <checkout>/apps/server/src/bin.ts.

Steps: cd repo → t3 thread list --json --base-dir <base> --project ../repo-feature/pkg → the same with GIT_DIR=.git set by hand, standing in for an inherited value.

Before, 6f15610d5be1:

$ cd /mnt/work/rel-base/repo
$ t3 thread list --json --base-dir /mnt/work/rel-base/base --project ../repo-feature/pkg
[]
exit 0
$ GIT_DIR=.git t3 thread list --json --base-dir /mnt/work/rel-base/base --project ../repo-feature/pkg
No T3 Code project matches '../repo-feature/pkg'. Pass a project id or a path inside a project.
exit 1

After, 54b74fff7f4e:

$ cd /mnt/work/rel-head/repo
$ t3 thread list --json --base-dir /mnt/work/rel-head/base --project ../repo-feature/pkg
[]
exit 0
$ GIT_DIR=.git t3 thread list --json --base-dir /mnt/work/rel-head/base --project ../repo-feature/pkg
[]
exit 0

An AI agent ran each check:

  • The worktree test in thread.test.ts now also resolves the worktree's pkg folder with GIT_DIR set. It fails against 6f15610d5be1's thread.ts, and again on 54b74fff7f4e with only the new env line removed.
  • On 54b74fff7f4e, vp test run src/cli/thread.test.ts src/cli/deferredImports.test.ts --maxWorkers=1 passes 3 of 3 runs, and vp run check:changed passes.

Links: the commits above and the regression test in apps/server/src/cli/thread.test.ts.

Not shown:

  • Windows and macOS. The helper already matches Windows' case-insensitive variable names, and this change adds no platform-specific code.

Generated with Claude Opus 5.5 in T3 Code Nightly

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@only21mil
fix(cli): find the worktree's project when a Git hook sets GIT_DIR
54b74ff
@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Nov 24, 2026
@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration

  • Source mode: Auto
  • Repository: pingdotgg/t3code
  • Branch: main
  • File: .coderabbit.config.ts
  • Commit: a326dea
  • Layers: Repository TS config
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5a816d09-2da0-4fa9-bb76-9354658d93b0
Commits

Reviewing files that changed from the base of the PR and between 54b74ff and e56fa9f.

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

No actionable comments were generated in the recent review.

Walkthrough

listGitCheckouts now removes inherited repository-related environment variables before running Git worktree-list commands. A test sets GIT_DIR and checks that path resolution still selects the sample project.

Changes: Worktree environment cleanup

Layer / File(s) Summary
Clean the Git environment for worktree listing
apps/server/src/cli/thread.ts, apps/server/src/cli/thread.test.ts
listGitCheckouts passes a cleaned environment to both Git command attempts. The test sets GIT_DIR and checks that resolution selects the sample project.

Estimated code review effort: 2 (Simple) | ~5 minutes

Change: Bug fix

Suggested reviewers: juliusmarminge, mfazekas

Merge Risk: Minimal · previous review 54b74

This fix lets the CLI find a worktree's project when a Git hook sets GIT_DIR. The change is small and tested, and I found no remaining merge-blocking risk.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the fix and its scope: the CLI should find the worktree's project when a Git hook sets GIT_DIR. The raw summary confirms that listGitCheckouts now removes inherited repository environm…
Description check Passed The description follows the template. It has Problem, Change, Scope, and Verification sections. The Problem section explains the failure and its cause. The Change section names the fix and the helper …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the fix and its scope: the CLI should find the worktree's project when a Git hook sets GIT_DIR. The raw summary confirms that listGitCheckouts now removes inherited repository environment variables before running git worktree list, which matches the title. The title follows conventional commit form and is specific enough for a teammate scanning history.

Full details: Description check

Explanation

The description follows the template. It has Problem, Change, Scope, and Verification sections. The Problem section explains the failure and its cause. The Change section names the fix and the helper it uses. The Scope section says this is a bug fix for one call site and gives a reason for skipping an issue. The Verification section lists the environment, exact commands, before and after output, the regression test result, and the untested platforms. The author also states the model and harness used, as the template asks. The description does not link a separate issue, but it explains why none is needed. The template's Scope guidance is met.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: pingdotgg/t3code
  • Branch: main
  • File: .coderabbit.config.ts
  • Commit: 28d8a63
  • Layers: Repository TS config
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 469b6bfc-cb6b-4d26-852a-0df04be83c1f
Commits

Reviewing files that changed from the base of the PR and between 28d8a63 and 54b74ff.

Files selected for processing: 2

  • apps/server/src/cli/thread.test.ts
  • apps/server/src/cli/thread.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@juliusmarminge juliusmarminge added the takeover:in-progress A takeover lead is working on this PR label Nov 24, 2026
@juliusmarminge
Merge remote-tracking branch 'origin/main' into fix/cli-thread-git-di…
e56fa9f
…r-worktree-lookup
@juliusmarminge

juliusmarminge commented Nov 24, 2026

Copy link
Copy Markdown
Member

Evidence

Run the same synthetic repository and linked-worktree setup against independently built CLI/server instances with fresh databases. Register repo, then from inside it run t3 thread list --json --base-dir <data> --project ../repo-feature/pkg, first normally and then with GIT_DIR=.git.

Environment: Linux x86_64, Node v26.13.1, server bound to 127.0.0.1:47391, T3CODE_DEV_SEED=0. Both control commands returned [], exit 0. The inherited relative GIT_DIR command failed on base and returned [], exit 0 on head. Visuals render captured real CLI output; videos replay commands and output rather than recording a desktop.

Before After
Before: relative GIT_DIR causes project lookup failure After: relative GIT_DIR resolves successfully
a326dea2f9 e56fa9f98f
Command/output replay · Transcript Command/output replay · Transcript

Reproduction and seed driver · Transcript renderer

Not shown:

  • Other inherited Git repository selectors and other operating systems were not exercised; this proof covers the reported relative GIT_DIR=.git reproduction.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@juliusmarminge juliusmarminge added takeover:ready Takeover done; auto-lands when gates pass and removed takeover:in-progress A takeover lead is working on this PR labels Nov 24, 2026
@juliusmarminge
juliusmarminge merged commit 38634aa into pingdotgg:main Nov 24, 2026
55 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@juliusmarminge juliusmarminge removed the takeover:ready Takeover done; auto-lands when gates pass label Nov 24, 2026
@patroza patroza mentioned this pull request Nov 24, 2026
Merge upstream main through 26f4c7550e7a patroza/t3code#673
Merged
@Yarden-zamir Yarden-zamir mentioned this pull request Nov 24, 2026
chore(sync): merge pingdotgg/t3code main Yarden-zamir/t3code#628
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

size:XS 0-9 changed lines (additions + deletions). vouch:unvouched Author is not yet trusted in the VOUCHED list.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@only21mil @juliusmarminge
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.