Repository navigation
perf(coderd/x/gitsync): poll merged PRs hourly - #31922
Merged
Merged
Conversation
This comment has been minimized.
This comment has been minimized.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This comment has been minimized.
This comment has been minimized.
mafredri
force-pushed
the
mafredri/gitsync-merged-pr-refresh-interval
branch
from
November 9, 2026 19:40
bd83b5a to
316c9e0
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
mafredri
force-pushed
the
mafredri/gitsync-merged-pr-refresh-interval
branch
from
November 9, 2026 22:39
316c9e0 to
9e801c6
Compare
pr-queue-manager
Bot
requested review from
DanielleMaywood
and removed request for
sreya
November 13, 2026 10:40
DanielleMaywood
approved these changes
Nov 13, 2026
DanielleMaywood
left a comment
Collaborator
There was a problem hiding this comment.
Code change is fine, test is questionable
Merged pull requests cannot reopen, so their status does not need the two-minute polling interval used for open and closed pull requests. Refresh them hourly to reduce background provider requests while still picking up metadata changes. Git activity continues to mark merged rows stale for the next worker tick.
Name the test for the state-based scheduling contract it protects and explain why its cached state differs from the provider result. Use the shared default interval for open and closed PR expectations, consistent with the worker coverage.
Exercise merged PR invalidation with a chat bound to the calling workspace so the integration test satisfies the workspace checks and reaches the refresh path.
State-based TTL checks must distinguish the stored PR state from the fetched PR state. Separate the merged PR fixture, invalidation, and metadata checks so the scheduling contract is visible without tracing the setup code.
Stored PR state can outlive a URL replacement, and branch resolution can replace the first fetched status. Cover both boundaries so later TTL changes cannot slow a newly discovered open PR to the merged TTL. Keep the SQL invalidation test clock behind database time so a small clock difference does not prevent its only tick from acquiring the row.
The branch-mismatch TTL expectations depend on the mocked PR states. State that relationship beside the table and share one test-only TTL value so its link to the private production constant is explicit.
Tests kept their own copy of the private one-hour TTL. Export it like DiffStatusTTL so tests use the constant itself.
mafredri
force-pushed
the
mafredri/gitsync-merged-pr-refresh-interval
branch
from
November 13, 2026 11:00
9e801c6 to
eb17606
Compare
DanielleMaywood
approved these changes
Nov 13, 2026
mafredri
enabled auto-merge (squash)
November 13, 2026 11:05
mafredri
temporarily deployed
to
docs-preview
November 13, 2026 11:13 — with
GitHub Actions
Inactive
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Merged PRs cannot reopen, but their diff-status rows use the same two-minute TTL as open PRs. Set the TTL to one hour after a successful diff-status refresh of a merged PR.
For a row without workspace git reports or diff-status refresh errors, this reduces the nominal scheduled rate from 30 diff-status refreshes per hour to one. Open and closed PR TTLs, error backoffs, and git-report invalidation are unchanged.
Verified with: the full gitsync package tests, race detector, and
make pre-commit.Part of CODAGT-1543.
Decision log
DiffStatusTTL. They can reopen. Select the TTL from the fetched PR state, including after resolving a different PR for the branch.Worker.MarkStale) setsstale_atto the past.GET /api/v2/chats/{chat}/diffdiscovers a new open PR on a reused branch and sets the row'sstale_atto the past; background polling still follows a stored PR URL.