GeezerVison is showing github.com — fix(server): projects no longer show another repo's Git state when T3 starts inside a Git command by only21mil · Pull Request #28795 · pingdotgg/t3code
Conversation
only21mil
commented
Nov 1, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Problem
When T3 Code starts inside a Git command (a hook or git rebase --exec in a linked worktree, which export an absolute GIT_DIR), every project's Git commands run against that worktree's repository. Every project then shows its branch, status and repository identity, and checkpoints are written into it.
Change
gitProcessEnv in VcsProcess.ts builds the environment for a Git child process: it first unsets the repository selectors the server inherited (GIT_DIR, GIT_WORK_TREE, GIT_INDEX_FILE and the rest of the list #12181 clears, plus GIT_CEILING_DIRECTORIES), then applies the caller's env, so selectors a caller sets on purpose still win. It is used at the three places that spawn Git: GitVcsDriverCore, VcsProcess and RepositoryIdentityResolver. Provider CLIs and terminals still inherit the server's environment unchanged.
Scope
A bug fix for wrong data: Git commands for one project run against a different repository. Fixes #35099. It extends the narrow fix in #12181 to the shared Git spawn paths. The scope covers Git subprocesses only.
Verification
To see it on Linux web:
- Make two repositories,
demo-project on feature/demo-project and inherited-other on wrong-repository-branch.
- Start the server with
GIT_DIR=<inherited-other>/.git, then add demo-project.
- The sidebar labels it
example/inherited-other and the branch picker shows wrong-repository-branch.
The server ran with hostname "Test machine", GIT_DIR set to the second repository and fresh homes. Before is this head with main 0a9abddaee's four changed server files mounted over it; after is this head 5036c42d34 (a merge of that main). On web, desktop, iOS and Android the project shows wrong-repository-branch before and feature/demo-project after. Three new tests fail on main and pass here; on this head (Linux) check:changed passes, and with main's four server files swapped in the three tests fail.
|
Before (main 0a9abddaee production files) |
After (this head 5036c42d34) |
| Web |
Web before: wrong-repository-branch, 1 changed
 |
Web after: feature/demo-project, clean
 |
| Desktop |
Desktop before: wrong-repository-branch
 |
Desktop after: feature/demo-project
 |
| iOS |
iOS before: wrong-repository-branch
 |
iOS after: feature/demo-project
 |
| Android |
Android before: wrong-repository-branch
 |
Android after: feature/demo-project
 |
Not checked:
- Windows. Matching the variable names case-insensitively follows
gitConfigEnv, but it was not run on Windows.
- Git versions other than 2.56.
The change in full, the tests and the capture method
When T3 Code starts inside a Git command, every project's Git commands can run against the wrong repository. In a linked worktree, Git hooks and git rebase --exec export an absolute GIT_DIR (commit hooks also export GIT_INDEX_FILE). A T3 server started from there passes those variables to all of its Git subprocesses. Every project then shows that worktree's branch, status and repository identity, and checkpoints are written into it.
Reproduction: make two repositories, demo-project on feature/demo-project and inherited-other on wrong-repository-branch. Start the server with GIT_DIR=<inherited-other>/.git, then add demo-project. The sidebar labels it example/inherited-other and the branch picker shows wrong-repository-branch.
gitProcessEnv in VcsProcess.ts builds the environment for a Git child process. It first unsets the repository selectors the server inherited (GIT_DIR, GIT_WORK_TREE, GIT_COMMON_DIR, GIT_INDEX_FILE, GIT_OBJECT_DIRECTORY, GIT_ALTERNATE_OBJECT_DIRECTORIES, the same list #12181 clears, plus GIT_CEILING_DIRECTORIES), then applies the caller's env, then the existing safe.bareRepository=explicit config from #20440. Selectors a caller sets on purpose still win, such as a checkpoint's private GIT_INDEX_FILE or worktree removal's bound GIT_DIR.
It is used at the three places that spawn Git and already added the bare-repository config: GitVcsDriverCore, VcsProcess (checkpoints, file listing, source-control CLIs) and RepositoryIdentityResolver.
The checkpoint commit env no longer spreads process.env itself, because that spread re-added the inherited selectors as if the caller had set them. #12181's nested-repository probe no longer needs its own cleared env, so that block is removed.
Other GIT_* variables are left alone, including config, auth, SSH and locale. Provider CLIs and terminals still inherit the server's environment unchanged.
This is a small, focused fix for an obvious bug: Git commands for one project run against a different repository. It uses the CONTRIBUTING exception for obvious bugs, with no issue or discussion. It extends the narrow fix in #12181 to the shared Git spawn paths and clears the variables #12181 clears, plus GIT_CEILING_DIRECTORIES.
The scope covers Git subprocesses only. Provider and terminal environments are unchanged.
Tests, on macOS with git 2.56. Each fails on main and passes on this branch:
GitVcsDriverCore.test.ts "ignores repository selectors inherited by the server". On main, status reports the other repo's branch: expected 'other-repository' to equal 'main'. It also covers a private GIT_INDEX_FILE commit context and an explicit bare GIT_DIR.
GitVcsDriver.test.ts "checkpoint capture ignores repository selectors inherited by the server" extends the fix(server): checkpoint workspaces with empty nested repositories #12181 test. The inherited GIT_DIR, GIT_WORK_TREE and GIT_INDEX_FILE now point at a second repository. On main, the checkpoint ref is written there instead. It also checks the second repository is untouched, the fix(server): checkpoint workspaces with empty nested repositories #12181 nested-HEAD exclusion still holds, and an explicit bare GIT_DIR still works on this path.
RepositoryIdentityResolver.test.ts "ignores repository selectors inherited by the server". On main it fails with expected 'github.com/t3tools/other' to be 'github.com/t3tools/t3code'.
Runs on this head 5036c42d34, a merge of main 0a9abddaee (Linux):
vp run check:changed against main: format, lint, GraphQL, knip, typecheck and tests (364) pass.
- The vcs, sourceControl, workspace, checkpointing, project and git suites: 844 tests pass.
- With main's four changed server files swapped in, the three "inherited by the server" tests fail (3 of 3).
Git sets these in a linked worktree's pre-commit, post-commit, post-checkout and git rebase --exec (an absolute GIT_DIR, and for commit hooks an absolute GIT_INDEX_FILE), checked with a hook that prints them on git 2.56.
UI, on each client. The server ran with hostname "Test machine", GIT_DIR set to the second repository, --no-seed and fresh homes. Before is this head with main 0a9abddaee's four changed server files mounted over it; after is this head 5036c42d34. Every client shows the same synthetic demo-project. Web, iOS and Android show a free replay turn; desktop shows the new-thread composer with no provider turn. Web ran in the Browser panel; the phones show the thread's Git controls menu.
Prior PRs
Generated with Claude Opus 5.5 and GPT-6.1 Terra and GPT-6.1 Sol in T3 Code Nightly
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
…rited
A T3 server started from a Git hook or `git rebase --exec` in a linked
worktree inherits GIT_DIR and GIT_INDEX_FILE, and every project's Git
commands then read and write that worktree instead of the project.
gitProcessEnv builds the Git child environment at the three Git spawn
sites (GitVcsDriverCore, VcsProcess, RepositoryIdentityResolver): it
unsets inherited repository selectors, then applies the caller's env, so
deliberate private-index and bare-repository overrides still win. The
nested-repository probe from pingdotgg#12181 no longer needs an env of its own.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Approvability
Verdict: Approved at 7ba2d9a
Macroscope's review found this PR approvable — Git commands now ignore inherited repository selectors so each project uses its own repository rather than the server’s launch context. Explicit command overrides and existing bare-repository safeguards are preserved.
You can add or adjust custom eligibility rules. Learn more.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
coderabbitai
Bot
commented
Nov 1, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|

Note
Reviews paused
It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.
Use the following commands to manage reviews:
@coderabbitai resume to resume automatic reviews.
@coderabbitai review to trigger a single review.
Use the checkboxes below for quick actions:
- Resume reviews
- Trigger review
No actionable comments were generated in the recent review.
Walkthrough
-
Git subprocess environments now remove inherited repository-selection variables before applying caller-provided values. Repository identity resolution and checkpoint operations use this environment construction. Regression tests cover inherited selectors that point to another repository and explicit selection of a bare repository.
Changes: Git subprocess environment isolation
| Layer / File(s) |
Summary |
Build Git subprocess environments apps/server/src/vcs/VcsProcess.ts, apps/server/src/vcs/GitVcsDriverCore.ts |
gitProcessEnv removes inherited Git repository selectors, applies caller-provided environment values, and adds safe.bareRepository=explicit. VcsProcess.spawn and GitVcsDriverCore use it. |
Use isolated environments for repository identity apps/server/src/project/RepositoryIdentityResolver.ts, apps/server/src/project/RepositoryIdentityResolver.test.ts |
Repository-root detection and remote discovery use gitProcessEnv. Tests cover identity resolution when inherited selectors point to another repository and set GIT_CEILING_DIRECTORIES for nested workspace resolution. |
Keep checkpoint operations on the requested repository apps/server/src/vcs/GitVcsDriver.ts, apps/server/src/vcs/GitVcsDriver.test.ts, apps/server/src/vcs/GitVcsDriverCore.test.ts |
Checkpoint HEAD checks no longer accept an environment override. Checkpoint commit environment construction no longer copies process.env, and nested-repository recovery no longer builds a sanitized environment. Tests check index and checkpoint-ref behavior when inherited selectors point elsewhere and confirm explicit bare-repository selection. |
Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Bug fix
Suggested reviewers: juliusmarminge, saphid
Merge Risk: Minimal · up to 5036c
-
The inherited Git discovery issue is addressed, and no actionable merge-blocking risk remains after normal checks.
Pre-merge checks: 4
-
| Check name |
Status |
Explanation |
| Title check |
 |
The title clearly describes the main fix: projects no longer use another repository’s Git state when T3 starts inside a Git command. |
| Linked Issues check |
 |
Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check |
 |
Check skipped because no linked issues were found for this pull request. |
| Description check |
 |
The description follows the repository template closely. It has Problem, Change, Scope, and Verification sections. The Problem section states the inherited Git selector bug and its effect. The Change … |
Full details: Description check
-
Explanation
The description follows the repository template closely. It has Problem, Change, Scope, and Verification sections. The Problem section states the inherited Git selector bug and its effect. The Change section explains gitProcessEnv and the three call sites. The Scope section links the bug as #35099 and cites the CONTRIBUTING exception for obvious bugs. The Verification section gives a reproduction, before/after captures across clients, test names with main-branch failure output, and the commands and results on a specific head. It also lists what was not checked (Windows, Git versions other than 2.56). It ends with the model and harness used, as the template requests. Minor gap: the Verification section is long and partly duplicated inside the collapsed details block, but the required information is present.
Finishing Touches
-
Generate unit tests (beta)
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info
-
Run configuration
-
Commits
-
Reviewing files that changed from the base of the PR and between c7a1c4e and 5036c42.
Files selected for processing: 5
-
apps/server/src/vcs/GitVcsDriver.test.ts
apps/server/src/vcs/GitVcsDriver.ts
apps/server/src/vcs/GitVcsDriverCore.test.ts
apps/server/src/vcs/GitVcsDriverCore.ts
apps/server/src/vcs/VcsProcess.ts
Limit details: You’ve used all 10 included reviews currently available.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Nov 3, 2026
maria-rcks
commented
Nov 3, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Note Written by claude-opus-5-5 on behalf of Maria
Merged current main into this branch again without rebasing (c7a1c4e570). Main's HostProcess.Environment refactor (#31218) conflicted with this change in three files:
GitVcsDriver.ts: kept this PR's removal of the host-env spread in the checkpoint commit env and of nestedRepoEnv, since gitProcessEnv already clears inherited selectors.
GitVcsDriverCore.ts: the status env now spreads HostProcess.Environment (main's side) and then gitProcessEnv (this PR's side).
GitVcsDriver.test.ts: kept this PR's inherited-selector checkpoint test, which points GIT_DIR, GIT_WORK_TREE and GIT_INDEX_FILE at another repo.
No other behavior changes. The diff against main is still seven files. Blacksmith vp run check:changed github/main passed: format, lint, knip, GraphQL, three affected typechecks, and all 354 tests across five files.
Earlier history: merged main once before (66763a2be2). f4eca04c94 cleared inherited GIT_CEILING_DIRECTORIES before caller overrides, per review.
|
only21mil reacted with thumbs up emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
coderabbitai
Bot
left a comment
•
edited
Loading
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.
- Fix comments: Fix CodeRabbit comments on this PR
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.
# Conflicts:
# apps/server/src/vcs/GitVcsDriver.test.ts
# apps/server/src/vcs/GitVcsDriver.ts
# apps/server/src/vcs/GitVcsDriverCore.ts
Git child processes keep main's LANGUAGE=C for git commands in VcsProcess,
now passed through gitProcessEnv alongside the caller's env.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Note 🤖 Opus 5.5 replying on behalf of Victor.
Main fixes this as of 80cccdc (#35119): a project no longer shows another repository's Git state when T3 starts inside a Git command, so I am closing this PR.
|
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.
|