Skip to content

Event-based git refresh with a self-healing backstop and a disable setting - #783

Merged
sbertix merged 2 commits into
mainfrom
sbertix/gh-622-event-based-git-polling-and-ability-to-d
Aug 8, 2026
Merged

Event-based git refresh with a self-healing backstop and a disable setting#783
sbertix merged 2 commits into
mainfrom
sbertix/gh-622-event-based-git-polling-and-ability-to-d

Conversation

@sbertix

@sbertix sbertix commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator

Closes #622
Closes #542
Closes #615

Summary

Makes worktree status refresh event-driven with a rare, self-healing
backstop, and adds a setting to turn background refresh off.

  • Local status (changed-line counts, branch) is event-driven — FSEvents on
    the worktree (plus the linked-worktree admin dir) and a kqueue on HEAD
    so the recurring idle git diff HEAD --shortstat CPU spikes are gone.
  • A rare, foreground-only reconcile sweep rolls through worktrees one at a
    time and heals the edges pure event-triggering drops: linked-worktree
    commits, remote line counts, external GitHub merges (auto-archive-on-merge),
    and a dead watcher. It re-arms watchers, so a manual refresh repairs a
    broken one.
  • New setting "Refresh repository status in the background"
    (automaticRepositoryRefreshEnabled, on by default) stops the remote-branch
    SSH poll, the reconcile sweep, and automatic pull-request checks. Turn it
    off to stop SSH passphrase prompts ([Feature Request] Stop git polling #542) or GitHub rate limiting (Too-frequent GitHub status polling eats rate limits #615)
    from background polling. Worktree discovery stays live and user-initiated
    refreshes always run.

Builds on and salvages @lmjiang's event-driven groundwork from #664 (that
commit is preserved here); this re-adds the backstops that review found
missing there.

Known limitations (documented, both self-healing)

  • With the setting off, a worktree discovered during a manual refresh gets
    its pull-request status on the next refresh, not the current one.
  • The 30s repository reload still SSH-re-probes remote repos even with the
    setting off (the frequent per-worktree remote poll is gated); it reuses the
    SSH ControlMaster, so it rarely re-prompts.

Type of change

  • Feature (the linked issue is a feature request marked ready)

How was this tested?

New tests cover the reconcile backstop (remote refresh, local stays event-driven,
stagger, dead-watcher catch-up), the disable gate (automatic suppressed / manual
bypasses / queued-manual replay / post-mutation refresh), the linked-worktree
admin-dir root, settings persistence + missing-key default, and the scene-phase
and settings-change watcher wiring.

  • make check passes (format + lint)
  • make test passes
  • I built and ran the app to confirm the change works

Checklist

  • This pull request is linked to an issue with Closes # above.
  • For a feature, the linked issue is labeled ready.
  • I am the author of this work and accountable for it; no commit is authored or co-authored by an AI agent.
  • I have read the Contributing guide and the Code of Conduct.

lmjiang and others added 2 commits August 7, 2026 23:42
Event-driven refresh alone drops edges that polling used to heal, so a
dropped signal became permanent for the session. Add a rare,
foreground-only reconcile sweep that rolls through worktrees one at a
time: it re-arms each watcher (recovering a dead kqueue / file-event
stream), re-emits remote line counts and pull-request refreshes, and so
heals linked-worktree commits, external GitHub merges, and remote status
with no local event. Watch the linked-worktree admin dir so commit-driven
changes heal at event speed, coalesce overlapping diffs per worktree, and
repair watchers on a manual refresh.

Add an `automaticRepositoryRefreshEnabled` setting that stops background
status polling (remote-branch SSH poll, reconcile sweep, and automatic
pull-request checks) to avoid SSH passphrase prompts and GitHub rate
limiting; worktree discovery stays live and user-initiated refreshes
always run. The value is seeded at watcher construction so a disabled
user never eats a launch-time burst.
@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown

SupaReview

On it, AI code review will be updated here once ready.

View action run

@sbertix
sbertix merged commit bf6c35a into main Aug 8, 2026
3 of 4 checks passed
@sbertix
sbertix deleted the sbertix/gh-622-event-based-git-polling-and-ability-to-d branch August 8, 2026 00:58
@speedarius

Copy link
Copy Markdown

Thank you!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Event-based Git polling and ability to disable it Too-frequent GitHub status polling eats rate limits [Feature Request] Stop git polling

3 participants