Skip to content

Backoff on refresh when no changes found#8811

Open
alexr00 wants to merge 2 commits into
mainfrom
alexr00/crowded-otter
Open

Backoff on refresh when no changes found#8811
alexr00 wants to merge 2 commits into
mainfrom
alexr00/crowded-otter

Conversation

@alexr00

@alexr00 alexr00 commented Jun 25, 2026

Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings June 25, 2026 13:56
@alexr00 alexr00 enabled auto-merge (squash) June 25, 2026 13:56
@alexr00 alexr00 self-assigned this Jun 25, 2026

Copilot AI 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.

Pull request overview

This PR updates ReviewManager’s periodic polling to use an exponential backoff when refreshes don’t detect state changes, reducing unnecessary work over time while still resetting to a minimum interval when changes are observed.

Changes:

  • Introduces a backoff-based polling interval (min/max + multiplier) and applies it across poll cycles.
  • Updates polling to detect “change” based on PR number / head SHA and avoids false positives by preserving the previous commit SHA in a no-op validate path.
  • Adds a new test suite covering backoff behavior, focus-triggered refresh behavior, and max-interval capping.
Show a summary per file
File Description
src/view/reviewManager.ts Implements polling backoff logic, adjusts focus-triggered polling behavior, and refines “no meaningful change” handling to stabilize change detection.
src/test/view/reviewManager.test.ts Adds unit tests validating backoff growth/reset, focus-triggered polling behavior, and maximum interval cap.

Copilot's findings

  • Files reviewed: 2/2 changed files
  • Comments generated: 3

Comment thread src/view/reviewManager.ts Outdated
Comment thread src/test/view/reviewManager.test.ts
Comment thread src/view/reviewManager.ts
dbaeumer
dbaeumer previously approved these changes Jun 25, 2026
@alexr00 alexr00 marked this pull request as draft June 26, 2026 12:58
auto-merge was automatically disabled June 26, 2026 12:58

Pull request was converted to draft

@alexr00 alexr00 marked this pull request as ready for review June 26, 2026 14:21
Copilot AI review requested due to automatic review settings June 26, 2026 14:21

Copilot AI 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.

Review details

  • Files reviewed: 2/2 changed files
  • Comments generated: 3
  • Review effort level: Low

Comment thread src/view/reviewManager.ts
if (!this._validateStatusInProgress) {
const shouldRefreshForActivePr = !!this._folderRepoManager.activePullRequest && await this.hasNewPullRequests();
if (shouldRefreshForActivePr) {
Logger.appendLine('Polling detected potential new PR activity while a PR is active. Refreshing state.', this.id);
assert.ok(setTimeoutSpy.callCount > callsBeforeSkip, 'focus should cause one-off refresh and schedule next poll');
});

it('polling refreshes state when active PR exists and new PR activity is detected', async function () {

clock.tick(POLL_MIN_INTERVAL_MS * 4);
await flushMicrotasks();
assert.strictEqual(latestScheduledDelay(), POLL_MIN_INTERVAL_MS * 6);
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.

4 participants