Commit 37e78f2
Serialise translation reviews to stop duplicate report comments (#134)
Ports the fix from QuantEcon/lecture-python-programming.fr#7. This repo
has the identical trigger list and no concurrency guard, and the bug is
already reproducing here: PR #133 carries two "Translation Quality
Review" comments, scoring 9.2/10 and 8.8/10, both posted at 23:51:37.
A single translation sync fires `opened` plus one `labeled` event per
label applied, all within a couple of seconds. Each starts its own run of
this workflow, and the review action's "update existing comment, else
create" logic is a check-then-act with no lock: concurrent runs all see
"no comment yet" and each create one. On PR #133 three runs fired; two
logged `Posted review comment` and one logged `Updated existing review
comment`, leaving two independent reports of the same diff and three full
model calls where one was intended.
Add a per-PR concurrency group so runs queue instead of racing — the
first creates the comment, any later run updates it. cancel-in-progress
is left false on purpose: the labels are applied in one API call so event
order is not guaranteed, and cancelling would let a `labeled` event for
'automated' kill the in-flight review and then skip its own job, leaving
no review at all.
Also ignore `labeled` events for labels other than 'action-translation',
which removes the redundant review triggered by the 'automated' label.
The underlying unsynchronised upsert is tracked in
QuantEcon/action-translation#96.
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 77708bd commit 37e78f2
1 file changed
Lines changed: 26 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
10 | 29 | | |
11 | 30 | | |
12 | | - | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
13 | 38 | | |
14 | 39 | | |
15 | 40 | | |
| |||
0 commit comments