Repository navigation
feat(git-trigger): drop a queued MR/PR run superseded by a newer one - #131
Open
tatelilith wants to merge 1 commit into
Open
tatelilith wants to merge 1 commit into
tatelilith wants to merge 1 commit into
Conversation
A busy merge request fires `opened` plus one `updated` per push, and behind a concurrency of 1 they queue together. Each would review the request's head at execution time, so all but the newest are duplicates: a production deployment measured 2.4 runs per merge request, with two queued for the same request at once. The staleness preflight now also cancels a queued `opened` / `updated` run when a newer `opened` / `updated` run of the same Agent for the same request is pending, queued, running or completed. One DB query, no forge call, and it fails open into the existing merged/closed probe. `commented` runs are left out on both sides: each comment is its own question.
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.
Problem
A busy merge request fires
openedplus oneupdatedper push. Behind a concurrency of 1 they queue together, and each would review the request's head at execution time, so every run but the newest is a duplicate. On a production deployment (MR review Agent, ~45 days): 2.44 runs per merge request, with two runs queued for the same request at once.Change
The existing staleness preflight in
executeChatRun(queued git-trigger runs only) now runs one more check before the merged/closed forge probe:opened/updatedrun is cancelled if a neweropened/updatedrun of the same Agent for the same request (provider, host, project, number) ispending/queued/running/completed. The cancel reason names the newer run.(initiator_agent_id, created_at)index, capped at 200 newer rows. No forge call.failed/cancelledrun does not count, since it reviewed nothing.commentedruns neither supersede nor get superseded: each comment is its own question.Docs:
docs/agent/git-trigger-channels.mdhas a new "Superseded by a newer Run" subsection.Tests
git-trigger-run-preflight.test.ts: 10 new cases (supersede, completed newer run, failed/cancelled ignored, other request/host/provider ignored, commented on either side, self row, DB error fails open, no identity means no lookup).execute-chat-run.test.ts: the preflight receives the run identity.pnpm typecheckpasses.pnpm linthas 0 errors. API suite: 7557 passed.publish-*tests; they pass when run on their own.scripts/e2e/restart-recovery.shnot run locally.