Skip to content

Setting to cap background GitHub PR/checks polling on headless orca serve (measured ~31% of a core) #23311

Closed

Description

@iampaycheck

Ask

Please add a setting that caps or disables background GitHub PR and checks polling on a headless orca serve runtime. For example, a settings key or a serve flag for the background budget and the per-candidate intervals, or an option to poll only while a client is showing the worktree.

Why

We run orca serve (1.4.210, Linux, under xvfb-run) on a shared 8-core build box that hosts about 14 worktrees driven by agent terminals. Desktop and mobile clients connect over the tailnet. PR polling cadence is currently hardcoded:

  • pr-refresh-pacing.ts: 20 background starts per 5 min, 10 s spacing, active bursts of 3 per 30 s.
  • pr-refresh-candidate-policy.ts: per-candidate intervals from 10 s to 30 min.
  • hosted-review-branch-cache.ts and hosted-review-refresh-pacing.ts: 60 s active tier, 15 min for branches with no PR.

We found no override in Settings, env vars, orca.yaml, or orca serve flags. #11532 fixed the rate-limit side with tiered caching, but CPU on a busy box has no operator control.

Measurement

We sampled /proc every 100 ms for 300 s, read-only, and attributed each gh process to its parent orca serve process:

Metric Value
gh processes spawned by the runtime 42 in 300 s (8.4 per minute)
Call mix gh api --hostname github.com 26, gh pr view N 14, gh pr checks N 1, gh api …/actions/jobs/N 1
Median gh lifetime / CPU per call 2.9 s / 1.9 CPU-seconds
CPU used by runtime-spawned gh about 31% of one core, sustained
orca serve main process CPU in the same window about 40% of one core
Box CPU busy (8 cores, agent workloads) 88.6%
An idle second orca serve on the same box, no clients 0 gh spawns, 0.9% of one core

At 88% busy on the box, spending a third of a core only to refresh PR badges that nobody is looking at is significant. The cost also grows with the number of clients that have these worktrees visible.

Related: #11532, #20192.

Activity

  1. AmethystLiang commented on Sep 27, 2026

    @AmethystLiang
    Contributor

    thanks for the feedback! we're looking into it.

  2. cj848 commented on Sep 30, 2026

    @cj848

    The same scheduler runs in the desktop app, so this affects desktop users too, not only orca serve. It is especially noticeable when gh points at a shared GitHub Enterprise Server: every visible worktree triggers pr view plus several api calls, and there is no way to opt out. A setting like githubBackgroundRefresh: "normal" | "active-only" | "off" (skip visible/background refreshes, keep active/manual), plus pausing background refresh while the window is unfocused, would cover both cases. Happy to send a PR if that direction works.

  3. sjh836 commented on Nov 4, 2026

    @sjh836

    Hi @AmethystLiang, thank you for building such a great IDE, and for looking into this issue.

    This also affects the desktop app. Our company's GitHub Enterprise Server is shared by every developer, and its administrators asked us to reduce automatic PR and checks polling from desktop tools, because it slows down the web UI and Actions for everyone. Orca's requests stay far below the per-user rate limit, so the rate-limit protection never kicks in; the concern is the total load from many users on one server. #25788 removed the redundant requests, but the remaining intervals are fixed.

    Besides an off or active-only mode, I would like to set the interval itself. For example, a PR refresh interval setting under Settings → Git & Source Control:

    • Default: selected worktree every 1 minute, other on-screen cards every 2 minutes (today's behavior)
    • Longer: 5 and 10 minutes
    • Longest: 10 and 20 minutes
    • Custom: enter both intervals in minutes, no shorter than the defaults

    The Checks panel could follow the same setting. Long intervals would still be practical, because Orca already refreshes PR state on push, on worktree switch, when the window becomes visible again, and on manual refresh.

  4. AmethystLiang commented on Nov 12, 2026

    @AmethystLiang
    Contributor

    @sjh836 Thank you for your kind words!

    Will try to land the change to cut down the polling

  5. AmethystLiang commented on Nov 19, 2026

    @AmethystLiang
    Contributor

    @sjh836 @cj848 thanks for the detailed reports. A fix for this shipped in v1.4.259 (#42033), and it applies to both the desktop app and orca serve:

    • Shared answers: windows and clients showing the same workspaces now share one host-side result for each PR and its checks, so N clients no longer mean N times the GitHub requests.
    • Backoff on unchanged PRs: once a PR is confirmed unchanged, it's refreshed less often (backing off to 5 minutes).
    • One budget for all timed reads: automatic reads, including the ones orca serve makes for paired clients, go through the existing background limit (at most 20 starts per 5 minutes, at least 10 s apart). Selected rows get priority.
    • Hidden rows stop: rows you can't see no longer keep a recurring timer.

    Anything you act on still refreshes immediately: selecting a workspace, pushing, a manual refresh, or returning to the window.

    We chose automatic reductions over a user-facing interval setting. If your GitHub Enterprise admins still see too much load from Orca after updating, please tell us here with rough numbers (worktrees open, requests per hour), and we'll revisit.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions