Repository navigation
feat(forge): merge-queue provider with Trunk and a queue sweep (RIG-5183) - #2210
Merged
mattwilkinsonn merged 3 commits intoOct 12, 2026
Conversation
…183) forge.MergeQueue reads queue state per repo; Trunk implements it over getSubmittedPullRequests (50 PRs per call). Hydrate attaches the entry to PullRequest.merge_queue; a queue error never fails the hydrate. Queue moves send no GitHub webhook, so a sweep re-reads open PRs of each configured repo every 2 minutes and republishes linked issues only on change. --forge-merge-queues sets forge_repo_subscriptions.merge_queue and merge_queue_branch at boot; --forge-trunk-token-secret names the token. Co-authored-by: Matt Wilkinson <matt@rigel.build>
|
Compass engineering docs preview: https://compass-forge-rig-5183-merge.compass-eng-docs.pages.dev Deployed from Changed pages: |
Keep terminal Trunk failures failed, treat a missing queue entry as null, reject stale queue writes, stop forwarding the Trunk token across redirects and copying response bodies into errors, and stop queue config from enrolling repositories in board ingest. Co-authored-by: Matt Wilkinson <matt@rigel.build>
rigel-mintaka
added this pull request to stack #2220
October 12, 2026 01:28
Entries and clears now carry the time the provider was asked. A write older than the stored observation is dropped, so a slow sweep can neither clear a newer entry nor restore an older one. PR upserts never touch the queue entry. Co-authored-by: Matt Wilkinson <matt@rigel.build>
Contributor
Author
|
Review status at head |
rigel-mintaka
marked this pull request as ready for review
October 12, 2026 03:22
mattwilkinsonn
approved these changes
Oct 12, 2026
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Status board T15 (RIG-5183): a modular queue provider interface, with Trunk as the first provider. Its state is stored on the PR and kept current by a sweep.
forge.MergeQueue(Name,Entries) andforge.TrunkoverPOST /v1/getSubmittedPullRequests, at most 50 PRs per call. Request and response shapes follow Trunk's public OpenAPI reference, "Get several submitted pull requests from a merge queue".not_readyandpendingmap to queued.testingandtests_passedmap to testing.failedandpending_failuremap to failed.cancelledmaps to removed, andmergedto merged.isCurrentlySubmittedToQueue: falsemaps to removed.notFoundis absent.PullRequestHydrator.HydratesetsPullRequest.merge_queueafterGetPullRequest. A queue error is logged and never fails the hydrate. A repo with no configured queue makes no Trunk call.MergeQueueSweeper.Runruns on the serve errgroup. Every 2 minutes it reads the open PRs of each configured repo, writespr.mergeQueuewithjsonb_setonly when the value differs, and republishes linked issues only on a change.--forge-merge-queues/COMPASS_FORGE_MERGE_QUEUES(owner/name=trunk:branch, comma-separated) setsforge_repo_subscriptions.merge_queueandmerge_queue_branchat boot and clears repos that are not listed.--forge-trunk-token-secretnames a declared server-only secret.Deviations from the record
ingest.QueueConfigsgainsMergeQueueRepos(ctx)andMergeQueueHost(), so the sweep enumerates repos from the same stored config the hydrator reads.Store.OpenPullRequeststakes the forge host.MergeQueueSink.PublishPullRequestMergeQueuetakes anobservedAt. Queue writes are ordered by when the provider was asked (pull_requests.merge_queue_observed_at), so a slow sweep can neither clear a newer entry nor restore an older one. PR upserts never writemergeQueue.Tests
TestTrunkEntriesMapsStatesAndRequestandTestTrunkEntriesMapsCancelledSubmissionToRemovedcover the state table, including removed and absent. Mutating the removal condition fails the test.TestPullRequestHydratorMergeQueue: a queue error leaves the hydrate green, and an unconfigured repo makes no Trunk call.TestMergeQueueSweeperPublishesConfiguredEntries,TestMergeQueueSweeperClearsMissingEntries.TestSetPullRequestMergeQueueChangesOnlyOnDifferentEntryTestPublishPullRequestMergeQueueUpdatesLinkedIssueOnlyWhenChangedTestServeMergeQueueSweeperPersistsChangedEntryWithinOneTick: a running Serve with a fake Trunk persists a changed entry.TestValidateMergeQueueConfigs,TestResolveForgeMapping.Stacked on #2194 (T14).