Skip to content

Event-based Git polling#664

Draft
lmjiang wants to merge 1 commit into
supabitapp:mainfrom
lmjiang:event-driven-worktree-refresh
Draft

Event-based Git polling#664
lmjiang wants to merge 1 commit into
supabitapp:mainfrom
lmjiang:event-driven-worktree-refresh

Conversation

@lmjiang

@lmjiang lmjiang commented Jul 14, 2026

Copy link
Copy Markdown

Closes #622

Summary

  • Make local worktree refresh event-driven instead of periodically polling for line changes and GitHub PR state.
  • Use filesystem events for local worktree file changes and existing HEAD watching for branch changes.
  • Keep remote worktree HEAD refresh on polling because remote state is resolved over SSH.
  • Keep explicit/manual refresh support for command palette and menu-triggered refreshes.
  • Update tests for event-driven refresh behavior.
  • Leave the full disable flag out of this PR so the maintainer can choose the preferred UX/config surface for that option.

Type of change

  • Bug fix (the linked issue is a bug report)
  • Feature (the linked issue is a feature request marked ready)
  • Documentation
  • Other (please describe)

How was this tested?

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

Also validated on fork Actions:

AI tool disclosure (optional)

  • Model(s): GPT-5.5
  • Harness / tools: Codex

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 lmjiang force-pushed the event-driven-worktree-refresh branch from 3529a34 to f008f38 Compare July 14, 2026 06:22
@sbertix

sbertix commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

Thank you 🙇‍♂️ Moving this to draft and asking you to pause it for now.

The direction is right, but it underdelivers. It replaces a reliable refresh mechanism with an edge-triggered one and then leaves several edges undelivered. Under polling, any missed signal healed within 30–60 seconds. Now, a dropped edge is permanent for the session, and there is no self-healing path left. setWorktrees only reaches the watcher when the worktree list changes, and refreshAll() only emits events. It never re-runs configureWatcher, so even a manual refresh cannot repair a dead watcher.

Concretely, commits in linked worktrees go unnoticed because the gitdir sits outside the watched root. Remote worktrees never refresh their line counts. Nothing observes a merge or CI change on GitHub anymore, which also silently disables auto-archive-on-merge. And an FSEventStream that fails to start leaves that worktree dead with no log.

The plumbing is solid, but let me pick it back up as soon as possible and figure out the backstops (e.g., adding back very rare polling rather than replacing it entirely).

@sbertix sbertix marked this pull request as draft July 14, 2026 20:57
@lmjiang

lmjiang commented Jul 15, 2026

Copy link
Copy Markdown
Author

Thanks for the detailed review 🙏 That makes sense.

I underestimated the edge cases covered by the existing polling path. I’ll pause here and let you pick it back up.

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

2 participants