Skip to content

Reduce push target upstream polling churn#6413

Open
brennanb2025 wants to merge 2 commits into
mainfrom
brennanb2025/burden-push-target-poll
Open

Reduce push target upstream polling churn#6413
brennanb2025 wants to merge 2 commits into
mainfrom
brennanb2025/burden-push-target-poll

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Summary

  • cache automatic publish-target upstream comparisons for unchanged worktree identity, HEAD/branch, push target, connection, and runtime target
  • leave cached poll hits as no-ops so fresher post-push/fetch upstream status is not overwritten by an older poll result
  • keep strict/user-triggered refreshes uncached and clear automatic cache state before strict reconciliation

Repro / Root Cause

Local WER/trace evidence showed AppHangB1-era git churn in vendace: about 15 status, 15 symbolic-ref, 15 check-ref-format, 15 rev-list, and 30 rev-parse spans per minute from 22:05-22:08. The renderer path matched that: automatic refreshGitStatusForWorktree always called fetchUpstreamStatus when pushTarget existed, causing publish-target validation/comparison on every ~3s status poll.

Expected subprocess impact

For a PR-linked worktree with unchanged HEAD/branch and unchanged push target, automatic polling should now perform the publish-target upstream comparison once per 60s cache window instead of every 3s poll. That changes the expected publish-target comparison work from roughly 20 comparisons/minute to about 1 comparison/minute; the regular cheap git status poll still runs as before.

Tests

  • pnpm exec vitest run --config config/vitest.config.ts src\\renderer\\src\\components\\right-sidebar\\push-target-upstream-refresh-cache.test.ts src\\renderer\\src\\components\\right-sidebar\\git-status-refresh.test.ts
  • pnpm exec oxlint src\\renderer\\src\\components\\right-sidebar\\git-status-refresh.ts src\\renderer\\src\\components\\right-sidebar\\push-target-upstream-refresh-cache.ts src\\renderer\\src\\components\\right-sidebar\\push-target-upstream-refresh-cache.test.ts
  • pnpm run typecheck:web

Notes

  • Initial pnpm install --frozen-lockfile completed, but cpu-features optional native build reported missing Visual Studio C++ tooling before postinstall skipped optional Electron rebuild modules.

Brennan Test Changes Validation

  • Focused Vitest: pnpm exec vitest run --config config/vitest.config.ts src\renderer\src\components\right-sidebar\push-target-upstream-refresh-cache.test.ts src\renderer\src\components\right-sidebar\git-status-refresh.test.ts (15 tests passed).
  • Touched-file lint: pnpm exec oxlint src\renderer\src\components\right-sidebar\git-status-refresh.ts src\renderer\src\components\right-sidebar\push-target-upstream-refresh-cache.ts src\renderer\src\components\right-sidebar\push-target-upstream-refresh-cache.test.ts.
  • Typecheck: pnpm run typecheck and pnpm run typecheck:web passed.
  • git diff --check passed.
  • Electron validation launched from this PR worktree and verified identity: devBranch=brennanb2025/burden-push-target-poll, devRepoRoot=C:\Users\neil\orca\workspaces\orca\burden-push-target-poll.
  • Live local git validation used a disposable non-Orca demo-project repo with a local bare origin and explicit pushTarget. Three automatic refreshGitStatusForWorktree calls with unchanged HEAD/branch wrote git status three times but wrote upstream status once; a following strict refresh bypassed the automatic cache and wrote upstream status again.
  • Cleanup: disposable repo removed from the dev app, temp files deleted, PR worktree clean.
  • Full pnpm run lint: blocked by unrelated existing localization catalog drift in src/renderer/src/components/settings/AgentRuntimeSetting.tsx and src/renderer/src/components/settings/agents-search.ts; touched files pass oxlint.

No SSH/remoting live pass was run because this PR changes renderer-side scheduling/caching before provider dispatch, not SSH transport behavior. The cache key includes connectionId and runtime target to keep remote/local surfaces separated.

@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds an in-memory cache for automatic push-target upstream status, keyed by worktree, connection, runtime environment, push target, and git status identity. The automatic git status refresh path now checks and populates the cache, and strict refresh clears it before reconciling. A new Vitest suite covers cache reuse, invalidation on HEAD and push target changes, TTL expiry, separation by connection and runtime environment, and strict refresh behavior.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: reducing push-target upstream polling churn.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The description is detailed and covers summary, root cause, impact, tests, and notes, but it omits the template's screenshots, AI review, and security audit sections.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
src/renderer/src/components/right-sidebar/push-target-upstream-refresh-cache.ts (1)

36-63: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Document why the cache key only uses HEAD/branch identity.

This key shape is the core contract of the cache, but the reason for using only head/branch here is not obvious from the code. A short Why comment would help prevent future changes from accidentally widening the key to full status data or narrowing it in a way that breaks cache reuse/invalidation behavior. As per coding guidelines, **/*.{ts,tsx,js,jsx}: When writing or modifying code driven by a design doc or non-obvious constraint, add a comment explaining why the code behaves the way it does.

Source: Coding guidelines

src/renderer/src/components/right-sidebar/push-target-upstream-refresh-cache.test.ts (1)

159-187: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Exercise runtime-target separation through refreshGitStatusForWorktree.

This test only proves the helper key includes activeRuntimeEnvironmentId. It would still pass if the changed wiring in git-status-refresh.ts stopped forwarding settings into getCachedAutomaticPushTargetUpstreamStatus or storeCachedAutomaticPushTargetUpstreamStatus. Mirroring the connection-id test through refreshAutomatically() would cover the full integration contract. Based on the PR objective and changed-line summary, runtime-environment separation is part of the cache wiring behavior this PR is meant to guarantee.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: c059399a-f6e8-41ba-ae2d-ed44fe3ebd62

📥 Commits

Reviewing files that changed from the base of the PR and between 74a012c and f327c23.

📒 Files selected for processing (3)
  • src/renderer/src/components/right-sidebar/git-status-refresh.ts
  • src/renderer/src/components/right-sidebar/push-target-upstream-refresh-cache.test.ts
  • src/renderer/src/components/right-sidebar/push-target-upstream-refresh-cache.ts

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.

2 participants