Skip to content

fix(checks): force-refresh CI checks after push regardless of headSha propagation - #2834

Open
muddlebee wants to merge 2 commits into
stablyai:mainfrom
muddlebee:muddlebee/https-github.com-stablyai-orca-issues-2832
Open

muddlebee wants to merge 2 commits into
stablyai:mainfrom
muddlebee:muddlebee/https-github.com-stablyai-orca-issues-2832

Conversation

@muddlebee

@muddlebee muddlebee commented May 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Root cause: refreshGitHubForWorktree (called after push) re-fetches the PR. If GitHub's API returns the same headSha within the 2.5s POST_PUSH_DELAY_MS, the fetchChecks useCallback reference doesn't change → the polling effect doesn't restart → stale CI checks remain for up to 120s (exponential backoff max).
  • Fix 1 (checksCache invalidation): refreshGitHubForWorktree now sets fetchedAt: 0 on both the headSha-keyed and legacy checks cache entries for the current PR, so any subsequent fetchPRChecks call bypasses the 60s TTL regardless of whether the PR headSha has propagated.
  • Fix 2 (immediate force-refresh): Adds checksPostPushNonceByWorktree to the store. The nonce is bumped in refreshGitHubForWorktree. ChecksPanel subscribes to it and calls fetchChecks({ force: true }) + resets exponential backoff immediately when the panel is visible.

Test plan

  • Push a commit via Orca's Push button with the Checks panel open → CI checks should immediately show the new headSha's (pending) checks, not the old commit's results
  • Push a commit, close the Checks panel, then re-open it → should show fresh checks (cache was invalidated)
  • Switch worktrees → no spurious refresh (nonce reset guards against this)
  • Manual refresh button still works as before

Closes #2832

🤖 Generated with Claude Code

Risk assessment

Risk: MEDIUM

Historic risk metadata backfill based on the existing risk:medium label.

Risk: medium

Historic risk metadata backfill based on the existing risk:medium label.

ELI5

After push, CI checks could stay stale up to two minutes if GitHub still reported the old commit SHA. Checks cache is force-invalidated so fresh status loads.

… propagation

When GitHub's API hasn't propagated the new headSha within the 2.5s
post-push delay, the existing flow skipped the checks refresh (fetchChecks
callback reference unchanged → poller didn't restart → stale CI results for
up to 120s with exponential backoff). Two-pronged fix:

1. refreshGitHubForWorktree now invalidates the checksCache entries for the
   current PR (both headSha-keyed and legacy keys), so any subsequent fetch
   bypasses the 60s TTL even when headSha hasn't changed yet.

2. A checksPostPushNonceByWorktree counter is bumped on every
   refreshGitHubForWorktree call. ChecksPanel subscribes to it and immediately
   calls fetchChecks({ force: true }) + resets exponential backoff whenever
   the nonce increments while the panel is visible.

Closes stablyai#2832

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@nwparker

Copy link
Copy Markdown
Contributor

Coordinator evidence update: I took over this PR under the current non-team and newer-than-2026-05-01 scope. The fix direction is valid, but the PR needed one more race hardening pass.

Pushed follow-up commit 0caf2b667d76bd1c0e0617476ab86891356eb99b. The follow-up tracks forced checks inflight state and generations so post-push force refreshes bypass older polling requests, prevents older responses from overwriting fresh cache state, and scopes the post-push nonce to cached GitHub PRs so GitLab-only worktrees are unaffected.

Evidence:

  • pnpm vitest run --config config/vitest.config.ts src/renderer/src/store/slices/github.test.ts: passed.
  • pnpm exec oxlint src/renderer/src/store/slices/github.ts src/renderer/src/store/slices/github.test.ts src/renderer/src/components/right-sidebar/ChecksPanel.tsx: passed.
  • pnpm exec oxfmt --check src/renderer/src/store/slices/github.ts src/renderer/src/store/slices/github.test.ts src/renderer/src/components/right-sidebar/ChecksPanel.tsx: passed.
  • pnpm run typecheck:web: passed.
  • Local merge-tree against origin/main: clean.
  • Added tests prove forced refresh bypasses a non-forced stale in-flight request, concurrent forced refreshes dedupe to one API call, post-push cache invalidation works for GitHub PRs, and GitLab-only hosted-review worktrees do not receive the GitHub checks nonce.

Residual validation gap: GitHub currently reports no status checks for head 0caf2b667d76bd1c0e0617476ab86891356eb99b, so there is no upstream verify result to quote yet. No merge performed.

This branch has not been deployed

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

Labels

bug Something isn't working risk:medium Medium risk change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: auto refresh github sidebar on each commit push

2 participants