Repository navigation
Reduce idle git status polling - #7069
Conversation
|
Ready to review this PR? Stage has broken it down into 3 individual chapters for you:
Chapters generated by Stage for commit 7661715 on Jul 2, 2026 5:01am UTC. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThis change refactors git status polling logic to distinguish between interactive UI consumers and background terminal-only usage. A new shared function, Changes
Sequence Diagram(s)sequenceDiagram
participant Hook as useGitStatusPolling
participant Predicate as hasInteractiveActiveGitStatusConsumer
participant Runner as runFetchStatus
participant Interval as setInterval
Hook->>Predicate: evaluate(rightSidebarOpen, openFiles, userAgent)
Predicate-->>Hook: interactive boolean
Hook->>Hook: compute shouldPollActiveWorktreeGitStatus
Hook->>Hook: select activeStatusPollIntervalMs (3s or 30s)
Hook->>Runner: guard on shouldPollActiveWorktreeGitStatus
Runner-->>Hook: gitStatus fetched or skipped
Hook->>Interval: install with activeStatusPollIntervalMs (if activeStatusPollScope)
Related PRs: None specified. Suggested labels: refactor, polling, renderer Suggested reviewers: None specified. Poem: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ELI5
Orca was asking Git for status every 3 seconds even in cases where the user was only sitting in a terminal and no UI surface was actively showing git status. This changes Orca to keep the fast 3-second refresh when Source Control, Explorer, Checks, or open files need it, but slow down the terminal-only fallback to 30 seconds. If the active worktree cannot be polled anyway, such as disconnected SSH or huge-status pause, Orca now avoids installing the timer at all.
Why
While investigating high Energy Impact, live process snapshots and diagnostics showed repeated git/status-related subprocess churn alongside renderer/GPU terminal cost. This PR removes a low-value fixed polling loop without changing the fast path for visible git UI.
What changed
Tradeoffs and user degradation
Expected degradation is effectively zero for normal visible status workflows.
Verification
pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/right-sidebar/useGitStatusPolling.test.ts src/renderer/src/components/right-sidebar/useGitStatusPolling.rerender.test.ts src/renderer/src/lib/passive-macos-app-data-access.test.tspnpm run typecheck:webpnpm exec oxlint src/renderer/src/components/right-sidebar/useGitStatusPolling.ts src/renderer/src/components/right-sidebar/useGitStatusPolling.test.ts src/renderer/src/lib/passive-macos-app-data-access.tsgit diff --check