Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

Revert "MUL-8526: feat(wakeup): add PR review wakeup trigger (--until-pr revi…" (#9862)

LinYushene06640a565ec
diff --git a/apps/docs/content/docs/github-integration.fr.mdx b/apps/docs/content/docs/github-integration.fr.mdx
index 8fa016ee82..f623fd8e26 100644
--- a/apps/docs/content/docs/github-integration.fr.mdx
+++ b/apps/docs/content/docs/github-integration.fr.mdx
@@ -156,7 +156,6 @@ Permissions de dépôt (Repository permissions) :
Abonnez-vous à ces événements :
- **Pull request** ;
-- **Pull request review**, pour les réveils liés aux revues ;
- **Check suite**, **Check run** et **Status**, qui déclenchent l'actualisation de la CI et de la possibilité de fusion.
Les instantanés de PR utilisent les API REST Pull requests, Checks et Commit statuses. La permission Contents n'est pas nécessaire.
diff --git a/apps/docs/content/docs/github-integration.ja.mdx b/apps/docs/content/docs/github-integration.ja.mdx
index 00e55b15d5..7ef0f87b31 100644
--- a/apps/docs/content/docs/github-integration.ja.mdx
+++ b/apps/docs/content/docs/github-integration.ja.mdx
@@ -154,7 +154,6 @@ Repository permissions:
次のイベントを購読します。
- **Pull request**
-- **Pull request review**。レビューによる起動に使用します。
- **Check suite**、**Check run**、**Status**。CI とマージ可能性を更新するために使用します。
PR スナップショットは Pull requests、Checks、Commit statuses の REST API から取得します。Contents 権限は不要です。
diff --git a/apps/docs/content/docs/github-integration.ko.mdx b/apps/docs/content/docs/github-integration.ko.mdx
index ebd60c9360..6fcd668e00 100644
--- a/apps/docs/content/docs/github-integration.ko.mdx
+++ b/apps/docs/content/docs/github-integration.ko.mdx
@@ -154,7 +154,6 @@ Repository permissions:
다음 이벤트를 구독합니다.
- **Pull request**
-- 리뷰에 따른 깨우기에 사용할 **Pull request review**
- CI와 merge 가능 여부 새로 고침을 트리거할 **Check suite**, **Check run**, **Status**
PR snapshot은 Pull requests, Checks 및 Commit statuses REST API로 가져옵니다. Contents 권한은 필요하지 않습니다.
diff --git a/apps/docs/content/docs/github-integration.mdx b/apps/docs/content/docs/github-integration.mdx
index 1613667881..27672e8e50 100644
--- a/apps/docs/content/docs/github-integration.mdx
+++ b/apps/docs/content/docs/github-integration.mdx
@@ -156,7 +156,6 @@ Repository permissions:
Subscribe to these events:
- **Pull request**;
-- **Pull request review**, for review wakeups;
- **Check suite**, **Check run**, and **Status**, which trigger CI and mergeability refreshes.
PR snapshots use the Pull requests, Checks, and Commit statuses REST APIs. Contents access is not required.
diff --git a/apps/docs/content/docs/github-integration.zh.mdx b/apps/docs/content/docs/github-integration.zh.mdx
index f4f9ada30c..1918d3c841 100644
--- a/apps/docs/content/docs/github-integration.zh.mdx
+++ b/apps/docs/content/docs/github-integration.zh.mdx
@@ -156,7 +156,6 @@ Repository permissions:
订阅以下事件:
- **Pull request**;
-- **Pull request review**,用于评审唤醒;
- **Check suite**、**Check run** 和 **Status**,用于触发 CI 与可合并性刷新。
PR 快照通过 Pull requests、Checks 和 Commit statuses 的 REST API 获取,不需要 Contents 权限。
diff --git a/apps/docs/content/docs/issue-wakeups.fr.mdx b/apps/docs/content/docs/issue-wakeups.fr.mdx
index 1b37cfe3ee..1c8fbd4fd4 100644
--- a/apps/docs/content/docs/issue-wakeups.fr.mdx
+++ b/apps/docs/content/docs/issue-wakeups.fr.mdx
@@ -56,11 +56,11 @@ Dans la tâche ci-dessous, Assistant ops a demandé des devis et attend les rép
| Collaboration | Un champ prend une valeur | Le statut, l'assigné, une étiquette ou une propriété personnalisée de la tâche prend la valeur choisie. |
| Exécutions et sous-tâches | L’exécution d’un agent se termine | Une exécution d'un agent donné (ou de n'importe quel agent) sur cette tâche réussit, échoue ou est annulée. |
| Exécutions et sous-tâches | Les sous-tâches se terminent | Toutes les sous-tâches sont closes (`done` ou `cancelled`), ou toutes celles jusqu'à l'étape choisie. Sans sous-tâche, la règle ne se déclenche jamais. |
-| Liés | La CI d’une PR liée se termine | Ou la PR est fusionnée, a des conflits de fusion ou reçoit une approbation ou une demande de modifications humaine. Seules les PR liées directement à cette tâche comptent ; s'il y en a plusieurs, une seule suffit. Conflits et revues ne fonctionnent qu'avec les pull requests GitHub. |
+| Liés | La CI d’une PR liée se termine | Ou la PR est fusionnée, ou elle a des conflits de fusion. Seules les PR liées directement à cette tâche comptent ; s'il y en a plusieurs, une seule suffit. CI et conflits ne fonctionnent qu'avec les pull requests GitHub. |
| Liés | Le statut d’une autre tâche | Une autre tâche est terminée, terminée ou annulée, ou passe en revue. |
| | Événements personnalisés | Choisissez parmi 25 événements bruts : réactions, pièces jointes, commentaires modifiés, fils résolus… |
-Multica vérifie lui-même les conditions sur un champ, les sous-tâches, les PR et les autres tâches. Si la condition est déjà remplie à la création, la vérification suivante (dans les 30 secondes environ) réveille l'agent. La CI et les revues attendent de nouveaux résultats après l’inscription. Les revues des bots, de l’auteur de la PR, les simples commentaires et les décisions révoquées sont exclus. La réactivation ignore les revues antérieures ; pousser un commit ne rejoue pas une revue. Une approbation ne signifie pas que toutes les approbations requises pour fusionner sont réunies.
+Multica vérifie lui-même les conditions sur un champ, les sous-tâches, les PR et les autres tâches. Si la condition est déjà remplie à la création, la vérification suivante (dans les 30 secondes environ) réveille l'agent. La CI fait exception : seules les vérifications terminées après la création de la règle comptent.
Toutes les conditions autres que le temps attendent un événement et ont trois réglages de plus :
@@ -140,7 +140,7 @@ multica issue wakeup create OPS-56 --until-status in_review --instruction "Véri
- **Temps** : `--kind at` avec `--after 10m` ou `--at <heure RFC3339>` ; `--kind every --every 1h` pour un intervalle fixe d'au moins 1 minute ; `--kind cron --cron "<expression à 5 champs>"` avec `--timezone` (UTC par défaut).
- **Événements** : indiquez les noms d'événements après `--event`, séparés par des virgules. `multica issue wakeup events` liste tous les événements et filtres. `--mode continuous` rend la règle répétée.
-- **Conditions** : `--until-status`, `--until-assignee`, `--until-label`, `--until-property`, `--until-children-done [--stage N]`, `--until-pr checks|merged|conflicts|reviewed|approved|changes_requested` et `--until-issue <tâche> --until-issue-state done|ended|in_review|blocked`. Un seul `--until-*` par réveil, et jamais avec `--event`.
+- **Conditions** : `--until-status`, `--until-assignee`, `--until-label`, `--until-property`, `--until-children-done [--stage N]`, `--until-pr checks|merged|conflicts` et `--until-issue <tâche> --until-issue-state done|ended|in_review|blocked`. Un seul `--until-*` par réveil, et jamais avec `--event`.
- **Fin** : le CLI n'ajoute pas d'échéance à votre place. Utilisez `--expires-in 72h` ou `--expires-at <heure RFC3339>` ; `--on-timeout wake` fait qu'une règle d'événement réveille l'agent une dernière fois à l'échéance. `--max-fires N` (1–1000) limite le nombre d'exécutions d'une règle répétée.
- **Où va la réponse** : `--parent <id-de-commentaire>` garde la réponse de l'exécution réveillée dans le fil d'origine.
diff --git a/apps/docs/content/docs/issue-wakeups.ja.mdx b/apps/docs/content/docs/issue-wakeups.ja.mdx
index 6fbf3c68fb..31c39e9d95 100644
--- a/apps/docs/content/docs/issue-wakeups.ja.mdx
+++ b/apps/docs/content/docs/issue-wakeups.ja.mdx
@@ -56,11 +56,11 @@ import { WakeupDemo } from "@/components/demos/wakeup-demo";
| コラボレーション | フィールドが特定の値になる | タスクのステータス、担当者、ラベル、カスタムプロパティが指定した値になったとき。 |
| 実行とサブタスク | エージェントの実行が終了 | このタスクで特定の(または任意の)エージェントの実行が成功、失敗、キャンセルになったとき。 |
| 実行とサブタスク | サブタスクが終わる | すべてのサブタスクが閉じた(`done` または `cancelled`)とき、または指定したステージまでがすべて閉じたとき。サブタスクがなければ起動しません。 |
-| 関連 | 関連 PR の CI が終わる | PR のマージ、マージコンフリクト、人間による承認や変更リクエストも選べます。このタスクに直接関連付けた PR だけが対象で、複数あればどれか 1 つで条件を満たします。コンフリクトとレビューは GitHub の PR だけに対応しています。 |
+| 関連 | 関連 PR の CI が終わる | PR のマージやマージコンフリクトも選べます。このタスクに直接関連付けた PR だけが対象で、複数あればどれか 1 つで条件を満たします。CI とコンフリクトは GitHub の PR だけに対応しています。 |
| 関連 | 別のタスクのステータス | 別のタスクが完了、完了またはキャンセル、レビュー中になったとき。 |
| | カスタムイベント | リアクション、添付ファイル、コメントの編集、スレッドの解決など、25 種類のイベントから選びます。 |
-フィールド、サブタスク、PR、別のタスクの条件は Multica 自身が確認します。作成した時点で条件がすでに成り立っていれば、次の確認(約 30 秒以内)で起動します。CI とレビューは登録後の新しい結果を待ちます。bot、PR 作者本人、コメントのみのレビュー、取り消された判断は対象外です。再有効化では過去のレビューを無視し、新しいコミットを push しても同じレビューで再起動しません。承認の受領は、マージに必要なすべての承認が揃ったことを意味しません。
+フィールド、サブタスク、PR、別のタスクの条件は Multica 自身が確認します。作成した時点で条件がすでに成り立っていれば、次の確認(約 30 秒以内)で起動します。CI だけは例外で、作成後に終わったチェックしか数えません。
時間以外の条件は「何かが起きるのを待つ」ルールで、設定がさらに 3 つあります。
@@ -140,7 +140,7 @@ multica issue wakeup create OPS-56 --until-status in_review --instruction "成
- **時間**:`--kind at` に `--after 10m` または `--at <RFC3339 の時刻>`。`--kind every --every 1h` で一定間隔(最短 1 分)。`--kind cron --cron "<5 フィールドの式>"` には `--timezone` を付けます(既定は UTC)。
- **イベント**:`--event` のあとにイベント名をカンマ区切りで書きます。`multica issue wakeup events` ですべてのイベントとフィルターを一覧できます。`--mode continuous` で繰り返し起動になります。
-- **条件**:`--until-status`、`--until-assignee`、`--until-label`、`--until-property`、`--until-children-done [--stage N]`、`--until-pr checks|merged|conflicts|reviewed|approved|changes_requested`、`--until-issue <タスク> --until-issue-state done|ended|in_review|blocked`。1 つのウェイクアップに使える `--until-*` は 1 つだけで、`--event` とは併用できません。
+- **条件**:`--until-status`、`--until-assignee`、`--until-label`、`--until-property`、`--until-children-done [--stage N]`、`--until-pr checks|merged|conflicts`、`--until-issue <タスク> --until-issue-state done|ended|in_review|blocked`。1 つのウェイクアップに使える `--until-*` は 1 つだけで、`--event` とは併用できません。
- **終わり方**:CLI は待つ期限を自動では付けません。`--expires-in 72h` か `--expires-at <RFC3339 の時刻>` で終わりを決めます。`--on-timeout wake` を付けると、イベントのルールは期限が来たときにもう一度起こします。`--max-fires N`(1〜1000)で繰り返すルールの実行回数に上限を付けます。
- **返信先**:`--parent <コメント ID>` を付けると、起動後の返信が元のスレッドに入ります。
diff --git a/apps/docs/content/docs/issue-wakeups.ko.mdx b/apps/docs/content/docs/issue-wakeups.ko.mdx
index c02c7ea80f..e46ff37c1a 100644
--- a/apps/docs/content/docs/issue-wakeups.ko.mdx
+++ b/apps/docs/content/docs/issue-wakeups.ko.mdx
@@ -56,11 +56,11 @@ import { WakeupDemo } from "@/components/demos/wakeup-demo";
| 협업 | 필드가 특정 값으로 바뀜 | 태스크의 상태, 담당자, 라벨, 사용자 지정 속성이 정한 값이 되었을 때. |
| 실행과 하위 태스크 | 에이전트 실행 종료 | 이 태스크에서 특정 에이전트(또는 아무 에이전트)의 실행이 성공, 실패, 취소되었을 때. |
| 실행과 하위 태스크 | 하위 태스크 완료 | 모든 하위 태스크가 닫혔을 때(`done` 또는 `cancelled`), 또는 정한 단계까지가 모두 닫혔을 때. 하위 태스크가 없으면 트리거되지 않습니다. |
-| 연결 | 연결된 PR의 CI 종료 | PR 병합, 병합 충돌, 사람이 제출한 승인이나 변경 요청도 고를 수 있습니다. 이 태스크에 직접 연결된 PR만 보며, 여러 개라면 하나만 맞아도 됩니다. 충돌과 리뷰는 GitHub PR에서만 동작합니다. |
+| 연결 | 연결된 PR의 CI 종료 | PR 병합이나 병합 충돌도 고를 수 있습니다. 이 태스크에 직접 연결된 PR만 보며, 여러 개라면 하나만 맞아도 됩니다. CI와 충돌은 GitHub PR에서만 동작합니다. |
| 연결 | 다른 태스크의 상태 | 다른 태스크가 완료, 완료 또는 취소, 검토 중이 되었을 때. |
| | 사용자 지정 이벤트 | 반응, 첨부 파일, 댓글 수정, 스레드 해결 등 25가지 원본 이벤트 중에서 고릅니다. |
-필드, 하위 태스크, PR, 다른 태스크 조건은 Multica가 직접 확인합니다. 만들 때 이미 조건이 맞는다면 다음 확인(약 30초 이내)에서 깨웁니다. CI와 리뷰는 등록 이후의 새 결과를 기다립니다. 봇, PR 작성자 본인, 댓글만 있는 리뷰와 취소된 결정은 제외합니다. 다시 켜면 이전 리뷰를 무시하며, 새 커밋을 push해도 같은 리뷰로 다시 깨우지 않습니다. 승인 하나를 받았다고 병합에 필요한 모든 승인이 충족된 것은 아닙니다.
+필드, 하위 태스크, PR, 다른 태스크 조건은 Multica가 직접 확인합니다. 만들 때 이미 조건이 맞는다면 다음 확인(약 30초 이내)에서 깨웁니다. CI만 예외로, 규칙을 만든 뒤에 끝난 검사만 셉니다.
시간 외의 조건은 "어떤 일이 생기기를 기다리는" 규칙이며, 설정이 세 가지 더 있습니다.
@@ -140,7 +140,7 @@ multica issue wakeup create OPS-56 --until-status in_review --instruction "결
- **시간**: `--kind at`에 `--after 10m` 또는 `--at <RFC3339 시간>`. `--kind every --every 1h`는 고정 간격(최소 1분). `--kind cron --cron "<5개 필드 표현식>"`에는 `--timezone`을 붙입니다(기본 UTC).
- **이벤트**: `--event` 뒤에 이벤트 이름을 쉼표로 구분해 씁니다. `multica issue wakeup events`가 모든 이벤트와 필터를 보여 줍니다. `--mode continuous`는 반복 깨우기로 만듭니다.
-- **조건**: `--until-status`, `--until-assignee`, `--until-label`, `--until-property`, `--until-children-done [--stage N]`, `--until-pr checks|merged|conflicts|reviewed|approved|changes_requested`, `--until-issue <태스크> --until-issue-state done|ended|in_review|blocked`. 깨우기 하나에 `--until-*`는 하나만 쓸 수 있고 `--event`와 함께 쓸 수 없습니다.
+- **조건**: `--until-status`, `--until-assignee`, `--until-label`, `--until-property`, `--until-children-done [--stage N]`, `--until-pr checks|merged|conflicts`, `--until-issue <태스크> --until-issue-state done|ended|in_review|blocked`. 깨우기 하나에 `--until-*`는 하나만 쓸 수 있고 `--event`와 함께 쓸 수 없습니다.
- **끝내는 방법**: CLI는 대기 기한을 자동으로 붙이지 않습니다. `--expires-in 72h`나 `--expires-at <RFC3339 시간>`으로 끝을 정하세요. `--on-timeout wake`를 붙이면 이벤트 규칙이 기한이 되었을 때 한 번 더 깨웁니다. `--max-fires N`(1–1000)은 반복 규칙의 실행 횟수에 상한을 둡니다.
- **답이 남는 곳**: `--parent <댓글 ID>`를 붙이면 깨운 뒤의 답글이 원래 스레드에 남습니다.
diff --git a/apps/docs/content/docs/issue-wakeups.mdx b/apps/docs/content/docs/issue-wakeups.mdx
index 4cac2fca8a..ec79ceeddb 100644
--- a/apps/docs/content/docs/issue-wakeups.mdx
+++ b/apps/docs/content/docs/issue-wakeups.mdx
@@ -56,11 +56,11 @@ In the issue below, Ops helper has asked suppliers for quotes and is waiting for
| Collaboration | A field changes to a value | The issue's status, assignee, label, or a custom property takes the value you chose. |
| Runs and sub-issues | An agent's run ends | A run on this issue by a given agent (or any agent) succeeds, fails, or is cancelled. |
| Runs and sub-issues | Sub-issues finish | Every sub-issue is closed (`done` or `cancelled`), or every stage up to the one you pick is. An issue without sub-issues never fires. |
-| Linked | A linked PR's CI finishes | Or the PR merges, has merge conflicts, or receives a human approval or request for changes. Only PRs linked directly to this issue count; with several, any one is enough. Conflicts and reviews work only for GitHub pull requests. |
+| Linked | A linked PR's CI finishes | Or the PR merges, or it has merge conflicts. Only PRs linked directly to this issue count; with several, any one is enough. CI and conflicts work only for GitHub pull requests. |
| Linked | Another issue's status | Another issue is done, done or cancelled, or moves to In Review. |
| | Custom events | Pick from the 25 raw events, such as reactions, attachments, edited comments, or resolved threads. |
-Multica checks field, sub-issue, PR, and other-issue conditions itself. If the condition already holds when you create the rule, the next check (within about 30 seconds) wakes the agent. CI and reviews wait for new results after registration. Review conditions ignore bots, the PR author, comment-only reviews, and dismissed decisions. Re-enabling ignores earlier reviews; pushing a commit does not replay a review. An approval submission does not mean all required merge approvals are satisfied.
+Multica checks field, sub-issue, PR, and other-issue conditions itself. If the condition already holds when you create the rule, the next check (within about 30 seconds) wakes the agent. CI is the exception: it only counts checks that finish after the rule was created.
Every condition other than time waits for something to happen, and has three more settings:
@@ -140,7 +140,7 @@ multica issue wakeup create OPS-56 --until-status in_review --instruction "Check
- **Time**: `--kind at` with `--after 10m` or `--at <RFC3339 time>`; `--kind every --every 1h` for a fixed interval of at least 1 minute; `--kind cron --cron "<5-field expression>"` with `--timezone` (UTC by default).
- **Events**: list event names after `--event`, separated by commas. `multica issue wakeup events` lists every event and filter. `--mode continuous` makes the rule repeat.
-- **Conditions**: `--until-status`, `--until-assignee`, `--until-label`, `--until-property`, `--until-children-done [--stage N]`, `--until-pr checks|merged|conflicts|reviewed|approved|changes_requested`, and `--until-issue <issue> --until-issue-state done|ended|in_review|blocked`. Use one `--until-*` per wakeup, and not together with `--event`.
+- **Conditions**: `--until-status`, `--until-assignee`, `--until-label`, `--until-property`, `--until-children-done [--stage N]`, `--until-pr checks|merged|conflicts`, and `--until-issue <issue> --until-issue-state done|ended|in_review|blocked`. Use one `--until-*` per wakeup, and not together with `--event`.
- **Endings**: the CLI does not add a deadline for you. Use `--expires-in 72h` or `--expires-at <RFC3339 time>`; `--on-timeout wake` makes an event rule wake the agent once more at the deadline. `--max-fires N` (1–1000) caps how many runs a repeating rule starts.
- **Where results go**: `--parent <comment-id>` keeps the woken run's reply in the original thread.
diff --git a/apps/docs/content/docs/issue-wakeups.zh.mdx b/apps/docs/content/docs/issue-wakeups.zh.mdx
index 10ce5fbc59..b0664a8bd5 100644
--- a/apps/docs/content/docs/issue-wakeups.zh.mdx
+++ b/apps/docs/content/docs/issue-wakeups.zh.mdx
@@ -56,11 +56,11 @@ import { WakeupDemo } from "@/components/demos/wakeup-demo";
| 协作 | 字段变为某个值 | 任务的状态、负责人、标签或自定义属性变成指定的值。 |
| 运行与子任务 | 智能体的运行结束 | 这条任务上某个智能体(或任意智能体)的运行成功、失败或被取消。 |
| 运行与子任务 | 子任务完成 | 全部子任务结束(`done` 或 `cancelled`),或某个阶段及之前的阶段全部结束。没有子任务时不会触发。 |
-| 关联 | 关联 PR 的 CI 结束 | 也可以选 PR 合并、出现合并冲突、收到人工批准或修改请求。只看直接关联到这条任务的 PR,有多个时任意一个满足即可。合并冲突和评审只支持 GitHub 上的 PR。 |
+| 关联 | 关联 PR 的 CI 结束 | 也可以选 PR 合并、出现合并冲突。只看直接关联到这条任务的 PR,有多个时任意一个满足即可。CI 结束和合并冲突只支持 GitHub 上的 PR。 |
| 关联 | 其他任务的状态变化 | 另一条任务完成、完成或取消,或进入审核中。 |
| | 自定义事件 | 从 25 种原始事件里勾选,例如表态、附件、评论被编辑或讨论被解决。 |
-字段、子任务、PR 和其他任务这几类条件由平台自己去查:条件在创建时已经成立的,下一次检查(约 30 秒内)就会唤醒。CI 和评审只认创建后的新结果。评审不计机器人、PR 作者本人、仅评论的评审和已撤销的决定;重新启用后忽略之前的评审,推送新提交不会重复触发。收到批准不代表已满足合并所需的全部审批。
+字段、子任务、PR 和其他任务这几类条件由平台自己去查:条件在创建时已经成立的,下一次检查(约 30 秒内)就会唤醒;"CI 结束"例外,它只认创建之后才出结果的检查。
时间以外的条件都是"等某件事发生",还有三项设置:
@@ -140,7 +140,7 @@ multica issue wakeup create OPS-56 --until-status in_review --instruction "检
- **时间**:`--kind at` 配 `--after 10m` 或 `--at <RFC3339 时间>`;`--kind every --every 1h` 按固定间隔,最短 1 分钟;`--kind cron --cron "<5 段表达式>"` 配 `--timezone`,时区默认 UTC。
- **事件**:`--event` 后面写事件名,多个用逗号分隔,`multica issue wakeup events` 列出全部事件和过滤参数。`--mode continuous` 改成重复唤醒。
-- **条件**:`--until-status`、`--until-assignee`、`--until-label`、`--until-property`、`--until-children-done [--stage N]`、`--until-pr checks|merged|conflicts|reviewed|approved|changes_requested`、`--until-issue <任务> --until-issue-state done|ended|in_review|blocked`。一条唤醒只能用一个 `--until-*`,不能和 `--event` 同时用。
+- **条件**:`--until-status`、`--until-assignee`、`--until-label`、`--until-property`、`--until-children-done [--stage N]`、`--until-pr checks|merged|conflicts`、`--until-issue <任务> --until-issue-state done|ended|in_review|blocked`。一条唤醒只能用一个 `--until-*`,不能和 `--event` 同时用。
- **结束方式**:CLI 不会自动给等待加期限,用 `--expires-in 72h` 或 `--expires-at <RFC3339 时间>` 设结束时间;`--on-timeout wake` 让事件规则在超时时再唤醒一次。`--max-fires N`(1–1000)限制重复规则最多运行几次。
- **结果放在哪**:`--parent <评论 ID>` 让唤醒后的回复留在原来的评论串里。
diff --git a/docs/engineering/issue-wakeups.md b/docs/engineering/issue-wakeups.md
index 7f467a3dd4..ece401332b 100644
--- a/docs/engineering/issue-wakeups.md
+++ b/docs/engineering/issue-wakeups.md
@@ -57,7 +57,6 @@ multica issue wakeup create ISSUE --kind cron --cron '0 * * * *' --timezone Asia
multica issue wakeup create ISSUE --kind event --event task.completed,task.failed,task.cancelled --task-id RUN --instruction-file ./instruction.md
multica issue wakeup create ISSUE --until-status in_review --instruction-file ./instruction.md
multica issue wakeup create ISSUE --until-pr checks --expires-in 2h --on-timeout wake --instruction-file ./instruction.md
-multica issue wakeup create ISSUE --until-pr reviewed --instruction-file ./instruction.md
multica issue wakeup create ISSUE --until-children-done --stage 1 --instruction-file ./instruction.md
multica issue wakeup create ISSUE --until-issue MUL-123 --until-issue-state done --instruction-file ./instruction.md
multica issue wakeup list ISSUE
@@ -581,7 +580,6 @@ the scheduler evaluates:
| `issue_field` | `field=property`, `property_id`, `value` | the property's stored value equals `value` |
| `children_done` | optional `stage` | every sub-issue (or every one up to that stage) is closed |
| `pull_request` | `event=checks_finished`, `merged` or `conflicts` | a linked PR's checks finished on its current head, it merged, or an open GitHub PR is `CONFLICTING` on its current head |
-| `pull_request` | `event=reviewed`, `approved` or `changes_requested` | a new human approval or request for changes on a directly linked open/draft GitHub PR |
| `other_issue` | `issue_id`, `state=done`, `ended`, `in_review` or `blocked` | another issue in the workspace reaches that state |
A condition rule stays `kind=event`. Validation derives the same-issue events
@@ -595,22 +593,6 @@ head's result, another sub-issue set). States already true at registration fire
on the first check; finished checks from before registration are ignored. The
watched issue's identifier is stored in the condition for display.
-Review conditions read `review_snapshot`, fetched through the existing GitHub
-REST client with Pull requests read permission. Bots, PR authors, comment-only
-reviews and dismissed decisions are excluded. Each rule stores its registration
-time and seen `(PR id, review id)` pairs in `condition_state`; these survive
-temporary errors, dismissals and unlink/relink. A new registration or re-enable
-starts a new boundary. Head changes do not replay a review. These conditions
-observe individual submissions, not whether branch-protection approval gates
-are satisfied. Review-watched PRs remain in the bounded TTL refresh sweep even
-after checks settle, so missed webhooks can recover.
-
-Apply additive migration 609, complete the backend rollout, then deploy the
-web/Desktop and CLI. Disable review conditions before rolling the backend back;
-keep the nullable column and re-enable the rules after upgrading again.
-The GitHub App should subscribe to `pull_request_review` for prompt refreshes;
-no additional repository permission is needed.
-
`conflicts` reads the GitHub API snapshot (`api_mergeable`) and counts only a
snapshot fetched for the PR's current head, so a verdict from before a push
never fires. Its key is `pr_id@head:conflicting` (PR numbers and heads repeat
diff --git a/packages/core/api/issue-wakeup.test.ts b/packages/core/api/issue-wakeup.test.ts
index da7cadac87..aa32e6c91b 100644
--- a/packages/core/api/issue-wakeup.test.ts
+++ b/packages/core/api/issue-wakeup.test.ts
@@ -232,21 +232,13 @@ it("reads conditions, caps and pauses, and drops shapes it does not know", async
{ ...base, id: "w2", condition: { type: "future_kind" }, paused_reason: "someday" },
{ ...base, id: "w3", condition: { type: "other_issue", issue_id: "x", state: "done", identifier: "MUL-2" } },
{ ...base, id: "w4", condition: { type: "other_issue", issue_id: "y", state: "blocked", identifier: "MUL-3" } },
- ...["reviewed", "approved", "changes_requested"].map((event) => ({ ...base, id: event, condition: { type: "pull_request", event } })),
- ...[{ event: 42 }, {}, { event: "future_review" }].map((fields) => ({ ...base, condition: { type: "pull_request", ...fields } })),
];
vi.stubGlobal("fetch", vi.fn().mockResolvedValue(new Response(JSON.stringify(rows))));
- const [known, unknown, other, blocked, ...reviews] = await client.listIssueWakeups("i");
+ const [known, unknown, other, blocked] = await client.listIssueWakeups("i");
expect(known).toMatchObject({ condition: { field: "status", value: "in_review" }, max_fires: 20, fire_count: 20, paused_reason: "max_fires" });
expect(unknown).toMatchObject({ condition: null, paused_reason: null });
expect(other!.condition).toEqual({ type: "other_issue", issue_id: "x", state: "done", identifier: "MUL-2" });
expect(blocked!.condition).toEqual({ type: "other_issue", issue_id: "y", state: "blocked", identifier: "MUL-3" });
- expect(reviews.slice(0, 3).map((rule) => rule.condition)).toEqual([
- { type: "pull_request", event: "reviewed" },
- { type: "pull_request", event: "approved" },
- { type: "pull_request", event: "changes_requested" },
- ]);
- expect(reviews.slice(3).map((rule) => rule.condition)).toEqual([null, null, null]);
});
it("reads system rule rows in the workspace list", async () => {
diff --git a/packages/core/api/schemas.ts b/packages/core/api/schemas.ts
index fbaacc00c4..28314789b0 100644
--- a/packages/core/api/schemas.ts
+++ b/packages/core/api/schemas.ts
@@ -3823,7 +3823,7 @@ export const WakeupConditionSchema = z.union([
z.object({ type: z.literal("issue_field"), field: z.literal("label"), label_id: z.string() }),
z.object({ type: z.literal("issue_field"), field: z.literal("property"), property_id: z.string(), value: z.unknown() }),
z.object({ type: z.literal("children_done"), stage: z.number().int().nullish() }),
- z.object({ type: z.literal("pull_request"), event: z.enum(["checks_finished", "merged", "conflicts", "reviewed", "approved", "changes_requested"]) }),
+ z.object({ type: z.literal("pull_request"), event: z.enum(["checks_finished", "merged", "conflicts"]) }),
z.object({ type: z.literal("other_issue"), issue_id: z.string(), state: z.enum(["done", "ended", "in_review", "blocked"]), identifier: z.string().optional() }),
]);
diff --git a/packages/core/types/issue-wakeup.ts b/packages/core/types/issue-wakeup.ts
index e54cc0f729..92ef3bbf59 100644
--- a/packages/core/types/issue-wakeup.ts
+++ b/packages/core/types/issue-wakeup.ts
@@ -53,7 +53,7 @@ export type WakeupCondition =
| { type: "issue_field"; field: "label"; label_id: string }
| { type: "issue_field"; field: "property"; property_id: string; value: unknown }
| { type: "children_done"; stage?: number | null }
- | { type: "pull_request"; event: "checks_finished" | "merged" | "conflicts" | "reviewed" | "approved" | "changes_requested" }
+ | { type: "pull_request"; event: "checks_finished" | "merged" | "conflicts" }
| { type: "other_issue"; issue_id: string; state: "done" | "ended" | "in_review" | "blocked"; identifier?: string };
/** One run a rule started, for its trigger history. */
diff --git a/packages/views/issues/components/wakeup-activity.test.tsx b/packages/views/issues/components/wakeup-activity.test.tsx
index 3dfa39d45e..3cca8a46b3 100644
--- a/packages/views/issues/components/wakeup-activity.test.tsx
+++ b/packages/views/issues/components/wakeup-activity.test.tsx
@@ -42,15 +42,6 @@ describe("wakeup timeline entries", () => {
expect(read(entry("wakeup_triggered", { wakeup: { ...reply, condition: { type: "pull_request", event: "conflicts" } } }))).toBe(
"当关联 PR 出现合并冲突时,唤醒了 Emacs",
);
- expect(read(entry("wakeup_triggered", { wakeup: { ...reply, condition: { type: "pull_request", event: "reviewed" } } }))).toBe(
- "当关联 PR 收到人工评审决定时,唤醒了 Emacs",
- );
- expect(read(entry("wakeup_triggered", { wakeup: { ...reply, condition: { type: "pull_request", event: "approved" } } }))).toBe(
- "当关联 PR 收到人工批准时,唤醒了 Emacs",
- );
- expect(read(entry("wakeup_triggered", { wakeup: { ...reply, condition: { type: "pull_request", event: "changes_requested" } } }))).toBe(
- "当关联 PR 被要求修改时,唤醒了 Emacs",
- );
expect(read(entry("wakeup_triggered", { wakeup: reply, events: ["wakeup.manual"], actor_type: "member", actor_id: "u" }))).toBe(
"Jiayuan 立即唤醒了 Emacs",
);
diff --git a/packages/views/issues/components/wakeup-create.tsx b/packages/views/issues/components/wakeup-create.tsx
index 2079fb71a6..199b170984 100644
--- a/packages/views/issues/components/wakeup-create.tsx
+++ b/packages/views/issues/components/wakeup-create.tsx
@@ -459,9 +459,6 @@ function ConditionParams({
{ value: "checks_finished", label: t(($) => $.wakeups.create.pr_checks) },
{ value: "merged", label: t(($) => $.wakeups.create.pr_merged) },
{ value: "conflicts", label: t(($) => $.wakeups.create.pr_conflicts) },
- { value: "reviewed", label: t(($) => $.wakeups.create.pr_reviewed) },
- { value: "approved", label: t(($) => $.wakeups.create.pr_approved) },
- { value: "changes_requested", label: t(($) => $.wakeups.create.pr_changes_requested) },
]}
onChange={(prEvent) => update({ prEvent: prEvent as WakeupDraft["prEvent"] })}
/>
diff --git a/packages/views/issues/components/wakeup-draft.test.ts b/packages/views/issues/components/wakeup-draft.test.ts
index 81b79143a3..cc03326ca5 100644
--- a/packages/views/issues/components/wakeup-draft.test.ts
+++ b/packages/views/issues/components/wakeup-draft.test.ts
@@ -88,9 +88,6 @@ describe("platform conditions", () => {
expect(input({ condition: "children", stage: null })).toMatchObject({ input: { condition: { type: "children_done" } } });
expect(input({ condition: "pull_request", prEvent: "merged" })).toMatchObject({ input: { condition: { type: "pull_request", event: "merged" } } });
expect(input({ condition: "pull_request", prEvent: "conflicts" })).toMatchObject({ input: { condition: { type: "pull_request", event: "conflicts" } } });
- expect(input({ condition: "pull_request", prEvent: "reviewed" })).toMatchObject({ input: { condition: { type: "pull_request", event: "reviewed" } } });
- expect(input({ condition: "pull_request", prEvent: "approved" })).toMatchObject({ input: { condition: { type: "pull_request", event: "approved" } } });
- expect(input({ condition: "pull_request", prEvent: "changes_requested" })).toMatchObject({ input: { condition: { type: "pull_request", event: "changes_requested" } } });
expect(input({ condition: "other_issue", otherIssue: { id: "i2", identifier: "MUL-2" }, otherState: "ended" })).toMatchObject({
input: { condition: { type: "other_issue", issue_id: "i2", state: "ended" } },
});
diff --git a/packages/views/issues/components/wakeup-draft.ts b/packages/views/issues/components/wakeup-draft.ts
index ca7bb9da8f..e34003d9be 100644
--- a/packages/views/issues/components/wakeup-draft.ts
+++ b/packages/views/issues/components/wakeup-draft.ts
@@ -78,7 +78,7 @@ export interface WakeupDraft {
assignee: { type: "member" | "agent" | "squad"; id: string } | null;
/** Null waits for every sub-issue. */
stage: number | null;
- prEvent: "checks_finished" | "merged" | "conflicts" | "reviewed" | "approved" | "changes_requested";
+ prEvent: "checks_finished" | "merged" | "conflicts";
otherIssue: { id: string; identifier: string } | null;
otherState: "done" | "ended" | "in_review" | "blocked";
maxFires: number;
diff --git a/packages/views/issues/components/wakeup-presentation.ts b/packages/views/issues/components/wakeup-presentation.ts
index 22267af76a..4bf4bf772d 100644
--- a/packages/views/issues/components/wakeup-presentation.ts
+++ b/packages/views/issues/components/wakeup-presentation.ts
@@ -237,18 +237,7 @@ export function useWakeupText() {
return c.stage ? { key: "children_stage" as const, values: { stage: c.stage } } : { key: "children_all" as const, values: {} };
case "pull_request":
return {
- key:
- c.event === "merged"
- ? ("pr_merged" as const)
- : c.event === "conflicts"
- ? ("pr_conflicts" as const)
- : c.event === "reviewed"
- ? ("pr_reviewed" as const)
- : c.event === "approved"
- ? ("pr_approved" as const)
- : c.event === "changes_requested"
- ? ("pr_changes_requested" as const)
- : ("pr_checks" as const),
+ key: c.event === "merged" ? ("pr_merged" as const) : c.event === "conflicts" ? ("pr_conflicts" as const) : ("pr_checks" as const),
values: {},
};
case "other_issue":
diff --git a/packages/views/locales/en/issues.json b/packages/views/locales/en/issues.json
index 31f32289bd..9f0625c0ef 100644
--- a/packages/views/locales/en/issues.json
+++ b/packages/views/locales/en/issues.json
@@ -1323,9 +1323,6 @@
"pr_checks": "CI finishes",
"pr_merged": "It merges",
"pr_conflicts": "It has merge conflicts",
- "pr_reviewed": "It receives a review decision",
- "pr_approved": "It receives an approval",
- "pr_changes_requested": "Changes are requested",
"choose_issue": "Choose an issue",
"pick_issue_title": "Watch an issue",
"pick_issue_description": "Wake the agent when this issue reaches the state you choose.",
@@ -1385,9 +1382,6 @@
"pr_checks": "When a linked PR's CI finishes",
"pr_merged": "When a linked PR merges",
"pr_conflicts": "When a linked PR has merge conflicts",
- "pr_reviewed": "When a linked PR receives a human review decision",
- "pr_approved": "When a linked PR receives a human approval",
- "pr_changes_requested": "When changes are requested on a linked PR",
"other_done": "When {{issue}} is done",
"other_ended": "When {{issue}} is done or cancelled",
"other_in_review": "When {{issue}} moves to In Review",
@@ -1412,9 +1406,6 @@
"pr_checks": "Waiting for CI",
"pr_merged": "Waiting for the PR to merge",
"pr_conflicts": "Watching for merge conflicts",
- "pr_reviewed": "Waiting for a PR review decision",
- "pr_approved": "Waiting for PR approval",
- "pr_changes_requested": "Waiting for changes requested on the PR",
"other_done": "Waiting for {{issue}}",
"other_ended": "Waiting for {{issue}} to end",
"other_in_review": "Waiting for {{issue}} to reach review",
diff --git a/packages/views/locales/fr/issues.json b/packages/views/locales/fr/issues.json
index be5b1e99e1..21e0f5dec1 100644
--- a/packages/views/locales/fr/issues.json
+++ b/packages/views/locales/fr/issues.json
@@ -1323,9 +1323,6 @@
"pr_checks": "Fin de la CI",
"pr_merged": "Fusion",
"pr_conflicts": "Conflits de fusion",
- "pr_reviewed": "Décision de revue reçue",
- "pr_approved": "Approbation reçue",
- "pr_changes_requested": "Modifications demandées",
"choose_issue": "Choisir une tâche",
"pick_issue_title": "Suivre une tâche",
"pick_issue_description": "Réveille l’agent quand cette tâche atteint l’état choisi.",
@@ -1385,9 +1382,6 @@
"pr_checks": "Quand la CI d’une PR liée se termine",
"pr_merged": "Quand une PR liée est fusionnée",
"pr_conflicts": "Quand une PR liée a des conflits de fusion",
- "pr_reviewed": "Quand une PR liée reçoit une décision de revue humaine",
- "pr_approved": "Quand une PR liée reçoit une approbation humaine",
- "pr_changes_requested": "Quand des modifications sont demandées sur une PR liée",
"other_done": "Quand {{issue}} est terminée",
"other_ended": "Quand {{issue}} est terminée ou annulée",
"other_in_review": "Quand {{issue}} passe en revue",
@@ -1412,9 +1406,6 @@
"pr_checks": "Attend la CI",
"pr_merged": "Attend la fusion de la PR",
"pr_conflicts": "Surveille les conflits de fusion",
- "pr_reviewed": "Attend une décision de revue de la PR",
- "pr_approved": "Attend l’approbation de la PR",
- "pr_changes_requested": "Attend les modifications demandées sur la PR",
"other_done": "Attend {{issue}}",
"other_ended": "Attend la fin de {{issue}}",
"other_in_review": "Attend la revue de {{issue}}",
diff --git a/packages/views/locales/ja/issues.json b/packages/views/locales/ja/issues.json
index f446d341bf..d05f62d4d5 100644
--- a/packages/views/locales/ja/issues.json
+++ b/packages/views/locales/ja/issues.json
@@ -1277,9 +1277,6 @@
"pr_checks": "CI 終了",
"pr_merged": "マージ",
"pr_conflicts": "マージコンフリクト発生",
- "pr_reviewed": "レビュー結果を受領",
- "pr_approved": "承認",
- "pr_changes_requested": "変更リクエスト",
"choose_issue": "タスクを選択",
"pick_issue_title": "見守るタスク",
"pick_issue_description": "このタスクが選んだ状態になったらエージェントを起こします。",
@@ -1337,9 +1334,6 @@
"pr_checks": "関連 PR の CI が終わったとき",
"pr_merged": "関連 PR がマージされたとき",
"pr_conflicts": "関連 PR にマージコンフリクトが発生したとき",
- "pr_reviewed": "関連 PR に人間のレビュー結果が届いたとき",
- "pr_approved": "関連 PR に人間から承認が届いたとき",
- "pr_changes_requested": "関連 PR に変更がリクエストされたとき",
"other_done": "{{issue}} が完了したとき",
"other_ended": "{{issue}} が完了またはキャンセルされたとき",
"other_in_review": "{{issue}} がレビュー中になったとき",
@@ -1364,9 +1358,6 @@
"pr_checks": "CI 待ち",
"pr_merged": "PR のマージ待ち",
"pr_conflicts": "マージコンフリクトを監視中",
- "pr_reviewed": "PR のレビュー結果待ち",
- "pr_approved": "PR 承認待ち",
- "pr_changes_requested": "PR の変更リクエスト待ち",
"other_done": "{{issue}} の完了待ち",
"other_ended": "{{issue}} の終了待ち",
"other_in_review": "{{issue}} のレビュー待ち",
diff --git a/packages/views/locales/ko/issues.json b/packages/views/locales/ko/issues.json
index 05b874175f..0b36972744 100644
--- a/packages/views/locales/ko/issues.json
+++ b/packages/views/locales/ko/issues.json
@@ -1277,9 +1277,6 @@
"pr_checks": "CI 종료",
"pr_merged": "병합",
"pr_conflicts": "병합 충돌 발생",
- "pr_reviewed": "리뷰 결정 받음",
- "pr_approved": "승인됨",
- "pr_changes_requested": "변경 요청됨",
"choose_issue": "태스크 선택",
"pick_issue_title": "지켜볼 태스크",
"pick_issue_description": "이 태스크가 선택한 상태가 되면 에이전트를 깨웁니다.",
@@ -1337,9 +1334,6 @@
"pr_checks": "연결된 PR의 CI가 끝나면",
"pr_merged": "연결된 PR이 병합되면",
"pr_conflicts": "연결된 PR에 병합 충돌이 생기면",
- "pr_reviewed": "연결된 PR이 사람의 리뷰 결정을 받으면",
- "pr_approved": "연결된 PR이 사람의 승인을 받으면",
- "pr_changes_requested": "연결된 PR에 변경 요청이 있으면",
"other_done": "{{issue}}이(가) 완료되면",
"other_ended": "{{issue}}이(가) 완료되거나 취소되면",
"other_in_review": "{{issue}}이(가) 검토 중으로 바뀌면",
@@ -1364,9 +1358,6 @@
"pr_checks": "CI 대기",
"pr_merged": "PR 병합 대기",
"pr_conflicts": "병합 충돌 감시 중",
- "pr_reviewed": "PR 리뷰 결정 대기",
- "pr_approved": "PR 승인 대기",
- "pr_changes_requested": "PR 변경 요청 대기",
"other_done": "{{issue}} 완료 대기",
"other_ended": "{{issue}} 종료 대기",
"other_in_review": "{{issue}} 검토 대기",
diff --git a/packages/views/locales/zh-Hans/issues.json b/packages/views/locales/zh-Hans/issues.json
index d2aa217c5a..f488f01822 100644
--- a/packages/views/locales/zh-Hans/issues.json
+++ b/packages/views/locales/zh-Hans/issues.json
@@ -1277,9 +1277,6 @@
"pr_checks": "CI 结束",
"pr_merged": "合并",
"pr_conflicts": "出现合并冲突",
- "pr_reviewed": "收到评审决定",
- "pr_approved": "收到批准",
- "pr_changes_requested": "被要求修改",
"choose_issue": "选择任务",
"pick_issue_title": "选择要关注的任务",
"pick_issue_description": "该任务达到所选状态时唤醒智能体。",
@@ -1337,9 +1334,6 @@
"pr_checks": "当关联 PR 的 CI 结束时",
"pr_merged": "当关联 PR 合并时",
"pr_conflicts": "当关联 PR 出现合并冲突时",
- "pr_reviewed": "当关联 PR 收到人工评审决定时",
- "pr_approved": "当关联 PR 收到人工批准时",
- "pr_changes_requested": "当关联 PR 被要求修改时",
"other_done": "当 {{issue}} 完成时",
"other_ended": "当 {{issue}} 完成或取消时",
"other_in_review": "当 {{issue}} 进入审核中时",
@@ -1364,9 +1358,6 @@
"pr_checks": "等 CI 结束",
"pr_merged": "等 PR 合并",
"pr_conflicts": "监视合并冲突",
- "pr_reviewed": "等待 PR 评审决定",
- "pr_approved": "等待 PR 批准",
- "pr_changes_requested": "等待 PR 修改意见",
"other_done": "等 {{issue}} 完成",
"other_ended": "等 {{issue}} 结束",
"other_in_review": "等 {{issue}} 进入审核",
diff --git a/packages/views/locales/zh-Hant/issues.json b/packages/views/locales/zh-Hant/issues.json
index b3fd605607..e21c22fa2e 100644
--- a/packages/views/locales/zh-Hant/issues.json
+++ b/packages/views/locales/zh-Hant/issues.json
@@ -1277,9 +1277,6 @@
"pr_checks": "CI 結束",
"pr_merged": "合併",
"pr_conflicts": "出現合併衝突",
- "pr_reviewed": "收到審查決定",
- "pr_approved": "收到批准",
- "pr_changes_requested": "被要求修改",
"choose_issue": "選擇任務",
"pick_issue_title": "選擇要關注的任務",
"pick_issue_description": "該任務達到所選狀態時喚醒 AI 代理。",
@@ -1337,9 +1334,6 @@
"pr_checks": "當關聯 PR 的 CI 結束時",
"pr_merged": "當關聯 PR 合併時",
"pr_conflicts": "當關聯 PR 出現合併衝突時",
- "pr_reviewed": "當關聯 PR 收到人工審查決定時",
- "pr_approved": "當關聯 PR 收到人工批准時",
- "pr_changes_requested": "當關聯 PR 被要求修改時",
"other_done": "當 {{issue}} 完成時",
"other_ended": "當 {{issue}} 完成或取消時",
"other_in_review": "當 {{issue}} 進入審查中時",
@@ -1364,9 +1358,6 @@
"pr_checks": "等 CI 結束",
"pr_merged": "等 PR 合併",
"pr_conflicts": "監視合併衝突",
- "pr_reviewed": "等待 PR 審查決定",
- "pr_approved": "等待 PR 批准",
- "pr_changes_requested": "等待 PR 修改意見",
"other_done": "等 {{issue}} 完成",
"other_ended": "等 {{issue}} 結束",
"other_in_review": "等 {{issue}} 進入審查",
diff --git a/server/cmd/multica/cmd_issue_wakeup.go b/server/cmd/multica/cmd_issue_wakeup.go
index 14c9f4aa45..10c6e545ff 100644
--- a/server/cmd/multica/cmd_issue_wakeup.go
+++ b/server/cmd/multica/cmd_issue_wakeup.go
@@ -81,7 +81,7 @@ func newIssueWakeupCommand() *cobra.Command {
c.Flags().String("until-property", "", "Condition: property PROPERTY_ID equals VALUE (PROPERTY_ID=VALUE; VALUE may be JSON)")
c.Flags().Bool("until-children-done", false, "Condition: every sub-issue is closed (or those up to --stage)")
c.Flags().Int32("stage", 0, "With --until-children-done: wait for this stage and earlier ones")
- c.Flags().String("until-pr", "", "Condition: a linked pull request's checks finish (checks), it merges (merged), it has merge conflicts on its current head (conflicts; GitHub only), or it receives a new human approval or request for changes (reviewed, approved, changes_requested; GitHub only; excludes bots, PR authors and comment-only reviews)")
+ c.Flags().String("until-pr", "", "Condition: a linked pull request's checks finish (checks), it merges (merged), or it has merge conflicts on its current head (conflicts; GitHub only)")
c.Flags().String("until-issue", "", "Condition: another issue in this workspace reaches --until-issue-state")
c.Flags().String("until-issue-state", "done", "With --until-issue: done, ended (done or cancelled), in_review or blocked")
c.Flags().Int32("max-fires", 0, "Repeating rules: stop after this many runs (1-1000; continuous event rules default to 20)")
@@ -291,16 +291,9 @@ func wakeupConditionFromFlags(ctx context.Context, cmd *cobra.Command, client *c
return nil, fmt.Errorf("--stage requires --until-children-done")
}
if v, _ := cmd.Flags().GetString("until-pr"); v != "" {
- event := map[string]string{
- "checks": "checks_finished",
- "merged": "merged",
- "conflicts": "conflicts",
- "reviewed": "reviewed",
- "approved": "approved",
- "changes_requested": "changes_requested",
- }[v]
+ event := map[string]string{"checks": "checks_finished", "merged": "merged", "conflicts": "conflicts"}[v]
if event == "" {
- return nil, fmt.Errorf("--until-pr takes checks, merged, conflicts, reviewed, approved or changes_requested")
+ return nil, fmt.Errorf("--until-pr takes checks, merged or conflicts")
}
conditions = append(conditions, map[string]any{"type": "pull_request", "event": event})
}
diff --git a/server/cmd/multica/cmd_issue_wakeup_test.go b/server/cmd/multica/cmd_issue_wakeup_test.go
index 5491783bb9..64b5bde58c 100644
--- a/server/cmd/multica/cmd_issue_wakeup_test.go
+++ b/server/cmd/multica/cmd_issue_wakeup_test.go
@@ -178,9 +178,6 @@ func TestIssueWakeupCLIConditionsAndManagement(t *testing.T) {
{[]string{"--until-children-done", "--stage", "2"}, `{"stage":2,"type":"children_done"}`},
{[]string{"--until-pr", "checks", "--mode", "continuous", "--max-fires", "5"}, `{"event":"checks_finished","type":"pull_request"}`},
{[]string{"--until-pr", "conflicts", "--mode", "continuous", "--max-fires", "5"}, `{"event":"conflicts","type":"pull_request"}`},
- {[]string{"--until-pr", "reviewed", "--mode", "continuous", "--max-fires", "5"}, `{"event":"reviewed","type":"pull_request"}`},
- {[]string{"--until-pr", "approved", "--mode", "continuous", "--max-fires", "5"}, `{"event":"approved","type":"pull_request"}`},
- {[]string{"--until-pr", "changes_requested", "--mode", "continuous", "--max-fires", "5"}, `{"event":"changes_requested","type":"pull_request"}`},
{[]string{"--until-assignee", "agent:a1"}, `{"assignee_id":"a1","assignee_type":"agent","field":"assignee","type":"issue_field"}`},
} {
calls = nil
diff --git a/server/internal/handler/github.go b/server/internal/handler/github.go
index 990af4301b..210e57afcd 100644
--- a/server/internal/handler/github.go
+++ b/server/internal/handler/github.go
@@ -1107,8 +1107,6 @@ func (h *Handler) HandleGitHubWebhook(w http.ResponseWriter, r *http.Request) {
// never read for display. Each just asks the API pipeline to re-fetch
// the authoritative snapshot for the PR(s) it concerns.
h.triggerPRRefreshFromCIEvent(ctx, body)
- case "pull_request_review":
- h.handlePullRequestReviewEvent(ctx, body)
default:
// Acknowledge every event so GitHub doesn't mark the endpoint failing,
// but ignore types we don't model.
@@ -1478,48 +1476,6 @@ type ghCIEventPayload struct {
} `json:"check_run"`
}
-type ghPRReviewEventPayload struct {
- Action string `json:"action"`
- PullRequest struct {
- Number int32 `json:"number"`
- } `json:"pull_request"`
- Review struct {
- State string `json:"state"`
- } `json:"review"`
- Repository struct {
- Name string `json:"name"`
- Owner struct {
- Login string `json:"login"`
- } `json:"owner"`
- } `json:"repository"`
- Installation struct {
- ID int64 `json:"id"`
- } `json:"installation"`
-}
-
-func (h *Handler) handlePullRequestReviewEvent(ctx context.Context, body []byte) {
- var p ghPRReviewEventPayload
- if err := json.Unmarshal(body, &p); err != nil {
- slog.Warn("github: bad pull_request_review payload", "err", err)
- return
- }
- if p.Installation.ID == 0 || p.Repository.Owner.Login == "" || p.Repository.Name == "" || p.PullRequest.Number <= 0 {
- return
- }
- if p.Action != "submitted" && p.Action != "edited" && p.Action != "dismissed" {
- return
- }
- if h.Metrics != nil {
- h.Metrics.RecordGithubEventReceived("pull_request_review", p.Action)
- if reviewState := strings.ToLower(p.Review.State); reviewState != "" {
- h.Metrics.RecordGithubPRReview(reviewState)
- }
- }
- if h.PRRefresh.Enabled() {
- h.PRRefresh.Enqueue(p.Installation.ID, p.Repository.Owner.Login, p.Repository.Name, p.PullRequest.Number)
- }
-}
-
// triggerPRRefreshFromCIEvent enqueues an API refresh for the PR(s) a
// check_suite / check_run / status webhook concerns. check_suite/check_run
// carry the PR numbers directly; status events carry only a commit SHA, so we
diff --git a/server/internal/handler/github_test.go b/server/internal/handler/github_test.go
index 42ac70717e..917af991cd 100644
--- a/server/internal/handler/github_test.go
+++ b/server/internal/handler/github_test.go
@@ -3483,38 +3483,3 @@ func TestWebhook_UninstallDeletesAllBindings(t *testing.T) {
t.Errorf("deleted broadcasts must cover both workspaces; saw %v", seen)
}
}
-func TestWebhook_PullRequestReview_AcceptsSignedEvent(t *testing.T) {
- if testHandler == nil {
- t.Skip("handler test fixture not initialized (no DB?)")
- }
- const secret = "review-secret"
- t.Setenv("GITHUB_WEBHOOK_SECRET", secret)
-
- payload := map[string]any{
- "action": "submitted",
- "review": map[string]any{
- "state": "approved",
- },
- "pull_request": map[string]any{
- "number": 101,
- },
- "repository": map[string]any{
- "name": "widget",
- "owner": map[string]any{"login": "acme"},
- },
- "installation": map[string]any{"id": int64(12345)},
- }
- raw, _ := json.Marshal(payload)
- mac := hmac.New(sha256.New, []byte(secret))
- mac.Write(raw)
- sig := "sha256=" + hex.EncodeToString(mac.Sum(nil))
-
- req := httptest.NewRequest("POST", "/api/webhooks/github", bytes.NewReader(raw))
- req.Header.Set("X-GitHub-Event", "pull_request_review")
- req.Header.Set("X-Hub-Signature-256", sig)
-
- rec := testutil.Call(t, testHandler.HandleGitHubWebhook, req)
- if rec.Code != http.StatusAccepted {
- t.Fatalf("expected 202, got %d (%s)", rec.Code, rec.Body.String())
- }
-}
diff --git a/server/internal/integrations/ghsnapshot/client.go b/server/internal/integrations/ghsnapshot/client.go
index 4db2c9c3db..b3e65d5ecc 100644
--- a/server/internal/integrations/ghsnapshot/client.go
+++ b/server/internal/integrations/ghsnapshot/client.go
@@ -1,4 +1,4 @@
-// Package ghsnapshot fetches a GitHub pull request's CI, reviews and mergeability
+// Package ghsnapshot fetches a GitHub pull request's CI + mergeability state
// from the GitHub API and treats that response as the single source of truth
// for the PR card (MUL-5265, Plan C). Webhooks and page visits only trigger a
// refresh; nothing here infers state incrementally from webhook payloads.
@@ -6,7 +6,7 @@
// The package has three layers:
// - Client (this file): GitHub App auth — App JWT → installation access
// token (cached per installation, refreshed early) → REST calls.
-// - snapshot.go and reviews.go: PR / Checks / Statuses / Reviews queries, pagination, and
+// - snapshot.go: PR / Checks / Statuses queries, pagination, and
// normalization into a flat per-check snapshot.
// - refresh.go: the outbound work queue (dedup, single in-flight per PR,
// bounded concurrency, Retry-After backoff), the head-SHA-guarded atomic
diff --git a/server/internal/integrations/ghsnapshot/refresh.go b/server/internal/integrations/ghsnapshot/refresh.go
index 7a42d149f2..ea2f28eed2 100644
--- a/server/internal/integrations/ghsnapshot/refresh.go
+++ b/server/internal/integrations/ghsnapshot/refresh.go
@@ -2,7 +2,6 @@ package ghsnapshot
import (
"context"
- "encoding/json"
"log/slog"
"math/rand"
"sync"
@@ -41,7 +40,7 @@ var (
defaultSweepTTL = 10 * time.Minute
defaultSweepInterval = 10 * time.Minute
defaultSweepMaxRows = int32(200)
- // PRs watched by a conflict or review rule stay in the sweep even
+ // PRs watched by a "wake on merge conflict" rule stay in the sweep even
// when decided, re-fetched once their snapshot is older than this.
defaultWatchTTL = 5 * time.Minute
// After a merge into a repository, GitHub recomputes the other PRs'
@@ -420,20 +419,10 @@ func (m *Manager) applySnapshot(ctx context.Context, prID pgtype.UUID, snap *PRS
if snap.HasChecks {
rollup = textOrNull(snap.RollupState)
}
- // A successful empty fetch is distinct from reviews not fetched yet.
- reviews := snap.Reviews
- if reviews == nil {
- reviews = []PRReview{}
- }
- reviewSnapshot, err := json.Marshal(reviews)
- if err != nil {
- return false, err
- }
n, err := q.UpdateGitHubPRSnapshot(ctx, db.UpdateGitHubPRSnapshotParams{
ApiMergeable: textOrNull(snap.Mergeable),
ApiMergeStateStatus: textOrNull(snap.MergeStateStatus),
ChecksRollupState: rollup,
- ReviewSnapshot: reviewSnapshot,
HeadSha: snap.HeadSHA,
FetchedAt: tsFromTime(m.now()),
PrID: prID,
diff --git a/server/internal/integrations/ghsnapshot/refresh_db_test.go b/server/internal/integrations/ghsnapshot/refresh_db_test.go
index a926fe4bce..4a1fc4cd8f 100644
--- a/server/internal/integrations/ghsnapshot/refresh_db_test.go
+++ b/server/internal/integrations/ghsnapshot/refresh_db_test.go
@@ -326,10 +326,6 @@ func TestConflictWatchedGitHubPRQueries(t *testing.T) {
closed := seed(6, "closed", stale)
watch(closed, "conflicts", true)
seed(7, "open", stale)
- for i, event := range []string{"reviewed", "approved", "changes_requested"} {
- watch(seed(int32(8+i), "open", stale), event, true)
- }
- watch(seed(11, "open", stale), "reviewed", false)
rows, err := q.ListStaleConflictWatchedGitHubPRs(ctx, db.ListStaleConflictWatchedGitHubPRsParams{
OlderThan: tsFromTime(now.Add(-5 * time.Minute)),
@@ -345,8 +341,8 @@ func TestConflictWatchedGitHubPRQueries(t *testing.T) {
}
}
// Decided snapshots stay in this sweep; only stale, open, watched PRs.
- if fmt.Sprint(swept) != "[1 2 8 9 10]" {
- t.Fatalf("watched sweep = %v, want PRs 1, 2, 8, 9 and 10", swept)
+ if fmt.Sprint(swept) != "[1 2]" && fmt.Sprint(swept) != "[2 1]" {
+ t.Fatalf("watched sweep = %v, want PRs 1 and 2", swept)
}
numbers, err := q.ListConflictWatchedGitHubPRNumbersInRepo(ctx, db.ListConflictWatchedGitHubPRNumbersInRepoParams{
@@ -392,8 +388,8 @@ func TestConflictWatchedGitHubPRQueries(t *testing.T) {
t.Fatalf("merge refreshed %v, want PRs 1 and 3 once each", got)
}
m.sweepOnce(ctx)
- if got := queued(); fmt.Sprint(got) != "[1 2 8 9 10]" {
- t.Fatalf("sweep refreshed %v, want stale conflict and review watchers", got)
+ if got := queued(); fmt.Sprint(got) != "[1 2]" && fmt.Sprint(got) != "[2 1]" {
+ t.Fatalf("sweep refreshed %v, want stale watched PRs 1 and 2", got)
}
}
@@ -609,8 +605,6 @@ func TestRESTSnapshotRefreshStoresResultsAndPreservesThemOnPermissionFailure(t *
switch r.URL.Path {
case "/repos/o/r/pulls/5":
writeTestPR(w, "sha1", true, "clean")
- case "/repos/o/r/pulls/5/reviews":
- _, _ = w.Write([]byte(`[]`))
case "/repos/o/r/commits/sha1/check-runs":
if phase.Load() == 2 {
w.WriteHeader(http.StatusForbidden)
diff --git a/server/internal/integrations/ghsnapshot/rest_snapshot_test.go b/server/internal/integrations/ghsnapshot/rest_snapshot_test.go
index 278bc1da05..1628dd9224 100644
--- a/server/internal/integrations/ghsnapshot/rest_snapshot_test.go
+++ b/server/internal/integrations/ghsnapshot/rest_snapshot_test.go
@@ -37,7 +37,6 @@ func snapshotServer(t *testing.T, handler http.HandlerFunc) *httptest.Server {
func writeTestPR(w http.ResponseWriter, sha string, mergeable any, state string) {
_ = json.NewEncoder(w).Encode(map[string]any{
"head": map[string]any{"sha": sha, "repo": map[string]any{"full_name": "external/fork"}},
- "user": map[string]any{"login": "author"},
"mergeable": mergeable, "mergeable_state": state,
})
}
@@ -49,8 +48,6 @@ func TestFetchPRSnapshotRESTPagination(t *testing.T) {
case "/repos/o/r/pulls/5":
prCalls++
writeTestPR(w, "sha1", true, "clean")
- case "/repos/o/r/pulls/5/reviews":
- _ = json.NewEncoder(w).Encode([]map[string]any{reviewEntry(1, "APPROVED", "reviewer", "User")})
case "/repos/o/r/commits/sha1/check-runs":
runPages++
if r.URL.Query().Get("per_page") != "100" || r.URL.Query().Get("filter") != "latest" {
@@ -95,9 +92,6 @@ func TestFetchPRSnapshotRESTPagination(t *testing.T) {
if len(snap.Contexts) != 203 || prCalls != 2 || runPages != 2 || statusPages != 2 {
t.Fatalf("contexts=%d PR calls=%d check pages=%d status pages=%d", len(snap.Contexts), prCalls, runPages, statusPages)
}
- if len(snap.Reviews) != 1 || snap.Reviews[0].ID != 1 {
- t.Fatalf("fetched reviews missing from snapshot: %+v", snap.Reviews)
- }
if snap.Contexts[100].Conclusion != "stale" || snap.Contexts[101].Status != "in_progress" || snap.Contexts[101].Conclusion != "" || snap.Decided() {
t.Fatalf("failure plus running checks = %+v", snap)
}
@@ -126,8 +120,6 @@ func TestFetchPRSnapshotRESTResults(t *testing.T) {
switch r.URL.Path {
case "/repos/o/r/pulls/5":
writeTestPR(w, "sha1", nil, "unknown")
- case "/repos/o/r/pulls/5/reviews":
- _, _ = w.Write([]byte(`[]`))
case "/repos/o/r/commits/sha1/check-runs":
var entries []json.RawMessage
_ = json.Unmarshal([]byte(tc.runs), &entries)
@@ -173,8 +165,6 @@ func TestFetchPRSnapshotRESTRejectsPartialResults(t *testing.T) {
sha = ""
}
writeTestPR(w, sha, false, "dirty")
- case "/repos/o/r/pulls/5/reviews":
- _, _ = w.Write([]byte(`[]`))
case "/repos/o/r/commits/sha1/check-runs":
page := r.URL.Query().Get("page")
if failure == "check page failed" && page == "2" {
diff --git a/server/internal/integrations/ghsnapshot/reviews.go b/server/internal/integrations/ghsnapshot/reviews.go
deleted file mode 100644
index ddf9c948b7..0000000000
--- a/server/internal/integrations/ghsnapshot/reviews.go
+++ /dev/null
@@ -1,59 +0,0 @@
-package ghsnapshot
-
-import (
- "context"
- "encoding/json"
- "errors"
- "fmt"
- "strings"
- "time"
-)
-
-// The reviews endpoint returns an array, unlike the check collection envelopes.
-// Fetch every page before publishing; a failed/partial fetch preserves the old
-// atomic snapshot. Requests stay on the configured API host and are bounded.
-func fetchPRReviews(ctx context.Context, c *Client, installationID int64, path, author string) ([]PRReview, error) {
- if author == "" {
- return nil, errors.New("ghsnapshot: missing pull request author")
- }
- reviews := make([]PRReview, 0)
- seen := make(map[int64]bool)
- for page := 1; page <= maxSnapshotContextPages; page++ {
- data, err := c.restGet(ctx, installationID, fmt.Sprintf("%s?per_page=%d&page=%d", path, snapshotPageSize, page))
- if err != nil {
- return nil, err
- }
- var entries []struct {
- ID int64 `json:"id"`
- State string `json:"state"`
- SubmittedAt time.Time `json:"submitted_at"`
- User struct {
- Login string `json:"login"`
- Type string `json:"type"`
- } `json:"user"`
- }
- if json.Unmarshal(data, &entries) != nil || entries == nil || len(entries) > snapshotPageSize {
- return nil, errors.New("ghsnapshot: malformed review collection")
- }
- for _, entry := range entries {
- if entry.ID <= 0 || seen[entry.ID] {
- return nil, errors.New("ghsnapshot: invalid or duplicate review ID")
- }
- seen[entry.ID] = true
- // Unknown/deleted identities fail closed. Drafts, comments and
- // dismissed decisions never satisfy review wakeup conditions.
- if entry.User.Type != "User" || entry.User.Login == "" || strings.EqualFold(entry.User.Login, author) ||
- (entry.State != "APPROVED" && entry.State != "CHANGES_REQUESTED") {
- continue
- }
- if entry.SubmittedAt.IsZero() {
- return nil, errors.New("ghsnapshot: submitted review is missing its timestamp")
- }
- reviews = append(reviews, PRReview{ID: entry.ID, State: entry.State, SubmittedAt: entry.SubmittedAt})
- }
- if len(entries) < snapshotPageSize {
- return reviews, nil
- }
- }
- return nil, errors.New("ghsnapshot: review pagination exceeds page limit")
-}
diff --git a/server/internal/integrations/ghsnapshot/reviews_test.go b/server/internal/integrations/ghsnapshot/reviews_test.go
deleted file mode 100644
index 4e3188954e..0000000000
--- a/server/internal/integrations/ghsnapshot/reviews_test.go
+++ /dev/null
@@ -1,130 +0,0 @@
-package ghsnapshot
-
-import (
- "context"
- "encoding/json"
- "fmt"
- "net/http"
- "testing"
- "time"
-
- db "github.com/multica-ai/multica/server/pkg/db/generated"
-)
-
-func reviewEntry(id int, state, login, kind string) map[string]any {
- return map[string]any{"id": id, "state": state, "submitted_at": "2026-11-03T01:00:00Z",
- "user": map[string]any{"login": login, "type": kind}, "body": "private feedback"}
-}
-
-func TestFetchPRReviewsPaginatesAndFiltersIdentities(t *testing.T) {
- pages := 0
- srv := snapshotServer(t, func(w http.ResponseWriter, r *http.Request) {
- pages++
- if r.URL.Path != "/repos/o/r/pulls/5/reviews" || r.URL.Query().Get("per_page") != "100" {
- t.Errorf("review request = %s", r.URL)
- }
- entries := []map[string]any{}
- if r.URL.Query().Get("page") == "1" {
- for i := 1; i <= 100; i++ {
- entries = append(entries, reviewEntry(i, "APPROVED", "robot", "Bot"))
- }
- } else {
- entries = append(entries,
- reviewEntry(101, "APPROVED", "reviewer", "User"),
- reviewEntry(102, "CHANGES_REQUESTED", "reviewer", "User"),
- reviewEntry(103, "COMMENTED", "reviewer", "User"),
- reviewEntry(104, "APPROVED", "AUTHOR", "User"),
- reviewEntry(105, "DISMISSED", "reviewer", "User"),
- reviewEntry(106, "PENDING", "reviewer", "User"),
- reviewEntry(107, "APPROVED", "unknown", ""),
- reviewEntry(108, "APPROVED", "", "User"))
- }
- _ = json.NewEncoder(w).Encode(entries)
- })
- defer srv.Close()
- reviews, err := fetchPRReviews(context.Background(), newTestClient(t, srv.URL), 1, "/repos/o/r/pulls/5/reviews", "author")
- if err != nil || pages != 2 || len(reviews) != 2 || reviews[0].ID != 101 || reviews[1].State != "CHANGES_REQUESTED" {
- t.Fatalf("reviews=%+v pages=%d err=%v", reviews, pages, err)
- }
-}
-
-func TestFetchPRReviewsRejectsPartialOrMalformedResults(t *testing.T) {
- for _, failure := range []string{"missing author", "request failed", "null", "not array", "duplicate", "missing timestamp", "invalid ID", "page limit"} {
- t.Run(failure, func(t *testing.T) {
- srv := snapshotServer(t, func(w http.ResponseWriter, r *http.Request) {
- switch failure {
- case "request failed":
- w.WriteHeader(http.StatusForbidden)
- case "null":
- _, _ = w.Write([]byte(`null`))
- case "not array":
- _, _ = w.Write([]byte(`{}`))
- default:
- entry := reviewEntry(1, "APPROVED", "reviewer", "User")
- if failure == "missing timestamp" {
- delete(entry, "submitted_at")
- }
- if failure == "invalid ID" {
- entry["id"] = 0
- }
- entries := []map[string]any{entry}
- if failure == "duplicate" {
- entries = append(entries, entry)
- }
- if failure == "page limit" {
- var page int
- _, _ = fmt.Sscan(r.URL.Query().Get("page"), &page)
- entries = nil
- for i := 1; i <= 100; i++ {
- entries = append(entries, reviewEntry(page*100+i, "APPROVED", "reviewer", "User"))
- }
- }
- _ = json.NewEncoder(w).Encode(entries)
- }
- })
- defer srv.Close()
- author := "author"
- if failure == "missing author" {
- author = ""
- }
- reviews, err := fetchPRReviews(context.Background(), newTestClient(t, srv.URL), 1, "/repos/o/r/pulls/5/reviews", author)
- if err == nil || reviews != nil {
- t.Fatalf("partial reviews=%+v err=%v", reviews, err)
- }
- })
- }
-}
-
-func TestApplyReviewSnapshotIsAtomicAndHeadGuarded(t *testing.T) {
- pool := testDBPool(t)
- q := db.New(pool)
- pr := seedPR(t, pool, q, "a")
- defer func() { _, _ = pool.Exec(context.Background(), "DELETE FROM github_pull_request WHERE id=$1", pr.ID) }()
- m := NewManager(nil, q, pool, nil)
- snap := &PRSnapshot{HeadSHA: "a", Mergeable: "MERGEABLE", Reviews: []PRReview{{ID: 1, State: "APPROVED", SubmittedAt: time.Now()}}}
- if ok, err := m.applySnapshot(context.Background(), pr.ID, snap); err != nil || !ok {
- t.Fatalf("apply: %t %v", ok, err)
- }
- if _, err := pool.Exec(context.Background(), "UPDATE github_pull_request SET head_sha='b' WHERE id=$1", pr.ID); err != nil {
- t.Fatal(err)
- }
- snap.Reviews = nil
- if ok, err := m.applySnapshot(context.Background(), pr.ID, snap); err != nil || ok {
- t.Fatalf("old head applied: %t %v", ok, err)
- }
- var raw []byte
- if err := pool.QueryRow(context.Background(), "SELECT review_snapshot FROM github_pull_request WHERE id=$1", pr.ID).Scan(&raw); err != nil {
- t.Fatal(err)
- }
- var reviews []PRReview
- if err := json.Unmarshal(raw, &reviews); err != nil || len(reviews) != 1 || reviews[0].ID != 1 {
- t.Fatalf("stale response overwrote reviews: %s %v", raw, err)
- }
- snap.HeadSHA = "b"
- if ok, err := m.applySnapshot(context.Background(), pr.ID, snap); err != nil || !ok {
- t.Fatalf("empty snapshot apply: %t %v", ok, err)
- }
- if err := pool.QueryRow(context.Background(), "SELECT review_snapshot FROM github_pull_request WHERE id=$1", pr.ID).Scan(&raw); err != nil || string(raw) != "[]" {
- t.Fatalf("empty result must replace dismissed reviews with []: %s %v", raw, err)
- }
-}
diff --git a/server/internal/integrations/ghsnapshot/snapshot.go b/server/internal/integrations/ghsnapshot/snapshot.go
index b4a3a12727..1807a00f07 100644
--- a/server/internal/integrations/ghsnapshot/snapshot.go
+++ b/server/internal/integrations/ghsnapshot/snapshot.go
@@ -7,7 +7,6 @@ import (
"fmt"
"net/url"
"strings"
- "time"
)
// CheckContext is one normalized check for a PR head. Both check runs and commit
@@ -39,15 +38,6 @@ type PRSnapshot struct {
// as passed (acceptance criterion 5).
HasChecks bool
Contexts []CheckContext
- Reviews []PRReview
-}
-
-// PRReview carries only submitted human decisions, without review bodies or
-// user metadata. Its ID survives pushes, webhook redelivery, and body edits.
-type PRReview struct {
- ID int64 `json:"id"`
- State string `json:"state"`
- SubmittedAt time.Time `json:"submitted_at"`
}
// Decided reports whether the snapshot has settled: no check is still running
@@ -82,9 +72,6 @@ type restPullRequest struct {
} `json:"head"`
Mergeable *bool `json:"mergeable"`
MergeableState string `json:"mergeable_state"`
- User struct {
- Login string `json:"login"`
- } `json:"user"`
}
type restCheckRun struct {
@@ -103,7 +90,7 @@ type restStatusContext struct {
}
// FetchPRSnapshot uses only Pull requests, Checks and Commit statuses read
-// permissions. CI pages are pinned to one head; a final PR read detects pushes
+// permissions. Every page is pinned to one head; a final PR read detects pushes
// before the guarded atomic write in refresh.go.
func FetchPRSnapshot(ctx context.Context, c *Client, installationID int64, owner, repo string, number int32) (*PRSnapshot, error) {
if !c.Enabled() {
@@ -124,12 +111,8 @@ func FetchPRSnapshot(ctx context.Context, c *Client, installationID int64, owner
if err != nil {
return nil, err
}
- reviews, err := fetchPRReviews(ctx, c, installationID, prPath+"/reviews", pr.User.Login)
- if err != nil {
- return nil, err
- }
- snap := &PRSnapshot{HeadSHA: pr.Head.SHA, Reviews: reviews}
+ snap := &PRSnapshot{HeadSHA: pr.Head.SHA}
seenRuns := make(map[int64]struct{}, len(runs))
for _, run := range runs {
if run.ID <= 0 || run.Name == "" || run.HeadSHA != snap.HeadSHA {
diff --git a/server/internal/service/builtin_skills/multica-platform/references/issues.md b/server/internal/service/builtin_skills/multica-platform/references/issues.md
index 9f01d8ca2d..25ca34ab82 100644
--- a/server/internal/service/builtin_skills/multica-platform/references/issues.md
+++ b/server/internal/service/builtin_skills/multica-platform/references/issues.md
@@ -376,7 +376,6 @@ multica issue wakeup create <issue> --until-status in_review --instruction-file
multica issue wakeup create <issue> --until-pr checks --expires-in 2h --on-timeout wake --instruction-file ./instruction.md
multica issue wakeup create <issue> --until-pr merged --instruction-file ./instruction.md
multica issue wakeup create <issue> --until-pr conflicts --mode continuous --instruction-file ./instruction.md
-multica issue wakeup create <issue> --until-pr reviewed --instruction-file ./instruction.md
multica issue wakeup create <issue> --until-children-done --instruction-file ./instruction.md
multica issue wakeup create <issue> --until-children-done --stage 2 --instruction-file ./instruction.md
multica issue wakeup create <issue> --until-issue <other-issue-id> --until-issue-state done --instruction-file ./instruction.md
@@ -384,7 +383,6 @@ multica issue wakeup create <issue> --until-issue <other-issue-id> --until-issue
- `--until-status KEY` — this issue's status is that key (built-in or one of the workspace's statuses).
- `--until-pr checks` — a linked pull request's checks finished, passing or failing, on its current head. `--until-pr merged` — a linked pull request merged. `--until-pr conflicts` — an open linked GitHub pull request has merge conflicts on its current head, for example after another PR merged into its base; with `--mode continuous` it fires again each time a resolved conflict comes back or a new head is still conflicting. With several linked pull requests, any one satisfies it. These conditions inspect only PRs linked directly to this issue; they do not inherit a parent issue's PRs. Checks and conflicts also require server-side GitHub snapshots; conflicts are not detected on Forgejo, Gitea or GitLab pull requests. A missing link or snapshot is recorded in the rule's `last_error` and retried automatically rather than rejecting the rule.
-- `--until-pr reviewed|approved|changes_requested` — a new human approval or request for changes on a directly linked GitHub PR; excludes bots, the PR author, and comment-only reviews. Requires snapshots. Existing reviews are ignored when registering or re-enabling; pushing a commit does not replay a review.
- `--until-children-done` — every sub-issue, staged or not, is closed (`done` or `cancelled`). With `--stage N` it waits only for staged sub-issues up to stage N, and stage N must have at least one. A parent with no sub-issues never fires. The parent's assignee already gets the sub-issue wakeup described under Stages in `references/sub-issues.md`; do not add this condition for the same wake.
- `--until-issue ISSUE` — another issue in this workspace (identifier or UUID) reaches `--until-issue-state`: `done` (default), `ended` (done or cancelled), `in_review`, or `blocked`.
- The same form also accepts `--until-assignee member|agent|squad:ID`, `--until-label LABEL_ID`, and `--until-property PROPERTY_ID=VALUE` (VALUE may be JSON). `multica issue wakeup create --help` lists them.
@@ -402,7 +400,7 @@ multica issue wakeup create <issue> --until-issue <other-issue-id> --until-issue
Read current state with issue get, comment list, and run inspection before
judging business completion. Wait for a linked pull request with `--until-pr`
-(`checks`, `merged`, `conflicts`, or `reviewed`) rather than polling it from a timer. There is no separate
+(`checks`, `merged` or `conflicts`) rather than polling it from a timer. There is no separate
CI event; when the woken run needs check details or logs, use the existing
GitHub tools. A failed run does not imply its business goal is complete.
Automatic retry chains are not followed by event filters; subscribe to a new run
diff --git a/server/internal/service/issue_wakeup_condition.go b/server/internal/service/issue_wakeup_condition.go
index ed35053fb2..b4f25c7986 100644
--- a/server/internal/service/issue_wakeup_condition.go
+++ b/server/internal/service/issue_wakeup_condition.go
@@ -47,7 +47,7 @@ type WakeupCondition struct {
// every stage closing while a later one waits, then every sub-issue
// closing. Only the platform sets it.
EachStage bool `json:"each_stage,omitempty"`
- // pull_request: checks_finished | merged | conflicts | reviewed | approved | changes_requested
+ // pull_request: checks_finished | merged | conflicts
Event string `json:"event,omitempty"`
// other_issue: the watched issue and done | ended | in_review | blocked. The
// identifier is recorded for display; clients never set it.
@@ -65,11 +65,10 @@ var (
errPRNotLinked = errors.New("No pull request is linked to this issue; link the PR to this issue (a parent issue's PR is not included), or wait for the linking webhook")
errPRSnapshotPending = errors.New("PR check snapshot is not available yet; inspect this issue's pull-requests snapshot_available field and ask the server administrator to check snapshot refresh if it persists")
errPRConflictsUnsupported = errors.New("Merge conflicts can only be detected on GitHub pull requests; this issue links only self-hosted (Forgejo/Gitea/GitLab) pull requests")
- errPRReviewsUnsupported = errors.New("PR reviews can only be detected on GitHub pull requests; this issue links only self-hosted (Forgejo/Gitea/GitLab) pull requests")
)
func conditionDiagnostic(err error) bool {
- return errors.Is(err, errPRSnapshotsUnavailable) || errors.Is(err, errPRNotLinked) || errors.Is(err, errPRSnapshotPending) || errors.Is(err, errPRConflictsUnsupported) || errors.Is(err, errPRReviewsUnsupported)
+ return errors.Is(err, errPRSnapshotsUnavailable) || errors.Is(err, errPRNotLinked) || errors.Is(err, errPRSnapshotPending) || errors.Is(err, errPRConflictsUnsupported)
}
func badCondition(msg string) error {
@@ -188,12 +187,10 @@ func validateCondition(ctx context.Context, tx pgx.Tx, issue db.Issue, raw json.
}
out = WakeupCondition{Type: c.Type, Stage: c.Stage}
case "pull_request":
- switch c.Event {
- case "checks_finished", "merged", "conflicts", "reviewed", "approved", "changes_requested":
- out = WakeupCondition{Type: c.Type, Event: c.Event}
- default:
- return nil, nil, badCondition("event must be checks_finished, merged, conflicts, reviewed, approved or changes_requested")
+ if c.Event != "checks_finished" && c.Event != "merged" && c.Event != "conflicts" {
+ return nil, nil, badCondition("event must be checks_finished, merged or conflicts")
}
+ out = WakeupCondition{Type: c.Type, Event: c.Event}
case "other_issue":
id, err := uuidArg(c.IssueID, "issue_id")
if err != nil {
@@ -263,9 +260,6 @@ func (s *IssueWakeupService) evaluateCondition(ctx context.Context, tx pgx.Tx, q
met, fingerprint, observed := childrenDone(c, children)
return met, fingerprint, observed, nil
case "pull_request":
- if isPRReviewEvent(c.Event) {
- return s.evaluatePRReviews(ctx, tx, w, c.Event)
- }
// Without the snapshot client GitHub rows are never refreshed, so their
// checks and mergeability neither satisfy nor stall the rule. Self-hosted VCS rows carry
// their own commit statuses and are evaluated regardless (#9034).
@@ -489,8 +483,8 @@ func (s *IssueWakeupService) pollCondition(ctx context.Context, tx pgx.Tx, q *db
if err != nil && !conditionDiagnostic(err) {
return w.NextFireAt, err
}
- if diagnosticErr := saveConditionDiagnostic(ctx, q, w, err); diagnosticErr != nil {
- return w.NextFireAt, diagnosticErr
+ if err = saveConditionDiagnostic(ctx, q, w, err); err != nil {
+ return w.NextFireAt, err
}
// condition_state dedups a satisfied predicate; each new satisfaction
// gets its own receipt key.
@@ -502,12 +496,6 @@ func (s *IssueWakeupService) pollCondition(ctx context.Context, tx pgx.Tx, q *db
}
}
state = fingerprint
- } else if isPRReviewCondition(w.Condition) {
- // Keep the registration boundary and seen review IDs through waits,
- // dismissals, unlink/relink, and temporary snapshot/config failures.
- if err == nil {
- state = fingerprint
- }
} else {
state = ""
}
@@ -546,31 +534,26 @@ func conditionNewlyMet(previous, current string) bool {
}
// conditionFiresOnChange reports whether facts already true at registration
-// are ignored. Checks and reviews wait for newer results; states such as a
+// are ignored. Finished checks usually belong to the head the agent just
+// replaced, so a checks condition waits for a newer result; states such as a
// status value, finished sub-issues or a merged PR fire as soon as they hold.
func conditionFiresOnChange(raw []byte) bool {
var c WakeupCondition
_ = json.Unmarshal(raw, &c)
- return c.Type == "pull_request" && (c.Event == "checks_finished" || c.Event == "reviewed" || c.Event == "approved" || c.Event == "changes_requested")
+ return c.Type == "pull_request" && c.Event == "checks_finished"
}
// baselineCondition records which facts already satisfy a new or re-enabled
// rule, so it wakes the agent when they change rather than immediately.
func (s *IssueWakeupService) baselineCondition(ctx context.Context, tx pgx.Tx, q *db.Queries, w db.IssueWakeup, now time.Time) error {
- reviewCondition := isPRReviewCondition(w.Condition)
- if reviewCondition {
- w.ConditionState = encodePRReviewState(prReviewState{Since: now})
- }
met, fingerprint, _, err := s.evaluateCondition(ctx, tx, q, w)
if err != nil && !conditionDiagnostic(err) {
return err
}
- if diagnosticErr := saveConditionDiagnostic(ctx, q, w, err); diagnosticErr != nil {
- return diagnosticErr
+ if err = saveConditionDiagnostic(ctx, q, w, err); err != nil {
+ return err
}
- if reviewCondition && err != nil {
- fingerprint = w.ConditionState
- } else if !met && !reviewCondition {
+ if !met {
fingerprint = ""
}
return q.SetWakeupConditionState(ctx, db.SetWakeupConditionStateParams{ID: w.ID, ConditionState: fingerprint, NextFireAt: pgtype.Timestamptz{Time: now.Add(conditionPollInterval), Valid: true}})
diff --git a/server/internal/service/issue_wakeup_condition_review.go b/server/internal/service/issue_wakeup_condition_review.go
deleted file mode 100644
index 3bacbd52c2..0000000000
--- a/server/internal/service/issue_wakeup_condition_review.go
+++ /dev/null
@@ -1,120 +0,0 @@
-package service
-
-import (
- "context"
- "encoding/json"
- "fmt"
- "sort"
- "strings"
- "time"
-
- "github.com/jackc/pgx/v5"
- "github.com/multica-ai/multica/server/internal/integrations/ghsnapshot"
- db "github.com/multica-ai/multica/server/pkg/db/generated"
-)
-
-func isPRReviewEvent(event string) bool {
- return event == "reviewed" || event == "approved" || event == "changes_requested"
-}
-
-func isPRReviewCondition(raw []byte) bool {
- var c WakeupCondition
- return json.Unmarshal(raw, &c) == nil && c.Type == "pull_request" && isPRReviewEvent(c.Event)
-}
-
-// Reviews are submissions, not head-dependent states or a merge-approval gate.
-// Keep seen IDs when a review disappears, so dismissals or relinking cannot
-// replay a decision. Since also excludes history if the first fetch is delayed.
-type prReviewState struct {
- Since time.Time `json:"since"`
- Seen []string `json:"seen,omitempty"`
-}
-
-func encodePRReviewState(state prReviewState) string {
- sort.Strings(state.Seen)
- raw, _ := json.Marshal(state)
- return string(raw)
-}
-
-func (s *IssueWakeupService) evaluatePRReviews(ctx context.Context, tx pgx.Tx, w db.IssueWakeup, event string) (bool, string, map[string]any, error) {
- state := prReviewState{Since: w.CreatedAt.Time}
- if w.ConditionState != "" {
- if err := json.Unmarshal([]byte(w.ConditionState), &state); err != nil {
- return false, "", nil, fmt.Errorf("read review condition state: %w", err)
- }
- }
- seen := make(map[string]bool, len(state.Seen))
- for _, key := range state.Seen {
- seen[key] = true
- }
- rows, err := tx.Query(ctx, `SELECT pr.id::text,pr.pr_number,pr.state,pr.review_snapshot,'github'
- FROM github_pull_request pr JOIN issue_pull_request ipr ON ipr.pull_request_id=pr.id
- WHERE ipr.issue_id=$1 AND pr.workspace_id=$2
- UNION ALL
- SELECT pr.id::text,pr.pr_number,pr.state,NULL::jsonb,pr.provider
- FROM vcs_pull_request pr JOIN issue_vcs_pull_request ipr ON ipr.pull_request_id=pr.id
- WHERE ipr.issue_id=$1 AND pr.workspace_id=$2`, w.IssueID, w.WorkspaceID)
- if err != nil {
- return false, "", nil, err
- }
- defer rows.Close()
- linked, vcsLinked, missingSnapshot := 0, 0, false
- available := s.Tasks != nil && s.Tasks.PRSnapshotsEnabled
- var observations []map[string]any
- for rows.Next() {
- var id, lifecycle, provider string
- var number int32
- var raw []byte
- if err := rows.Scan(&id, &number, &lifecycle, &raw, &provider); err != nil {
- return false, "", nil, err
- }
- if provider != "github" {
- vcsLinked++
- continue
- }
- linked++
- if !available || (lifecycle != "open" && lifecycle != "draft") {
- continue
- }
- if len(raw) == 0 {
- missingSnapshot = true
- continue
- }
- var reviews []ghsnapshot.PRReview
- if err := json.Unmarshal(raw, &reviews); err != nil || reviews == nil {
- return false, "", nil, fmt.Errorf("invalid review snapshot for PR %s", id)
- }
- for _, review := range reviews {
- if review.ID <= 0 || !review.SubmittedAt.After(state.Since) ||
- (review.State != "APPROVED" && review.State != "CHANGES_REQUESTED") ||
- (event != "reviewed" && !strings.EqualFold(review.State, event)) {
- continue
- }
- key := fmt.Sprintf("%s:%d", id, review.ID)
- if seen[key] {
- continue
- }
- seen[key] = true
- state.Seen = append(state.Seen, key)
- observations = append(observations, map[string]any{
- "number": number, "review_id": review.ID, "review": strings.ToLower(review.State), "submitted_at": review.SubmittedAt,
- })
- }
- }
- if err := rows.Err(); err != nil {
- return false, "", nil, err
- }
- if len(observations) == 0 {
- switch {
- case !available && (linked > 0 || vcsLinked == 0):
- return false, "", nil, errPRSnapshotsUnavailable
- case linked == 0 && vcsLinked == 0:
- return false, "", nil, errPRNotLinked
- case linked == 0:
- return false, "", nil, errPRReviewsUnsupported
- case missingSnapshot:
- return false, "", nil, errPRSnapshotPending
- }
- }
- return len(observations) > 0, encodePRReviewState(state), map[string]any{"pull_requests": observations}, nil
-}
diff --git a/server/internal/service/issue_wakeup_condition_review_test.go b/server/internal/service/issue_wakeup_condition_review_test.go
deleted file mode 100644
index 5aec0d4b4e..0000000000
--- a/server/internal/service/issue_wakeup_condition_review_test.go
+++ /dev/null
@@ -1,208 +0,0 @@
-package service
-
-import (
- "context"
- "encoding/json"
- "strings"
- "testing"
- "time"
-
- "github.com/jackc/pgx/v5/pgtype"
- "github.com/multica-ai/multica/server/internal/integrations/ghsnapshot"
- "github.com/multica-ai/multica/server/internal/testutil"
-)
-
-func reviewConditionPR(t *testing.T, f principalFixture, issue pgtype.UUID) string {
- t.Helper()
- pr := f.Insert(t, "github_pull_request", testutil.Cols{
- "workspace_id": f.WorkspaceID, "installation_id": 1, "repo_owner": "fixture", "repo_name": "reviews", "pr_number": 7,
- "title": "PR", "state": "open", "html_url": "https://example.test/pr/7", "head_sha": "a",
- "pr_created_at": "2026-01-01T00:00:00Z", "pr_updated_at": "2026-01-01T00:00:00Z",
- })
- f.Cleanup(t, "DELETE FROM issue_pull_request WHERE pull_request_id=$1", pr)
- f.Exec(t, "INSERT INTO issue_pull_request(issue_id,pull_request_id) VALUES($1,$2)", issue, pr)
- return pr
-}
-
-func writeReviewSnapshot(t *testing.T, f principalFixture, pr string, reviews ...ghsnapshot.PRReview) {
- t.Helper()
- if reviews == nil {
- reviews = []ghsnapshot.PRReview{}
- }
- raw, err := json.Marshal(reviews)
- if err != nil {
- t.Fatal(err)
- }
- f.Exec(t, "UPDATE github_pull_request SET review_snapshot=$2 WHERE id=$1", pr, raw)
-}
-
-func TestPRReviewConditionsWakeOnNewDecisions(t *testing.T) {
- for _, event := range []string{"reviewed", "approved", "changes_requested"} {
- t.Run(event, func(t *testing.T) {
- f, s, issue, agent := conditionFixture(t)
- s.Tasks.PRSnapshotsEnabled = true
- pr := reviewConditionPR(t, f, issue)
- old := ghsnapshot.PRReview{ID: 1, State: "APPROVED", SubmittedAt: time.Now().Add(-time.Hour)}
- writeReviewSnapshot(t, f, pr, old)
- w := wakeCreate(t, f, s, issue, WakeupInput{AgentID: agent, Kind: "event", Instruction: "Handle the review",
- Condition: condition(t, map[string]any{"type": "pull_request", "event": event})})
- wakeTick(t, f, s, w.ID)
- if n := wakeRuns(t, f, w.ID); n != 0 {
- t.Fatalf("replayed %d historical reviews", n)
- }
- decision := "APPROVED"
- if event == "changes_requested" {
- decision = "CHANGES_REQUESTED"
- }
- newReview := ghsnapshot.PRReview{ID: 2, State: decision, SubmittedAt: time.Now().Add(time.Second)}
- writeReviewSnapshot(t, f, pr, old, newReview)
- got := wakeTick(t, f, s, w.ID)
- if n := wakeRuns(t, f, w.ID); n != 1 || got.Enabled {
- t.Fatalf("new %s: runs=%d enabled=%t", event, n, got.Enabled)
- }
- task, err := f.q.GetAgentTask(context.Background(), got.LastTaskID)
- if err != nil || !strings.Contains(task.HandoffNote.String, `"review_id":2`) || !strings.Contains(task.HandoffNote.String, strings.ToLower(decision)) {
- t.Fatalf("review evidence missing: %s %v", task.HandoffNote.String, err)
- }
- })
- }
-}
-
-func TestPRReviewConditionsPreserveBaselineAndDeduplicate(t *testing.T) {
- f, s, issue, agent := conditionFixture(t)
- s.Tasks.PRSnapshotsEnabled = true
- pr := reviewConditionPR(t, f, issue)
- w := wakeCreate(t, f, s, issue, WakeupInput{AgentID: agent, Kind: "event", Mode: "continuous", Instruction: "Handle new approvals",
- Condition: condition(t, map[string]any{"type": "pull_request", "event": "approved"})})
- if !w.LastError.Valid || w.ConditionState == "" {
- t.Fatalf("missing snapshot lost baseline or diagnostic: %+v", w)
- }
- old := ghsnapshot.PRReview{ID: 1, State: "APPROVED", SubmittedAt: time.Now().Add(-time.Hour)}
- writeReviewSnapshot(t, f, pr, old)
- w = wakeTick(t, f, s, w.ID)
- if n := wakeRuns(t, f, w.ID); n != 0 || w.LastError.Valid {
- t.Fatalf("delayed first fetch replayed history or kept diagnostic: runs=%d error=%+v", n, w.LastError)
- }
- newReview := ghsnapshot.PRReview{ID: 2, State: "APPROVED", SubmittedAt: time.Now().Add(time.Second)}
- writeReviewSnapshot(t, f, pr, old, newReview)
- w = wakeTick(t, f, s, w.ID)
- if n := wakeRuns(t, f, w.ID); n != 1 {
- t.Fatalf("first approval: %d runs", n)
- }
- f.Exec(t, "UPDATE agent_task_queue SET status='completed',completed_at=now() WHERE id=$1", w.LastTaskID)
- // Duplicate delivery, push, dismissal, unlink/relink, and a temporary
- // snapshot failure must neither replay the same ID nor erase the baseline.
- wakeTick(t, f, s, w.ID)
- f.Exec(t, "UPDATE github_pull_request SET head_sha='b' WHERE id=$1", pr)
- wakeTick(t, f, s, w.ID)
- writeReviewSnapshot(t, f, pr)
- wakeTick(t, f, s, w.ID)
- f.Exec(t, "DELETE FROM issue_pull_request WHERE issue_id=$1 AND pull_request_id=$2", issue, pr)
- wakeTick(t, f, s, w.ID)
- f.Exec(t, "INSERT INTO issue_pull_request(issue_id,pull_request_id) VALUES($1,$2)", issue, pr)
- f.Exec(t, "UPDATE github_pull_request SET review_snapshot=NULL WHERE id=$1", pr)
- wakeTick(t, f, s, w.ID)
- writeReviewSnapshot(t, f, pr, old, newReview)
- wakeTick(t, f, s, w.ID)
- if n := wakeRuns(t, f, w.ID); n != 1 {
- t.Fatalf("same review replayed: %d runs", n)
- }
- // A different review on the unchanged head is new work.
- nextReview := ghsnapshot.PRReview{ID: 3, State: "APPROVED", SubmittedAt: newReview.SubmittedAt.Add(time.Second)}
- writeReviewSnapshot(t, f, pr, old, newReview, nextReview)
- wakeTick(t, f, s, w.ID)
- if n := wakeRuns(t, f, w.ID); n != 2 {
- t.Fatalf("second approval on same head: %d runs", n)
- }
-}
-
-func TestPRReviewConditionsIgnoreOtherStatesAndClosedPRs(t *testing.T) {
- f, s, issue, agent := conditionFixture(t)
- s.Tasks.PRSnapshotsEnabled = true
- pr := reviewConditionPR(t, f, issue)
- writeReviewSnapshot(t, f, pr)
- w := wakeCreate(t, f, s, issue, WakeupInput{AgentID: agent, Kind: "event", Instruction: "Handle approvals",
- Condition: condition(t, map[string]any{"type": "pull_request", "event": "approved"})})
- for _, state := range []string{"COMMENTED", "PENDING", "DISMISSED", "CHANGES_REQUESTED"} {
- writeReviewSnapshot(t, f, pr, ghsnapshot.PRReview{ID: 2, State: state, SubmittedAt: time.Now().Add(time.Second)})
- wakeTick(t, f, s, w.ID)
- }
- f.Exec(t, "UPDATE github_pull_request SET state='closed' WHERE id=$1", pr)
- writeReviewSnapshot(t, f, pr, ghsnapshot.PRReview{ID: 2, State: "APPROVED", SubmittedAt: time.Now().Add(time.Second)})
- wakeTick(t, f, s, w.ID)
- if n := wakeRuns(t, f, w.ID); n != 0 {
- t.Fatalf("irrelevant or closed review started %d runs", n)
- }
-}
-
-func TestPRReviewReenableDoesNotReplayReviews(t *testing.T) {
- f, s, issue, agent := conditionFixture(t)
- s.Tasks.PRSnapshotsEnabled = true
- pr := reviewConditionPR(t, f, issue)
- writeReviewSnapshot(t, f, pr)
- w := wakeCreate(t, f, s, issue, WakeupInput{AgentID: agent, Kind: "event", Instruction: "Handle reviews",
- Condition: condition(t, map[string]any{"type": "pull_request", "event": "reviewed"})})
- member := parseTestUUID(t, f.UserID)
- if _, err := s.Disable(context.Background(), issue, w.ID, member); err != nil {
- t.Fatal(err)
- }
- writeReviewSnapshot(t, f, pr, ghsnapshot.PRReview{ID: 1, State: "APPROVED", SubmittedAt: time.Now().Add(-time.Second)})
- if _, err := s.Enable(context.Background(), issue, member, pgtype.UUID{}, w.ID, WakeupEnableInput{Revision: w.Revision}); err != nil {
- t.Fatal(err)
- }
- wakeTick(t, f, s, w.ID)
- if n := wakeRuns(t, f, w.ID); n != 0 {
- t.Fatalf("re-enable replayed %d reviews", n)
- }
-}
-
-func TestPRReviewConditionDiagnosticsRecover(t *testing.T) {
- for _, event := range []string{"reviewed", "approved", "changes_requested"} {
- t.Run(event, func(t *testing.T) {
- f, s, issue, agent := conditionFixture(t)
- s.Tasks.PRSnapshotsEnabled = false
- w := wakeCreate(t, f, s, issue, WakeupInput{AgentID: agent, Kind: "event", Instruction: "Handle review",
- Condition: condition(t, map[string]any{"type": "pull_request", "event": event})})
- if w.LastError.String != conditionDiagnosticPrefix+errPRSnapshotsUnavailable.Error() {
- t.Fatalf("missing configuration: %+v", w.LastError)
- }
- s.Tasks.PRSnapshotsEnabled = true
- w = wakeTick(t, f, s, w.ID)
- if w.LastError.String != conditionDiagnosticPrefix+errPRNotLinked.Error() {
- t.Fatalf("missing link: %+v", w.LastError)
- }
- linkVCSPR(t, f, issue, newConnection(t, f), "forgejo", 7, "a")
- w = wakeTick(t, f, s, w.ID)
- if w.LastError.String != conditionDiagnosticPrefix+errPRReviewsUnsupported.Error() {
- t.Fatalf("unsupported provider: %+v", w.LastError)
- }
- pr := reviewConditionPR(t, f, issue)
- w = wakeTick(t, f, s, w.ID)
- if w.LastError.String != conditionDiagnosticPrefix+errPRSnapshotPending.Error() {
- t.Fatalf("missing snapshot: %+v", w.LastError)
- }
- writeReviewSnapshot(t, f, pr)
- w = wakeTick(t, f, s, w.ID)
- if w.LastError.Valid || w.ConditionState == "" {
- t.Fatalf("recovery kept diagnostic or lost baseline: %+v", w)
- }
- })
- }
-}
-
-func TestPRReviewConditionsDoNotReadAnotherWorkspace(t *testing.T) {
- f, s, issue, agent := conditionFixture(t)
- s.Tasks.PRSnapshotsEnabled = true
- pr := reviewConditionPR(t, f, issue)
- w := wakeCreate(t, f, s, issue, WakeupInput{AgentID: agent, Kind: "event", Instruction: "Handle reviews",
- Condition: condition(t, map[string]any{"type": "pull_request", "event": "reviewed"})})
- // Even a corrupt cross-workspace link cannot supply a review fact.
- other, _ := newPrincipalFixture(t)
- f.Cleanup(t, "UPDATE github_pull_request SET workspace_id=$2 WHERE id=$1", pr, f.WorkspaceID)
- f.Exec(t, "UPDATE github_pull_request SET workspace_id=$2 WHERE id=$1", pr, other.WorkspaceID)
- writeReviewSnapshot(t, f, pr, ghsnapshot.PRReview{ID: 1, State: "APPROVED", SubmittedAt: time.Now().Add(time.Second)})
- wakeTick(t, f, s, w.ID)
- if n := wakeRuns(t, f, w.ID); n != 0 {
- t.Fatalf("foreign PR started %d runs", n)
- }
-}
diff --git a/server/migrations/609_github_pr_review_snapshot.down.sql b/server/migrations/609_github_pr_review_snapshot.down.sql
deleted file mode 100644
index 223aa2b01f..0000000000
--- a/server/migrations/609_github_pr_review_snapshot.down.sql
+++ /dev/null
@@ -1 +0,0 @@
-ALTER TABLE github_pull_request DROP COLUMN IF EXISTS review_snapshot;
diff --git a/server/migrations/609_github_pr_review_snapshot.up.sql b/server/migrations/609_github_pr_review_snapshot.up.sql
deleted file mode 100644
index bb67a8d4d3..0000000000
--- a/server/migrations/609_github_pr_review_snapshot.up.sql
+++ /dev/null
@@ -1,3 +0,0 @@
--- NULL means reviews have not been fetched; [] means a complete empty result.
--- Additive and nullable so older servers can keep reading and writing PRs.
-ALTER TABLE github_pull_request ADD COLUMN IF NOT EXISTS review_snapshot JSONB;
diff --git a/server/pkg/db/generated/github.sql.go b/server/pkg/db/generated/github.sql.go
index e4cfed6f19..68c70c4672 100644
--- a/server/pkg/db/generated/github.sql.go
+++ b/server/pkg/db/generated/github.sql.go
@@ -116,7 +116,7 @@ func (q *Queries) DeletePendingGitHubInstallation(ctx context.Context, installat
}
const findGitHubPullRequestByURL = `-- name: FindGitHubPullRequestByURL :one
-SELECT id, workspace_id, installation_id, repo_owner, repo_name, pr_number, title, state, html_url, branch, author_login, author_avatar_url, merged_at, closed_at, pr_created_at, pr_updated_at, created_at, updated_at, head_sha, mergeable_state, additions, deletions, changed_files, api_mergeable, api_merge_state_status, checks_rollup_state, snapshot_head_sha, snapshot_fetched_at, review_snapshot FROM github_pull_request
+SELECT id, workspace_id, installation_id, repo_owner, repo_name, pr_number, title, state, html_url, branch, author_login, author_avatar_url, merged_at, closed_at, pr_created_at, pr_updated_at, created_at, updated_at, head_sha, mergeable_state, additions, deletions, changed_files, api_mergeable, api_merge_state_status, checks_rollup_state, snapshot_head_sha, snapshot_fetched_at FROM github_pull_request
WHERE workspace_id = $1
AND lower(rtrim(html_url, '/')) = lower($2::text)
ORDER BY pr_updated_at DESC
@@ -162,7 +162,6 @@ func (q *Queries) FindGitHubPullRequestByURL(ctx context.Context, arg FindGitHub
&i.ChecksRollupState,
&i.SnapshotHeadSha,
&i.SnapshotFetchedAt,
- &i.ReviewSnapshot,
)
return i, err
}
@@ -190,7 +189,7 @@ func (q *Queries) GetGitHubInstallationByID(ctx context.Context, id pgtype.UUID)
}
const getGitHubPullRequest = `-- name: GetGitHubPullRequest :one
-SELECT id, workspace_id, installation_id, repo_owner, repo_name, pr_number, title, state, html_url, branch, author_login, author_avatar_url, merged_at, closed_at, pr_created_at, pr_updated_at, created_at, updated_at, head_sha, mergeable_state, additions, deletions, changed_files, api_mergeable, api_merge_state_status, checks_rollup_state, snapshot_head_sha, snapshot_fetched_at, review_snapshot FROM github_pull_request
+SELECT id, workspace_id, installation_id, repo_owner, repo_name, pr_number, title, state, html_url, branch, author_login, author_avatar_url, merged_at, closed_at, pr_created_at, pr_updated_at, created_at, updated_at, head_sha, mergeable_state, additions, deletions, changed_files, api_mergeable, api_merge_state_status, checks_rollup_state, snapshot_head_sha, snapshot_fetched_at FROM github_pull_request
WHERE workspace_id = $1 AND repo_owner = $2 AND repo_name = $3 AND pr_number = $4
`
@@ -238,13 +237,12 @@ func (q *Queries) GetGitHubPullRequest(ctx context.Context, arg GetGitHubPullReq
&i.ChecksRollupState,
&i.SnapshotHeadSha,
&i.SnapshotFetchedAt,
- &i.ReviewSnapshot,
)
return i, err
}
const getGitHubPullRequestInWorkspace = `-- name: GetGitHubPullRequestInWorkspace :one
-SELECT id, workspace_id, installation_id, repo_owner, repo_name, pr_number, title, state, html_url, branch, author_login, author_avatar_url, merged_at, closed_at, pr_created_at, pr_updated_at, created_at, updated_at, head_sha, mergeable_state, additions, deletions, changed_files, api_mergeable, api_merge_state_status, checks_rollup_state, snapshot_head_sha, snapshot_fetched_at, review_snapshot FROM github_pull_request
+SELECT id, workspace_id, installation_id, repo_owner, repo_name, pr_number, title, state, html_url, branch, author_login, author_avatar_url, merged_at, closed_at, pr_created_at, pr_updated_at, created_at, updated_at, head_sha, mergeable_state, additions, deletions, changed_files, api_mergeable, api_merge_state_status, checks_rollup_state, snapshot_head_sha, snapshot_fetched_at FROM github_pull_request
WHERE id = $1 AND workspace_id = $2
`
@@ -285,7 +283,6 @@ func (q *Queries) GetGitHubPullRequestInWorkspace(ctx context.Context, arg GetGi
&i.ChecksRollupState,
&i.SnapshotHeadSha,
&i.SnapshotFetchedAt,
- &i.ReviewSnapshot,
)
return i, err
}
@@ -799,7 +796,7 @@ ON CONFLICT (workspace_id, repo_owner, repo_name, pr_number) DO UPDATE SET
changed_files = EXCLUDED.changed_files,
updated_at = now()
WHERE EXCLUDED.pr_updated_at >= github_pull_request.pr_updated_at
-RETURNING id, workspace_id, installation_id, repo_owner, repo_name, pr_number, title, state, html_url, branch, author_login, author_avatar_url, merged_at, closed_at, pr_created_at, pr_updated_at, created_at, updated_at, head_sha, mergeable_state, additions, deletions, changed_files, api_mergeable, api_merge_state_status, checks_rollup_state, snapshot_head_sha, snapshot_fetched_at, review_snapshot
+RETURNING id, workspace_id, installation_id, repo_owner, repo_name, pr_number, title, state, html_url, branch, author_login, author_avatar_url, merged_at, closed_at, pr_created_at, pr_updated_at, created_at, updated_at, head_sha, mergeable_state, additions, deletions, changed_files, api_mergeable, api_merge_state_status, checks_rollup_state, snapshot_head_sha, snapshot_fetched_at
`
type UpsertGitHubPullRequestParams struct {
@@ -897,7 +894,6 @@ func (q *Queries) UpsertGitHubPullRequest(ctx context.Context, arg UpsertGitHubP
&i.ChecksRollupState,
&i.SnapshotHeadSha,
&i.SnapshotFetchedAt,
- &i.ReviewSnapshot,
)
return i, err
}
diff --git a/server/pkg/db/generated/github_snapshot.sql.go b/server/pkg/db/generated/github_snapshot.sql.go
index 7387bc2748..bfd9d118bd 100644
--- a/server/pkg/db/generated/github_snapshot.sql.go
+++ b/server/pkg/db/generated/github_snapshot.sql.go
@@ -23,7 +23,7 @@ func (q *Queries) DeleteGitHubPRCheckRuns(ctx context.Context, prID pgtype.UUID)
}
const getGitHubPullRequestByID = `-- name: GetGitHubPullRequestByID :one
-SELECT id, workspace_id, installation_id, repo_owner, repo_name, pr_number, title, state, html_url, branch, author_login, author_avatar_url, merged_at, closed_at, pr_created_at, pr_updated_at, created_at, updated_at, head_sha, mergeable_state, additions, deletions, changed_files, api_mergeable, api_merge_state_status, checks_rollup_state, snapshot_head_sha, snapshot_fetched_at, review_snapshot FROM github_pull_request WHERE id = $1
+SELECT id, workspace_id, installation_id, repo_owner, repo_name, pr_number, title, state, html_url, branch, author_login, author_avatar_url, merged_at, closed_at, pr_created_at, pr_updated_at, created_at, updated_at, head_sha, mergeable_state, additions, deletions, changed_files, api_mergeable, api_merge_state_status, checks_rollup_state, snapshot_head_sha, snapshot_fetched_at FROM github_pull_request WHERE id = $1
`
func (q *Queries) GetGitHubPullRequestByID(ctx context.Context, id pgtype.UUID) (GithubPullRequest, error) {
@@ -58,7 +58,6 @@ func (q *Queries) GetGitHubPullRequestByID(ctx context.Context, id pgtype.UUID)
&i.ChecksRollupState,
&i.SnapshotHeadSha,
&i.SnapshotFetchedAt,
- &i.ReviewSnapshot,
)
return i, err
}
@@ -211,7 +210,7 @@ type ListGitHubPRRowsByAddressRow struct {
// =====================
// GitHub API snapshot (MUL-5265, Plan C)
//
-// These queries back the API-snapshot refresh pipeline. The GitHub API
+// These queries back the API-snapshot refresh pipeline. The GitHub GraphQL
// response is the single source of truth; each successful fetch is written as
// one atomic batch replace (guarded update of the PR row + full replace of the
// per-check rows) inside a single transaction.
@@ -262,7 +261,7 @@ WITH candidates AS (
JOIN issue_pull_request AS ipr ON ipr.issue_id = w.issue_id
WHERE w.enabled
AND w.condition->>'type' = 'pull_request'
- AND w.condition->>'event' IN ('conflicts', 'reviewed', 'approved', 'changes_requested')
+ AND w.condition->>'event' = 'conflicts'
)
GROUP BY pr.installation_id, pr.repo_owner, pr.repo_name, pr.pr_number
)
@@ -297,8 +296,8 @@ type ListStaleConflictWatchedGitHubPRsRow struct {
PrNumber int32 `json:"pr_number"`
}
-// Second sweep source: open/draft PRs linked to an enabled conflict or review
-// condition. A decided snapshot leaves the undecided sweep,
+// Second sweep source: open/draft PRs linked to an issue with an enabled
+// "wake on merge conflict" rule. A decided snapshot leaves the undecided sweep,
// but a base-branch move can turn it conflicting without any event for this
// PR, so watched PRs are re-fetched on the TTL regardless. The candidate set
// comes from the enabled rules, whose count is capped. Like the undecided
@@ -429,18 +428,16 @@ UPDATE github_pull_request
SET api_mergeable = $1,
api_merge_state_status = $2,
checks_rollup_state = $3,
- review_snapshot = $4,
- snapshot_head_sha = $5,
- snapshot_fetched_at = $6,
+ snapshot_head_sha = $4,
+ snapshot_fetched_at = $5,
updated_at = now()
-WHERE id = $7 AND head_sha = $5
+WHERE id = $6 AND head_sha = $4
`
type UpdateGitHubPRSnapshotParams struct {
ApiMergeable pgtype.Text `json:"api_mergeable"`
ApiMergeStateStatus pgtype.Text `json:"api_merge_state_status"`
ChecksRollupState pgtype.Text `json:"checks_rollup_state"`
- ReviewSnapshot []byte `json:"review_snapshot"`
HeadSha string `json:"head_sha"`
FetchedAt pgtype.Timestamptz `json:"fetched_at"`
PrID pgtype.UUID `json:"pr_id"`
@@ -456,7 +453,6 @@ func (q *Queries) UpdateGitHubPRSnapshot(ctx context.Context, arg UpdateGitHubPR
arg.ApiMergeable,
arg.ApiMergeStateStatus,
arg.ChecksRollupState,
- arg.ReviewSnapshot,
arg.HeadSha,
arg.FetchedAt,
arg.PrID,
diff --git a/server/pkg/db/generated/models.go b/server/pkg/db/generated/models.go
index b8bee7928d..6ef60f450a 100644
--- a/server/pkg/db/generated/models.go
+++ b/server/pkg/db/generated/models.go
@@ -782,7 +782,6 @@ type GithubPullRequest struct {
ChecksRollupState pgtype.Text `json:"checks_rollup_state"`
SnapshotHeadSha string `json:"snapshot_head_sha"`
SnapshotFetchedAt pgtype.Timestamptz `json:"snapshot_fetched_at"`
- ReviewSnapshot []byte `json:"review_snapshot"`
}
type GithubPullRequestCheckRun struct {
diff --git a/server/pkg/db/queries/github_snapshot.sql b/server/pkg/db/queries/github_snapshot.sql
index 685d9dd23b..94779e92a0 100644
--- a/server/pkg/db/queries/github_snapshot.sql
+++ b/server/pkg/db/queries/github_snapshot.sql
@@ -1,7 +1,7 @@
-- =====================
-- GitHub API snapshot (MUL-5265, Plan C)
--
--- These queries back the API-snapshot refresh pipeline. The GitHub API
+-- These queries back the API-snapshot refresh pipeline. The GitHub GraphQL
-- response is the single source of truth; each successful fetch is written as
-- one atomic batch replace (guarded update of the PR row + full replace of the
-- per-check rows) inside a single transaction.
@@ -26,7 +26,6 @@ UPDATE github_pull_request
SET api_mergeable = sqlc.narg('api_mergeable'),
api_merge_state_status = sqlc.narg('api_merge_state_status'),
checks_rollup_state = sqlc.narg('checks_rollup_state'),
- review_snapshot = sqlc.narg('review_snapshot'),
snapshot_head_sha = sqlc.arg('head_sha'),
snapshot_fetched_at = sqlc.arg('fetched_at'),
updated_at = now()
@@ -84,8 +83,8 @@ installation_id, repo_owner, repo_name, pr_number
LIMIT sqlc.arg('max_rows');
-- name: ListStaleConflictWatchedGitHubPRs :many
--- Second sweep source: open/draft PRs linked to an enabled conflict or review
--- condition. A decided snapshot leaves the undecided sweep,
+-- Second sweep source: open/draft PRs linked to an issue with an enabled
+-- "wake on merge conflict" rule. A decided snapshot leaves the undecided sweep,
-- but a base-branch move can turn it conflicting without any event for this
-- PR, so watched PRs are re-fetched on the TTL regardless. The candidate set
-- comes from the enabled rules, whose count is capped. Like the undecided
@@ -102,7 +101,7 @@ WITH candidates AS (
JOIN issue_pull_request AS ipr ON ipr.issue_id = w.issue_id
WHERE w.enabled
AND w.condition->>'type' = 'pull_request'
- AND w.condition->>'event' IN ('conflicts', 'reviewed', 'approved', 'changes_requested')
+ AND w.condition->>'event' = 'conflicts'
)
GROUP BY pr.installation_id, pr.repo_owner, pr.repo_name, pr.pr_number
)