Skip to content

[Bug]: Window focus runs git fetch even with Git fetch interval set to 0 #13235

Description

@Cybertron1

Before submitting

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

Area

apps/web

Steps to reproduce

  1. Use a repo whose origin is an SSH remote, with keys held by a GUI SSH agent that asks for approval on every use (1Password SSH agent).
  2. Settings → Source Control → set Git fetch interval to 0.
  3. Open a thread in that repo.
  4. Switch to another app, wait more than 15s, switch back to T3 Code.

Expected behavior

No git fetch runs, and the SSH agent never prompts.
The setting's help text says: "Set to 0 to avoid automatic Git prompts."

Actual behavior

Each time the window regains focus or becomes visible, T3 Code runs git fetch --quiet --no-tags <remote>, and 1Password prompts for key approval.

Why it happens:

Only the periodic loop checks automaticGitFetchInterval: VcsStatusBroadcaster.ts#L558.
refreshStatus does not, and every caller of it fetches, including the post-mutation refreshGitStatus calls in ws.ts and the worktree branch rename in ProviderCommandReactor.

Suggested fix: in refreshStatus, read automaticGitFetchInterval and pass refreshUpstream: false when it is zero.
An explicit user action like Pull or Push can still fetch.

Related: #1190, #1467 (same symptom, both closed when the interval setting landed in #2605).

Impact: Minor bug or occasional failure. It's disruptive, though: an approval prompt steals focus every time I switch back to the app.

Version or commit: main @ f5ef0dd

Environment: Windows 11 + WSL2 (Linux 6.18), git 2.55.0, core.sshCommand=/mnt/c/Windows/System32/OpenSSH/ssh.exe, 1Password SSH agent.

Suggested fix: in refreshStatus, read automaticGitFetchInterval and pass refreshUpstream: false when it is zero.
An explicit user action like Pull or Push can still fetch.

Related: #1190, #1467 (same symptom, both closed when the interval setting landed in #2605).

Impact

Cosmetic issue

Version or commit

main @ f5ef0dd

Environment

Windows 11 + WSL2 (Linux 6.18), git 2.55.0, core.sshCommand=/mnt/c/Windows/System32/OpenSSH/ssh.exe, 1Password SSH agent.

Logs or stack traces

Screenshots, recordings, or supporting files

No response

Workaround

Fetch over HTTPS and push over SSH, so background fetches don't touch the SSH agent:

git remote set-url origin https://<host>/<repo>.git
git remote set-url --push origin git@<host>:<repo>.git

Activity

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

    acceptedfeature request acceptedbugSomething is broken or behaving incorrectly.via-triageFiled through npx t3 triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions