fix: resolve git origin in linked worktrees (Tia storage key + baseline fetch) - #1820
Draft
dammyammy wants to merge 1 commit into
Draft
fix: resolve git origin in linked worktrees (Tia storage key + baseline fetch)#1820dammyammy wants to merge 1 commit into
dammyammy wants to merge 1 commit into
Conversation
…aseline fetch In a linked git worktree, .git is a file pointing at the real git dir, so reading $projectRoot/.git/config directly fails. Both Storage::rawOriginUrl() and BaselineSync::detectGitHubRepo() bail out silently as a result: - the storage key falls back to a realpath hash, so worktrees of the same repository do not share the documented origin-derived project key, and - --tia --baselined silently skips the CI baseline fetch in every worktree. Keep the fast .git/config file read for regular checkouts and fall back to `git config --get remote.origin.url` (run inside the project root) when .git is not a directory.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
In a linked git worktree,
.gitis a file (agitdir:pointer), not a directory. Two Tia code paths read$projectRoot/.git/configdirectly and therefore silently fail in every worktree:Storage::rawOriginUrl()— the storage key falls back to a realpath hash instead of the origin identity. The docs state worktrees of the same repository share one cache; today they don't.BaselineSync::detectGitHubRepo()— returnsnull, so--tia --baselinedsilently skips the CI baseline fetch and falls back to a full local re-record, exactly in the throwaway checkouts (agent/CI worktrees) where a fetched baseline helps most.Measured on v5.0.2:
Fix
Keep the fast
.git/configfile read for regular checkouts; when.gitis not a directory, fall back togit config --get remote.origin.urlexecuted inside the project root (5s timeout, failures degrade to the existing null behaviour).Notes for review
Storage::projectKey()still prefixesslug(basename($projectRoot)), so two worktrees end up with sibling storage dirs (wt-a-<hash>,wt-b-<hash>) rather than literally one shared dir. If full sharing is the intent of the docs, the slug would also need to derive from the origin identity — happy to extend the PR that way if preferred; keeping keys per-worktree does avoid concurrent runs in different worktrees racing on onegraph.json.--baselinedworks from worktrees, which covers the main practical need (fresh worktrees replaying from the CI baseline in seconds).Draft — description/scope still being refined.