Skip to content

[Bug]: Automatically pull never runs for a project root that no client is subscribed to #43064

Done

Description

@schabimperle

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/server

Steps to reproduce

  1. Run the server headless on Linux with web and mobile clients. Enable Automatically pull for a project and let new threads start in a worktree (defaultThreadEnvMode: worktree).
  2. In a worktree thread, commit and push to the default branch: git push origin HEAD:main. The push updates refs/remotes/origin/main, which the project root shares with the worktree.
  3. Keep clients open on worktree threads only, or close them all. Nothing shows the project root's Git status.
  4. Wait several automatic fetch intervals. Run git -C <project root> status -sb: it reports [behind N], and the trace has no pullCurrentBranch span.
  5. Open a view that shows the project root's Git status. The pull follows within seconds.

Expected behavior

The user guide, "Keep the default branch current", says Automatically pull keeps "the default-branch checkout up to date with its configured upstream". The only exceptions it names are changed files, untracked files and local commits. The root should therefore be checked on the automatic fetch interval whether or not a client is subscribed to it.

Actual behavior

Automatically pull runs in two places. One is autoPullProjects at server start. The other is maybeAutoPull, called from the remote refresh loop. That loop only exists while streamStatus holds a remote subscription for that checkout. When threads work in worktrees and land by pushing from there, nothing subscribes to the root between server restarts, so the root falls behind without any sign.

This looks like an interaction with #15666. That PR moved passive sidebar, search and palette consumers off remote refresh loops for performance, and only active Git controls retain one now. Before it, a project row in the sidebar kept the root's loop running, and automatic pull ran with it. The performance change itself looks right; automatic pull just depended on a loop it no longer gets.

On our install the root stayed 14 commits behind from 16:13 to 19:35 on 25 Nov. The pull at 19:35 came 38 s after a client subscribed to the root's status, in the same trace (log below). Tools that read files from the root then see stale content, such as AGENTS.md links into its docs and the t3.json setup scripts.

Impact

Major degradation or frequent failure

Version or commit

v0.1.12 (ca81b7b). The same code is on main today.

Environment

Linux x64 (Debian 13 container), headless server, web and Android clients, Git 2.49.0

Logs or stack traces

# One trace (7a85922e); the root's reflog shows the previous pull at 16:13.
19:34:28  ws.rpc.subscribeVcsStatus             cwd=<project root>
19:34:28    VcsStatusBroadcaster.retainHeadWatcher
19:35:06    VcsStatusBroadcaster.maybeAutoPull     2410 ms
19:35:06      GitVcsDriver.pullCurrentBranch.pull  1479 ms

Workaround

Land worktrees with a small script that pushes from the worktree and then runs git -C <project root> merge --ff-only origin/<default>.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions