Skip to content

feat(worktrees): periodic background git fetch --all across all repos - #154

Draft
big-guy wants to merge 2 commits into
ness-dev:mainfrom
big-guy:refresh-remotes
Draft

feat(worktrees): periodic background git fetch --all across all repos#154
big-guy wants to merge 2 commits into
ness-dev:mainfrom
big-guy:refresh-remotes

Conversation

@big-guy

@big-guy big-guy commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator

What

Adds a background task that runs git fetch --all on every known repo every 3 minutes, so worktrees stay current with their remotes without a manual fetch. Includes a Settings toggle to disable it for all repos.

How

  • FetchPoller (src/main/fetch-poller.ts) — new poller modeled on PRPoller. Fires every 3 min, fetching all repo roots in parallel. No-ops while disabled or while a prior sweep is still in flight; per-repo failures (offline/auth) are swallowed so one bad remote doesn't stop the others.
  • fetchAllRemotes(repoRoot) (src/main/worktree.ts) — thin git fetch --all --quiet primitive living with the other git helpers, with a [git-op] perf-log line.
  • Wiring (src/main/index.ts) — constructs + starts the poller at boot with one immediate sweep, plus a config:setAutoFetchEnabled IPC handler that persists the flag and fetches immediately on re-enable.
  • autoFetchEnabled setting (default on) threaded through the slice → persistence → build-initial-state → backend → types, with a toggle under Settings → Worktrees, directly beneath the "Branch from the latest remote main" options.

Testing

  • npm run typecheck
  • npx electron-vite build
  • npx vitest run ✅ (1511 tests; added a reducer test for the new event)

🤖 Generated with Claude Code

big-guy and others added 2 commits June 4, 2026 21:56
Adds a FetchPoller that runs `git fetch --all` on every known repo every
3 minutes so worktrees stay current with their remotes without a manual
fetch. The timer always runs; each tick no-ops when disabled or while a
prior sweep is still in flight. A boot sweep fires once at startup, and
re-enabling the setting fetches immediately rather than waiting for the
next tick. Per-repo failures (offline/auth) are swallowed so one bad
remote doesn't stop the others.

Adds an `autoFetchEnabled` setting (default on) with a toggle under
Settings → Worktrees to disable it for all repos.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…tions

Places the "Auto-fetch remotes" toggle directly beneath the "Branch from
the latest remote main" radio group (both are remote-related, global-only
settings) instead of next to the Claude-permissions sharing toggle.

Also drops a redundant enabled-check in the setAutoFetchEnabled IPC
handler — fetchAll() already no-ops while disabled.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@big-guy big-guy self-assigned this Jun 5, 2026
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.

1 participant