Skip to content

🤖 perf: re-read git status after a passive fetch settles #5572

Description

@ThomasK33

Problem

A passive git fetch started by an ordinary refresh (subscription, window focus, or a file-modifying tool) never triggers a status re-read after it settles. GitStatusStore.updateGitStatus() starts the fetch in the background (tryFetchWorkspaces → fetchWorkspace) and reads status at the same time. When the fetch, or one of its delayed secondary-repo fetches, brings new remote refs, the footer's ahead/behind and incoming counts keep showing the pre-fetch refs until the next trigger.

This behavior already exists on main. Before #5566, unrelated workspace metadata events re-read status on every event, which hid the problem in busy sessions. #5566 removes that churn on purpose. It adds a post-fetch re-read only for fetches forced by a checkout change.

Reproduction

  1. Open workspace A whose branch tracks a remote.
  2. Push a new commit to A's upstream from another clone.
  3. Focus the Xum window. Xum reads status and starts a passive fetch at the same time.
  4. Wait for the fetch to finish. The footer still shows the old behind count until the next focus, workspace switch, or file edit.

Desired behavior

After a passive fetch (and its secondary-repo fetches) succeeds, read status once more, with a bound. Constraints:

  1. lastFetch is recorded before the secondary fetches settle, and a completion-triggered refresh can wait through the 3 s debounce. Either delay can make the fetch key due again. A naive "refresh after every fetch" can then loop: fetch → refresh → fetch.
  2. Do not double the status runs for every focus or file trigger when no refs changed. Consider comparing ref state, or re-reading only when the fetch output reports updated refs.

Tests: one status re-read after a fetch that updated refs, no loop across the debounce and backoff windows, and no extra runs when nothing changed.

Owner and trigger

Owner: @ThomasK33 (perf owner). Follow-up trigger: after #5566 lands.


Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high

Activity

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

Metadata

Metadata

Assignees

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