Skip to content

Background git status refresh triggers SSH passphrase prompt and cancels it #1467

@clones144

Description

@clones144

Summary

When a repository remote uses SSH and the SSH key is locked, t3code's passive git status refresh can trigger an SSH key passphrase prompt. The prompt steals focus, then disappears before the user can finish typing because the background git process times out.

This makes normal editing disruptive and makes the app feel like it is interrupting the user unexpectedly.

Repro

  1. Open a repo in t3code whose origin uses SSH.
  2. Make sure the SSH key is not already loaded into ssh-agent.
  3. Open the app and wait for git status polling, or focus/reconnect the window.
  4. Observe an SSH passphrase prompt appear briefly and then disappear.

Actual

  • Passive git status polling triggers interactive SSH auth UI.
  • The passphrase window steals focus.
  • The prompt is canceled before the user can finish typing.

Expected

  • Passive/background status refresh should never trigger an interactive auth prompt.
  • If ahead/behind counts require remote access, the background refresh should fail quietly when credentials are unavailable.
  • Interactive auth should only happen on explicit user actions such as pull/push/fetch.

Suspected Cause

The git status path appears to do a background upstream refresh with git fetch --quiet --no-tags ... before computing status, and that fetch is on a short timeout. If SSH needs a passphrase, the auth dialog is opened by ssh, but the fetch process is then canceled before the user can complete it.

Relevant code paths in the current tree:

  • apps/web/src/lib/gitReactQuery.ts
    • git status polling every 15s and on focus/reconnect
  • apps/server/src/git/Layers/GitCore.ts
    • statusDetails() calls upstream refresh first
    • fetchUpstreamRefForStatus() runs a background git fetch
    • that background fetch uses a 5s timeout

Suggested Fix

Make the background upstream refresh non-interactive, for example by setting non-interactive git/ssh env for that status-refresh fetch only, or by skipping the remote refresh during passive polling when credentials are not already available.

That keeps ahead/behind refresh working when auth is already available, without stealing focus or popping up passphrase windows during normal UI polling.

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