Skip to content

fix(server): Automatically pull keeps tracked repositories current - #43494

Open
Zeyddd wants to merge 1 commit into
pingdotgg:mainfrom
Zeyddd:fix/autopull-tracked-repositories
Open

Zeyddd wants to merge 1 commit into
pingdotgg:mainfrom
Zeyddd:fix/autopull-tracked-repositories

Conversation

@Zeyddd

@Zeyddd Zeyddd commented Nov 26, 2026

Copy link
Copy Markdown

Problem

With Automatically pull on, a project whose folder is a plain folder holding several checkouts never pulls any of them. Automatic pull checks only the project's own root, which is not a repository, so it skips the project as "not-a-repository". The tracked checkouts fall further behind even when they are clean, on their default branch and tracking an upstream. T3's fetch still updates origin/<default>, so they just show as behind. On one of my machines a checkout of this kind sat 67 commits behind.

This is the auto-pull counterpart of #42802 (pull requests, fixed by #42828).

Change

autoPullProjects drives both the startup pass and the fetch-interval pass. It now also covers each enabled project's tracked folders, with two guards:

  • A tracked folder is pulled only when git resolves it as its own checkout root. A plain tracked folder inside another repository would otherwise resolve upward and pull that repository, even one with an empty .git entry of its own.
  • A tracked folder that is also a project of its own follows that project's setting, so a project with automatic pull turned off stays untouched.

The pull itself is unchanged: --ff-only, clean default branch, not ahead.

Verification

  • New test in GitVcsDriverCore.test.ts, on real repositories: a plain project root tracks three folders: a clone that is behind, a plain folder inside another behind clone, and a clone that is its own project with automatic pull off. Only the first is pulled. The test fails on main, fails with the root check removed, and fails with the own-project check removed.
  • vp run check:changed: format, lint, knip and typecheck pass. Two tests in GitVcsDriverCore.test.ts fail on this machine: "runs background Git in its own lane…" and "fetches the selected worktree base for Changes". They fail the same way on unchanged main at a7ead0e.
  • Real server (t3 serve with an isolated base dir): a plain folder holding one clone that is behind its local bare remote, added with t3 project add, with defaultAutoPull: true. On main the clone was still behind after 60 seconds. With this change it was pulled at startup.

Not covered here, to keep to one problem:

  • The candidates come from the stored folder list, as on the Pull Requests and Issues pages. A repository newly added to ignoreRepositories while the server was stopped can still be pulled at startup.
  • The root check compares path strings. A tracked path typed with different letter case than the disk on a case-insensitive volume is skipped, and a symlink to an opted-out project's checkout is not recognised as that project.
  • A plain tracked folder inside another repository still costs that repository one status fetch before it is skipped.

Written by Claude Opus 5.5 in Claude Code, reviewed by GPT-6.2 Astra in Codex.

Automatic pull checked only each project's root folder. A project whose
root is a plain folder holding several checkouts skipped the root as
"not a repository", so its tracked repositories never moved even when
clean, on their default branch and behind their upstream.

The startup and fetch-interval pass now also covers each enabled
project's tracked folders. A tracked folder is pulled only when git
resolves it as its own checkout root, so git's upward lookup cannot pull
a repository that merely contains it, and a folder that is a project of
its own follows that project's setting.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-26T13:15:40.284027Z 384c9f4 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Nov 26, 2026
@coderabbitai

coderabbitai Bot commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

autoPullProjects now considers tracked folders from enabled projects. It validates each tracked folder against the Git status root before pulling. Tests cover tracked repositories, nested plain folders, opted-out projects, and existing startup-pull scenarios.

Changes: Tracked-folder auto-pull

Layer / File(s) Summary
Collect eligible pull roots
apps/server/src/serverRuntimeStartup.ts
autoPullProjects now accepts trackedFolders and adds tracked folders from enabled projects unless a folder is already a project workspace.
Validate roots and pull
apps/server/src/serverRuntimeStartup.ts, apps/server/src/serverRuntimeStartup.test.ts, apps/server/src/vcs/GitVcsDriverCore.test.ts
The startup flow fetches Git status for each root and skips tracked-folder roots when real-path resolution fails or does not match the Git root. Tests cover tracked repositories, nested plain folders, opted-out projects, and existing startup-pull cases.

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

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant ServerStartup
  participant GitVcsDriver
  participant FileSystem
  ServerStartup->>GitVcsDriver: Fetch status for root
  ServerStartup->>FileSystem: Resolve tracked-folder real path
  FileSystem-->>ServerStartup: Return path or resolution failure
  ServerStartup->>GitVcsDriver: Pull when root validation and eligibility checks pass
Loading

Suggested reviewers: juliusmarminge, abhiram-745

Merge Risk: Minimal · up to 384c9

Automatic pull at startup and on fetch intervals now also covers tracked folders that are their own Git checkouts, and it skips plain folders inside other repositories. No concrete merge-blocking risk was found. The known edge cases the author listed remain unaddressed.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the fix and its main effect: automatic pull now keeps tracked repositories current. It follows the conventional commit form and matches the changeset, which extends autoPullProjects to…
Description check Passed The description follows the template. It has Problem, Change, Scope, and Verification sections. The Problem and Change sections explain the bug and the fix in detail. Scope links the related issue #42…
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 main effect: automatic pull now keeps tracked repositories current. It follows the conventional commit form and matches the changeset, which extends autoPullProjects to tracked folders. It 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 and Change sections explain the bug and the fix in detail. Scope links the related issue #42802 and #42828 and lists what is not covered. Verification gives the new test, the real-server check, and the two failing tests on main. The author does not state a model and harness in the closing line, which the template asks for when an agent was used. The author does give the model names, so this is covered. The Scope section does not link an issue for this bug directly; it refers to a related issue number only, so the reviewer must confirm that the linked issue shows this bug.

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

Commits

Reviewing files that changed from the base of the PR and between f437d6c and 384c9f4.

Files selected for processing: 3

  • apps/server/src/serverRuntimeStartup.test.ts
  • apps/server/src/serverRuntimeStartup.ts
  • apps/server/src/vcs/GitVcsDriverCore.test.ts

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

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 384c9f49f0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

const projectRoots = new Set(projects.map((project) => project.workspaceRoot));
const workspaceRoots = new Map(enabled.map((project) => [project.workspaceRoot, false]));
for (const project of enabled) {
for (const folder of project.trackedFolders ?? []) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Refresh discovered folders before scheduling automatic pulls

When an already-discovered checkout is added to t3.json.ignoreRepositories while the server is stopped, its persisted trackedFolders entry still reaches this loop: the startup/interval caller reads ProjectStore.listShells() directly without refreshing discovery. Consequently, a clean, behind default-branch checkout is still pulled despite being excluded from the project, and headless interval passes can keep doing so until project hydration synchronizes the folders. Resolve WorkspaceFolders.projectFolders(project) before building the candidates; it already reapplies the ignore list and drops stale discovered entries.

Useful? React with 👍 / 👎.

for (const project of enabled) {
for (const folder of project.trackedFolders ?? []) {
// A folder that is a project of its own follows that project's setting.
if (!projectRoots.has(folder.path)) workspaceRoots.set(folder.path, true);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Resolve checkout aliases before checking project opt-outs

If an enabled project tracks /links/repo, a symlink to /repos/repo, while an opted-out project uses /repos/repo, this string lookup misses the opted-out project. Project and tracked-folder normalization use path.resolve, which retains symlink spellings, while the later root check uses realPath and accepts the alias. A clean, behind default-branch checkout is therefore pulled despite its own project's setting. Compare canonical paths for both project roots and tracked-folder candidates before deciding whether another project's opt-out applies.

Useful? React with 👍 / 👎.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:unvouched Author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant