Before submitting#
Area#
apps/desktop
Steps to reproduce#
- Create a folder in iCloud
- Use --git-dir to move the git metadata and files out outside the project
- Open the original folder in t3code as a project
- t3 opens the root project in the git folder instead and can't find anything like skills
Expected behavior#
The follow to the git-dir and it's git-dir is fine, but if the back link is missing it should stay in the requested folder not a random git folder.
Actual behavior#
Follows git-dir blindly and doesn't respect the folder the user requested.
Impact#
Minor bug or occasional failure
Version or commit#
Nightly latest
Environment#
MacOS
Logs or stack traces#
Screenshots, recordings, or supporting files#
No response
Workaround#
Fixed by setting the backlink:
git --git-dir=$HOME/.obsidian/git/v1 config core.worktree $HOME/obsidian/V1
Triage#
Confirmed on current
main(6d1d54944). This is a real server VCS / project-root bug, not a desktop-only picker glitch and not an iCloud-only filesystem quirk. Desktop is just the surface that opened the folder. Not already fixed. No later commit teaches T3 to keep the user-requested folder whengit-dirhas nocore.worktreeback-link. No duplicate found for separate-git-dir /core.worktree/ iCloud+Obsidian layouts.What you reported. Vault (or other project) lives in iCloud. Git metadata was moved out with
--git-dir(your paths:$HOME/.obsidian/git/v1and$HOME/obsidian/V1). Opening the original folder in T3 relocates the “root project” into that git directory, so project-local things such as skills disappear. Setting the back-link fixes it:That matches the code. T3 follows
git-dirand then trusts Git’s idea of the main worktree. Withoutcore.worktree, Git names the git directory itself as that worktree.What the code does#
1. Repo detection uses
--show-topleveland--git-common-dir, then treats the common dir as a cwd when it is not named.git.detectRepositoryrecordsrootPathfrom--show-toplevelandmetadataPathfrom--git-common-dir:https://github.com/pingdotgg/t3code/blob/6d1d549441be84f19696ab59ed7e2fbf305280d4/apps/server/src/vcs/GitVcsDriver.ts#L535-L558
resolveRepositoryPathsdoes the same split (worktreeRootvsgitCommonDir):https://github.com/pingdotgg/t3code/blob/6d1d549441be84f19696ab59ed7e2fbf305280d4/apps/server/src/vcs/GitVcsDriverCore.ts#L1099-L1178
For fetches, default-branch lookups, remotes, and
worktree list, cwd is:https://github.com/pingdotgg/t3code/blob/6d1d549441be84f19696ab59ed7e2fbf305280d4/apps/server/src/vcs/GitVcsDriverCore.ts#L1082-L1087
A normal repo (
…/project/.git) stays in the project. A separate git-dir namedv1is used as cwd. That is the unconditional follow.2.
git worktree listreports the git-dir as the main worktree for this layout.listRefsmaps each local branch to a path fromgit --git-dir <common> worktree list --porcelain. Git does not reconstruct the real checkout from agitdir:pointer. For--git-dir=$HOME/.obsidian/git/v1it prints:even when you ran the command from
$HOME/obsidian/V1. T3 then keeps that path ifstatsucceeds (the git dir exists):https://github.com/pingdotgg/t3code/blob/6d1d549441be84f19696ab59ed7e2fbf305280d4/apps/server/src/vcs/GitVcsDriverCore.ts#L271-L299 https://github.com/pingdotgg/t3code/blob/6d1d549441be84f19696ab59ed7e2fbf305280d4/apps/server/src/vcs/GitVcsDriverCore.ts#L2736-L2781
3. That fake worktree is eligible for reuse.
preparePullRequestThreadreuses a branch worktree whenever its listed path is not the project cwd. Vault cwd ≠ git-dir, so it will treat$HOME/.obsidian/git/v1as an existing worktree and hand the thread that path:https://github.com/pingdotgg/t3code/blob/6d1d549441be84f19696ab59ed7e2fbf305280d4/apps/server/src/git/GitManager.ts#L2322-L2507
Same class of mistake anywhere else we prefer
ref.worktreePathover the folder the user opened.4. Skills are scanned from cwd, not from the git-dir.
Cursor (and the other drivers) look under
<cwd>/.agents/skills,<cwd>/.cursor/skills,<cwd>/.claude/skills, etc.:https://github.com/pingdotgg/t3code/blob/6d1d549441be84f19696ab59ed7e2fbf305280d4/apps/server/src/provider/Drivers/CursorSkills.ts#L218-L230
A git directory is
objects/,refs/,HEAD. There are no skills there. That is the “can’t find anything like skills” report.5.
core.worktreeis the missing back-link, and T3 never reads it.git rev-parse --show-toplevelfrom the vault is often already the vault when a.gitfile (gitdir: …) is present.--show-toplevel/--is-inside-work-treefrom the git-dir fail unlesscore.worktreeis set. T3 never consultscore.worktree. There is no test for--separate-git-dir/ agitdir:pointer that does not point at…/worktrees/….AgentSessionScanner.readGitIdentityfollowsgitdir:only to classify worktrees vs main repos. A pointer at~/.obsidian/git/v1is treated as a normal repository, not as “stay in the folder that had the pointer”:https://github.com/pingdotgg/t3code/blob/6d1d549441be84f19696ab59ed7e2fbf305280d4/apps/server/src/project/AgentSessionScanner.ts#L688-L728
Why the workaround works#
core.worktreeis Git’s back-pointer from the external git-dir to the checkout you opened. After it is set,--show-topleveland work-tree operations resolve to$HOME/obsidian/V1even when T3 runs git with--git-dir. T3 should do the equivalent itself: if that back-link is missing, keep the requested folder. Followinggit-dirfor metadata is fine. Relocating the project/thread cwd to the git-dir is not.Fix direction#
git -C <user-opened-path> rev-parse --show-toplevel. If that fails or returns the git-dir /--git-common-dir, keep the opened path.basename(gitCommonDir) === ".git" ? dirname : gitCommonDiras a project or thread cwd. That is only valid as a process cwd for--git-dirmetadata commands.git worktree listentries that are the git-dir, fail--is-inside-work-tree, or are not the user-opened folder / a real linked worktree under…/worktrees/….preparePullRequestThread(or any “branch already has a worktree” path).core.worktreeand use it when present; never invent a root from the git-dir when it is absent.echo gitdir: $GITDIR > .git+ unsetcore.worktree. Opening the vault must keep that cwd for listing, skills, and worktree reuse.Reporter workaround stands. Safe to keep using until this ships.