Skip to content

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

Go

feat(inbox): default auto-archive to completing or triggering an agent (MUL-9820) (#11166)

Jiayuan Zhangbe6c62540616
diff --git a/apps/docs/content/docs/inbox.fr.mdx b/apps/docs/content/docs/inbox.fr.mdx
index 01c559bd82..24daeec4af 100644
--- a/apps/docs/content/docs/inbox.fr.mdx
+++ b/apps/docs/content/docs/inbox.fr.mdx
@@ -133,7 +133,7 @@ Lire une notification ne la retire pas. Une ligne quitte la boîte de réception
- quand vous l'archivez, depuis sa ligne, la carte de survol, la barre de la boîte de réception ou une action groupée ;
- quand vous reportez sa tâche. C'est temporaire : la tâche revient à l'heure choisie, ou plus tôt si quelque chose a besoin de vous. Voir « Reporter une tâche » ci-dessus ;
-- quand vous traitez vous-même sa tâche, selon le réglage **Archiver les tâches que vous traitez** dans **Paramètres → Notifications**. Le choix par défaut, **Après une réponse, une avancée de statut ou une réattribution**, compte un commentaire, le passage de la tâche à un statut des catégories `started`, `done` ou `closed`, et un changement d'assigné. La passer à `backlog`, `todo` ou un autre statut `unstarted`, réouverture comprise, relève du tri et n'archive rien : vous pouvez trier une tâche puis l'assigner. **Quand vous la terminez** ne compte que `done` et `closed`, **Jamais** désactive l'archivage automatique, et **Personnalisé** choisit les actions une à une, y compris les changements de priorité, de projet, de dates ou de libellés, désactivés par défaut. Seules vos propres notifications sur cette tâche sont archivées, lues ou non. Quand quelqu'un d'autre ou un agent fait de même, ses notifications restent dans votre boîte de réception, pour que vous voyiez la nouvelle ;
+- quand vous traitez vous-même sa tâche, selon le réglage **Archiver les tâches que vous traitez** dans **Paramètres → Notifications**. Le choix par défaut, **Quand vous la terminez ou déclenchez un agent**, compte le passage de la tâche à un statut `done` ou `closed`, ainsi que toute action qui confie réellement du travail à un agent : un commentaire, une action rapide ou un message en cours d'exécution ; l'assignation à un agent ou une escouade hors `backlog` ; la sortie du `backlog` (y compris vers `todo`) d'une tâche assignée à un agent ou une escouade ; l'entrée dans une colonne de flux dotée d'un agent ; une relance ; ou le déclenchement manuel d'un réveil. Organiser la tâche sans réveiller d'agent — passer une tâche non assignée de `backlog` à `todo`, assigner un agent dans `backlog`, retirer l'assigné, poster un commentaire `/note`, désactiver le déclenchement ou rencontrer un environnement bloqué — laisse la notification en place. **Quand vous la terminez** ne compte que `done` et `closed`, **Jamais** désactive l'archivage automatique, et **Personnalisé** choisit les actions une à une, y compris répondre, faire avancer le statut, réassigner ou changer la priorité, le projet, les dates ou les libellés, désactivés par défaut. Seules vos propres notifications sur cette tâche sont archivées, lues ou non. Quand quelqu'un d'autre ou un agent fait de même, ses notifications restent dans votre boîte de réception, pour que vous voyiez la nouvelle ;
- quand c'est une notification **Exécution en échec** et que sa tâche passe à un statut qui la rend à une personne : `in_review`, un statut personnalisé de la catégorie `started`, ou n'importe quel statut des catégories `done` ou `closed`. Les notifications Exécution en échec de tout le monde sur cette tâche sont alors archivées, quelle que soit la personne qui a changé le statut, et indépendamment du réglage ci-dessus. `blocked` fait exception : il rend aussi la tâche, mais le travail reste bloqué, donc les échecs précédents méritent encore d'être lus.
- quand votre boîte de réception dans l'espace de travail dépasse 2 000 notifications. Elle garde les 2 000 plus récentes et archive peu après les plus anciennes, lues ou non. Une notification revenue d'un report ou restaurée depuis l'archive compte à partir de son retour. Les notifications d'une tâche reportée ne comptent pas et restent en place.
@@ -143,7 +143,7 @@ Quand vous retirez vous-même la ligne ouverte, depuis la barre de la boîte de
Une notification ultérieure sur la tâche revient dans la boîte de réception.
-**Paramètres → Notifications → Sortir de la boîte de réception** contient **Archiver les tâches que vous traitez** (**Jamais**, **Quand vous la terminez**, **Après une réponse, une avancée de statut ou une réattribution** ou **Personnalisé**), **Après l'archivage** (**Rester sur la tâche** ou **Ouvrir la suivante**) et un lien vers les notifications archivées.
+**Paramètres → Notifications → Sortir de la boîte de réception** contient **Archiver les tâches que vous traitez** (**Jamais**, **Quand vous la terminez**, **Quand vous la terminez ou déclenchez un agent** ou **Personnalisé**), **Après l'archivage** (**Rester sur la tâche** ou **Ouvrir la suivante**) et un lien vers les notifications archivées.
## Affichage et types de notification
diff --git a/apps/docs/content/docs/inbox.ja.mdx b/apps/docs/content/docs/inbox.ja.mdx
index 7efe8e1076..c6911094b5 100644
--- a/apps/docs/content/docs/inbox.ja.mdx
+++ b/apps/docs/content/docs/inbox.ja.mdx
@@ -133,7 +133,7 @@ multica inbox snooze <id>... --until tomorrow # RFC 3339、30m、3h、1d、1w
- 行、ホバーカード、インボックスバー、または一括操作から、あなたがアーカイブしたとき
- タスクをスヌーズしたとき。これは一時的で、指定した時間になるか、対応が必要な通知が届くと戻ります。上の「タスクをスヌーズする」を参照してください。
-- あなた自身がタスクに対応したとき。何を対応とみなすかは **設定 → 通知** の **自分が対応したタスクをアーカイブ** で決まります。既定の **返信・ステータス前進・担当変更の後** では、コメント、タスクを `started`・`done`・`closed` カテゴリのステータスにすること、担当者の変更が対象です。`backlog`・`todo` などの `unstarted` ステータスへの変更(完了したタスクを戻す場合も含む)は整理とみなされアーカイブされないので、整理してから担当者を決められます。**完了したとき** は `done` と `closed` だけ、**しない** で自動アーカイブはオフ、**カスタム** では操作を 1 つずつ選べ、既定では対象外の優先度・プロジェクト・日付・ラベルの変更も選べます。アーカイブされるのは、そのタスクに届いたあなた自身の通知だけで、既読かどうかは問いません。ほかの人やエージェントが同じ操作をした場合、その通知はあなたのインボックスに残るので、変化を見逃しません。
+- あなた自身がタスクに対応したとき。何を対応とみなすかは **設定 → 通知** の **自分が対応したタスクをアーカイブ** で決まります。既定の **完了またはエージェントを起動したとき** では、タスクを `done`・`closed` カテゴリのステータスにすることと、実際にエージェントへ作業を渡す操作(エージェントを起動するコメント・クイックアクション・実行中への追記、`backlog` 以外でのエージェントやスクワッドへの割り当て、エージェントやスクワッド担当タスクの `backlog` からの昇格、`todo` を含む、エージェント担当のワークフロー列への移動、再実行、手動ウェイクアップ)が対象です。エージェントを起こさない整理(未割り当ての `backlog` → `todo`、`backlog` での事前割り当て、割り当て解除、`/note` コメント、トリガー抑止、ランタイム不可によるブロックなど)はアーカイブされません。**完了したとき** は `done` と `closed` だけ、**しない** で自動アーカイブはオフ、**カスタム** では操作を 1 つずつ選べ、既定では対象外の返信・ステータス前進・担当者変更・優先度・プロジェクト・日付・ラベルの変更も選べます。アーカイブされるのは、そのタスクに届いたあなた自身の通知だけで、既読かどうかは問いません。ほかの人やエージェントが同じ操作をした場合、その通知はあなたのインボックスに残るので、変化を見逃しません。
- 「実行失敗」の通知で、タスクが人に引き継がれるステータスになったとき。対象は `in_review`、`started` カテゴリのカスタムステータス、`done`・`closed` カテゴリのすべてのステータスです。誰がステータスを変えたかにかかわらず、そのタスクの全員分の「実行失敗」の通知がアーカイブされ、上の設定には左右されません。`blocked` は例外です。人に引き継がれはしますが作業は止まったままなので、それまでの失敗の記録はまだ確認する必要があります。
- そのワークスペースのインボックスが 2,000 件を超えたとき。新しい 2,000 件を残し、それより古い通知は既読かどうかにかかわらず、少し後に自動でアーカイブされます。スヌーズから戻った通知やアーカイブから戻した通知は、戻った時点の新しさで数えます。スヌーズ中のタスクの通知は数えず、そのまま残ります。
@@ -143,7 +143,7 @@ multica inbox snooze <id>... --until tomorrow # RFC 3339、30m、3h、1d、1w
その後に届いた通知は、再びインボックスに入ります。
-**設定 → 通知 → インボックスから外れるとき** には、**自分が対応したタスクをアーカイブ**(**しない**、**完了したとき**、**返信・ステータス前進・担当変更の後**、**カスタム**)と **アーカイブ後**(**このタスクに留まる** または **次の通知を開く**)、アーカイブ済みの通知へのリンクがあります。
+**設定 → 通知 → インボックスから外れるとき** には、**自分が対応したタスクをアーカイブ**(**しない**、**完了したとき**、**完了またはエージェントを起動したとき**、**カスタム**)と **アーカイブ後**(**このタスクに留まる** または **次の通知を開く**)、アーカイブ済みの通知へのリンクがあります。
## 表示と通知タイプ
diff --git a/apps/docs/content/docs/inbox.ko.mdx b/apps/docs/content/docs/inbox.ko.mdx
index 5312ea16cc..5cbb3eaa4e 100644
--- a/apps/docs/content/docs/inbox.ko.mdx
+++ b/apps/docs/content/docs/inbox.ko.mdx
@@ -133,7 +133,7 @@ multica inbox snooze <id>... --until tomorrow # RFC 3339, 30m, 3h, 1d, 1w; uns
- 행, 마우스 오버 카드, 인박스 바, 일괄 작업에서 직접 보관할 때
- 태스크를 미룰 때. 이 경우는 일시적이며, 지정한 시간이 되거나 내가 처리해야 할 알림이 오면 다시 돌아옵니다. 위의 '태스크 미루기'를 참고하세요.
-- 내가 직접 태스크를 처리했을 때. 무엇을 처리로 볼지는 **설정 → 알림**의 **내가 처리한 태스크 보관**이 정합니다. 기본값인 **답글, 상태 진행, 담당자 변경 후**는 댓글, 태스크를 `started`·`done`·`closed` 카테고리의 상태로 바꾸는 것, 담당자 변경을 포함합니다. `backlog`, `todo` 같은 `unstarted` 상태로 바꾸는 것(완료한 태스크를 다시 여는 경우 포함)은 정리로 보고 보관하지 않으므로, 먼저 정리한 뒤 담당자를 지정할 수 있습니다. **완료했을 때**는 `done`과 `closed`만, **안 함**은 자동 보관을 끄고, **사용자 지정**은 동작을 하나씩 고르며 기본으로는 꺼져 있는 우선순위·프로젝트·날짜·라벨 변경도 고를 수 있습니다. 그 태스크에 온 내 알림만 읽음 여부와 관계없이 보관됩니다. 다른 사람이나 에이전트가 같은 동작을 하면 그 알림은 내 인박스에 남으므로 변화를 놓치지 않습니다.
+- 내가 직접 태스크를 처리했을 때. 무엇을 처리로 볼지는 **설정 → 알림**의 **내가 처리한 태스크 보관**이 정합니다. 기본값인 **완료하거나 에이전트를 실행했을 때**는 태스크를 `done`·`closed` 카테고리의 상태로 바꾸는 것과 실제로 에이전트에게 작업을 넘기는 동작(에이전트를 깨우는 댓글·퀵 액션·실행 중 개입, `backlog`이 아닌 상태에서 에이전트나 스쿼드 지정, 에이전트·스쿼드가 지정된 태스크를 `backlog`에서 `todo` 등 활성 상태로 올리기, 에이전트 담당 워크플로 열로 이동, 재실행, 수동 웨이크업)을 포함합니다. 에이전트를 깨우지 않는 정리(미지정 태스크의 `backlog` → `todo`, `backlog`에서의 사전 지정, 지정 해제, `/note` 댓글, 트리거 해제, 런타임 차단 등)는 보관되지 않습니다. **완료했을 때**는 `done`과 `closed`만, **안 함**은 자동 보관을 끄고, **사용자 지정**은 동작을 하나씩 고르며 기본으로는 꺼져 있는 답글·상태 진행·담당자 변경·우선순위·프로젝트·날짜·라벨 변경도 고를 수 있습니다. 그 태스크에 온 내 알림만 읽음 여부와 관계없이 보관됩니다. 다른 사람이나 에이전트가 같은 동작을 하면 그 알림은 내 인박스에 남으므로 변화를 놓치지 않습니다.
- "실행 실패함" 알림이고, 태스크가 사람에게 넘어가는 상태가 될 때. 해당 상태는 `in_review`, `started` 카테고리의 사용자 지정 상태, `done`·`closed` 카테고리의 모든 상태입니다. 누가 상태를 바꿨는지와 관계없이 그 태스크의 모든 사람의 "실행 실패함" 알림이 보관되며, 위 설정의 영향을 받지 않습니다. `blocked`는 예외입니다. 사람에게 넘어가기는 하지만 작업이 여전히 막혀 있으므로 지난 실패 기록을 계속 확인해야 합니다.
- 그 워크스페이스의 인박스가 알림 2,000개를 넘을 때. 최신 2,000개를 남기고, 그보다 오래된 알림은 읽음 여부와 관계없이 잠시 후 자동으로 보관됩니다. 미루기에서 돌아온 알림과 보관함에서 복원한 알림은 돌아온 시점을 기준으로 셉니다. 미룬 태스크의 알림은 개수에 포함되지 않으며 그대로 남습니다.
@@ -143,7 +143,7 @@ multica inbox snooze <id>... --until tomorrow # RFC 3339, 30m, 3h, 1d, 1w; uns
이후 그 태스크에 새 알림이 오면 다시 인박스에 들어옵니다.
-**설정 → 알림 → 인박스에서 빠지는 경우**에 **내가 처리한 태스크 보관**(**안 함**, **완료했을 때**, **답글, 상태 진행, 담당자 변경 후**, **사용자 지정**)과 **보관한 뒤**(**이 태스크에 머무르기** 또는 **다음 알림 열기**), 보관된 알림으로 가는 링크가 있습니다.
+**설정 → 알림 → 인박스에서 빠지는 경우**에 **내가 처리한 태스크 보관**(**안 함**, **완료했을 때**, **완료하거나 에이전트를 실행했을 때**, **사용자 지정**)과 **보관한 뒤**(**이 태스크에 머무르기** 또는 **다음 알림 열기**), 보관된 알림으로 가는 링크가 있습니다.
## 표시와 알림 유형
diff --git a/apps/docs/content/docs/inbox.mdx b/apps/docs/content/docs/inbox.mdx
index 275864d16e..325329b5c0 100644
--- a/apps/docs/content/docs/inbox.mdx
+++ b/apps/docs/content/docs/inbox.mdx
@@ -133,7 +133,7 @@ Reading a notification doesn't remove it. A row leaves the inbox only when:
- you archive it, from its row, the hover card, the inbox bar, or a bulk action;
- you snooze its issue. This one is temporary: the issue comes back at the time you picked, or earlier when something needs you. See [Snooze an issue](#snooze-an-issue);
-- you handle its issue yourself, as **Archive issues you handle** in **Settings → Notifications** says. The default, **After you reply, move it forward or reassign**, counts commenting, moving the issue to a status in the `started`, `done` or `closed` category, and changing its assignee. Moving it to `backlog`, `todo` or another `unstarted` status, a reopened issue included, is triage and doesn't count, so you can triage an issue and then assign it. **When you complete it** counts only `done` and `closed`, **Never** turns this off, and **Custom** picks the actions one by one, including changing priority, project, dates or labels, which are off by default. Only your own notifications on that issue are archived, read or not. When someone else or an agent does the same, its notifications stay in your inbox, so you still see the news;
+- you handle its issue yourself, as **Archive issues you handle** in **Settings → Notifications** says. The default, **When you complete it or trigger an agent**, counts moving the issue to a `done` or `closed` status, and any action that actually hands work to an agent: commenting, running a quick action, or steering an active run; assigning an agent or squad on a non-`backlog` issue; promoting an agent- or squad-assigned issue out of `backlog` (including to `todo`); moving into a workflow step with an agent handler; rerunning a task; or manually firing a wakeup. Organizing an issue without waking an agent—such as moving an unassigned issue from `backlog` to `todo`, parking an agent assignment in `backlog`, unassigning, posting a `/note` comment, suppressing triggers, or hitting a blocked runtime—leaves the notification in your inbox. **When you complete it** counts only `done` and `closed`, **Never** turns this off, and **Custom** picks actions one by one, including replying, moving status forward, reassigning, or changing priority, project, dates or labels, which are off by default. Only your own notifications on that issue are archived, read or not. When someone else or an agent does the same, its notifications stay in your inbox, so you still see the news;
- it's a **Run failed** notification and its issue moves to a status that hands it back to a person: `in_review`, a custom status in the `started` category, or any status in the `done` or `closed` category. This archives everyone's Run failed notifications on the issue, whoever moved it, and doesn't depend on the setting above. `blocked` is the exception: it hands the issue over too, but the work is still stuck, so the earlier failures are still worth reading.
- your inbox in the workspace goes past 2,000 notifications. It keeps the newest 2,000 and shortly afterwards archives the older ones, read or not. A notification that comes back from a snooze or that you restore from the archive counts from when it came back. Notifications on a snoozed issue don't count and are left alone.
@@ -143,7 +143,7 @@ When you take the open row out yourself, from the inbox bar, its row, the hover
A later notification on the issue lands in the inbox again.
-**Settings → Notifications → Leaving the Inbox** holds **Archive issues you handle** (**Never**, **When you complete it**, **After you reply, move it forward or reassign**, or **Custom**), **After archiving** (**Stay on the issue** or **Open the next one**), and a link to the archived notifications.
+**Settings → Notifications → Leaving the Inbox** holds **Archive issues you handle** (**Never**, **When you complete it**, **When you complete it or trigger an agent**, or **Custom**), **After archiving** (**Stay on the issue** or **Open the next one**), and a link to the archived notifications.
## Display and notification types
diff --git a/apps/docs/content/docs/inbox.zh-Hant.mdx b/apps/docs/content/docs/inbox.zh-Hant.mdx
index 9f30ae77d1..d230750043 100644
--- a/apps/docs/content/docs/inbox.zh-Hant.mdx
+++ b/apps/docs/content/docs/inbox.zh-Hant.mdx
@@ -133,7 +133,7 @@ multica inbox snooze <id>... --until tomorrow # RFC 3339、30m、3h、1d、1w
- 你手動歸檔它:在它所在的列、懸停卡片、收件箱列,或透過批次操作;
- 你延後了它的任務。這是暫時的:到你選的時間,或有需要你處理的通知時,它會回來。見上方的「延後任務」;
-- 你親自處理了它的任務,按**設定 → 通知**裡**自動歸檔我處理過的任務**的選擇來算。預設的**回覆、推進狀態或轉交後**包括:留言、把任務改為 `started`、`done` 或 `closed` 分類下的狀態、更換負責人。改為 `backlog`、`todo` 或其他 `unstarted` 狀態(包括重新開啟已完成的任務)只算整理,不會歸檔,所以可以先整理再指派。**完成任務時**只算 `done` 和 `closed`,**從不**會關掉自動歸檔,**自訂**可以逐項勾選,包括預設不算的改優先級、改專案、改日期和改標籤。只歸檔你自己在該任務上的通知,無論是否已讀。別人或 AI 代理做同樣的操作時,通知會留在你的收件箱裡,你仍能看到這個變化;
+- 你親自處理了它的任務,按**設定 → 通知**裡**自動歸檔我處理過的任務**的選擇來算。預設的**完成或觸發 AI 代理時**包括:把任務改為 `done` 或 `closed` 分類下的狀態,以及任何實際觸發 AI 代理執行的操作——觸發 AI 代理的留言、快捷操作或插話,在非 `backlog` 狀態下指派給 AI 代理或小隊,把已指派給 AI 代理或小隊的任務從 `backlog` 推進到活躍狀態(包括 `todo`),進入帶 AI 代理處理者的工作流程欄位,重新執行任務,或手動觸發喚醒。沒有喚醒 AI 代理的整理動作(例如把未指派的任務從 `backlog` 改到 `todo`、在 `backlog` 中先指派 AI 代理、取消指派、發 `/note` 備註、取消勾選觸發,或因執行環境不可用被攔截)不會歸檔。**完成任務時**只算 `done` 和 `closed`,**從不**會關掉自動歸檔,**自訂**可以逐項勾選,包括預設不算的回覆、推進狀態、轉交以及改優先級、改專案、改日期和改標籤。只歸檔你自己在該任務上的通知,無論是否已讀。別人或 AI 代理做同樣的操作時,通知會留在你的收件箱裡,你仍能看到這個變化;
- 它是"執行失敗"通知,且任務進入交回給人的狀態:`in_review`、`started` 分類下的自定義狀態,或 `done`、`closed` 分類下的任一狀態。這會歸檔所有人在該任務上的"執行失敗"通知,不論是誰改的狀態,也不受上面的開關影響。`blocked` 例外:它同樣交回給人,但工作還卡著,之前的失敗記錄還要看。
- 你在該工作區的收件箱超過 2,000 條通知。收件箱保留最新的 2,000 條,隨後自動歸檔更早的通知,無論是否已讀。從延後中回來或從歸檔中還原的通知,按回來的時間算作新通知。已延後任務上的通知不計入,也不會被歸檔。
@@ -143,7 +143,7 @@ multica inbox snooze <id>... --until tomorrow # RFC 3339、30m、3h、1d、1w
之後該任務再有新通知,會重新進入收件箱。
-**設定 → 通知 → 移出收件箱**裡有**自動歸檔我處理過的任務**(**從不**、**完成任務時**、**回覆、推進狀態或轉交後**、**自訂**)和**歸檔後**(**停在目前任務**或**打開下一條**),並提供已歸檔通知的入口。
+**設定 → 通知 → 移出收件箱**裡有**自動歸檔我處理過的任務**(**從不**、**完成任務時**、**完成或觸發 AI 代理時**、**自訂**)和**歸檔後**(**停在目前任務**或**打開下一條**),並提供已歸檔通知的入口。
## 顯示與通知類型
diff --git a/apps/docs/content/docs/inbox.zh.mdx b/apps/docs/content/docs/inbox.zh.mdx
index 657fc3dfb8..2b5f7c9723 100644
--- a/apps/docs/content/docs/inbox.zh.mdx
+++ b/apps/docs/content/docs/inbox.zh.mdx
@@ -133,7 +133,7 @@ multica inbox snooze <id>... --until tomorrow # RFC 3339、30m、3h、1d、1w
- 你手动归档它:在它所在的行、悬停卡片、收件箱栏,或通过批量操作;
- 你延后了它的任务。这是暂时的:到你选的时间,或有需要你处理的通知时,它会回来。见上方的「延后任务」;
-- 你亲自处理了它的任务,按**设置 → 通知**里**自动归档我处理过的任务**的选择来算。默认的**回复、推进状态或转交后**包括:评论、把任务改为 `started`、`done` 或 `closed` 分类下的状态、更换负责人。改为 `backlog`、`todo` 或其他 `unstarted` 状态(包括重新打开已完成的任务)只算整理,不会归档,所以可以先整理再指派。**完成任务时**只算 `done` 和 `closed`,**从不**会关掉自动归档,**自定义**可以逐项勾选,包括默认不算的改优先级、改项目、改日期和改标签。只归档你自己在该任务上的通知,无论是否已读。别人或智能体做同样的操作时,通知会留在你的收件箱里,你仍能看到这个变化;
+- 你亲自处理了它的任务,按**设置 → 通知**里**自动归档我处理过的任务**的选择来算。默认的**完成或触发智能体时**包括:把任务改为 `done` 或 `closed` 分类下的状态,以及任何实际触发了智能体运行的操作——触发智能体的评论、快捷操作或插话(steer),在非 `backlog` 状态下指派给智能体或小队,把已指派给智能体或小队的任务从 `backlog` 推进到活跃状态(包括 `todo`),进入带智能体处理者的工作流列,重新运行任务,或手动触发唤醒。没有唤醒智能体的整理动作(比如把未指派的任务从 `backlog` 改到 `todo`、在 `backlog` 中先指派智能体、取消指派、发 `/note` 备注、取消勾选触发,或因运行环境不可用被拦截)不会归档。**完成任务时**只算 `done` 和 `closed`,**从不**会关掉自动归档,**自定义**可以逐项勾选,包括默认不算的回复、推进状态、转交以及改优先级、改项目、改日期和改标签。只归档你自己在该任务上的通知,无论是否已读。别人或智能体做同样的操作时,通知会留在你的收件箱里,你仍能看到这个变化;
- 它是"运行失败"通知,且任务进入交回给人的状态:`in_review`、`started` 分类下的自定义状态,或 `done`、`closed` 分类下的任一状态。这会归档所有人在该任务上的"运行失败"通知,不论是谁改的状态,也不受上面的开关影响。`blocked` 例外:它同样交回给人,但工作还卡着,之前的失败记录还要看。
- 你在该工作区的收件箱超过 2,000 条通知。收件箱保留最新的 2,000 条,随后自动归档更早的通知,无论是否已读。从延后中回来或从归档中还原的通知,按回来的时间算作新通知。已延后任务上的通知不计入,也不会被归档。
@@ -143,7 +143,7 @@ multica inbox snooze <id>... --until tomorrow # RFC 3339、30m、3h、1d、1w
之后该任务再有新通知,会重新进入收件箱。
-**设置 → 通知 → 移出收件箱**里有**自动归档我处理过的任务**(**从不**、**完成任务时**、**回复、推进状态或转交后**、**自定义**)和**归档后**(**停在当前任务**或**打开下一条**),并提供已归档通知的入口。
+**设置 → 通知 → 移出收件箱**里有**自动归档我处理过的任务**(**从不**、**完成任务时**、**完成或触发智能体时**、**自定义**)和**归档后**(**停在当前任务**或**打开下一条**),并提供已归档通知的入口。
## 显示与通知类型
diff --git a/packages/core/inbox/auto-archive.ts b/packages/core/inbox/auto-archive.ts
index 5e1c91accd..aec231b4b2 100644
--- a/packages/core/inbox/auto-archive.ts
+++ b/packages/core/inbox/auto-archive.ts
@@ -2,8 +2,8 @@ import type { IssueAssigneeType } from "../types";
/**
* Issues whose notifications the server just archived because the user
- * handled them: completed the issue, commented on it, changed its status or reassigned it
- * (`inbox:batch-archived` with one of these reasons). The Inbox reads this to
+ * handled them (e.g. completed the issue or triggered an agent,
+ * `inbox:batch-archived` with one of these reasons). The Inbox reads this to
* tell such an archive apart from any other way the open notification left,
* such as another window archiving it.
*/
diff --git a/packages/core/notification-preferences/auto-archive-presets.test.ts b/packages/core/notification-preferences/auto-archive-presets.test.ts
index cc2279049d..29e26e8536 100644
--- a/packages/core/notification-preferences/auto-archive-presets.test.ts
+++ b/packages/core/notification-preferences/auto-archive-presets.test.ts
@@ -4,9 +4,19 @@ import { autoArchivePreferences, autoArchivePreset } from "./auto-archive-preset
describe("autoArchivePreset", () => {
it.each([
[{}, "handled"],
- [{ auto_archive_on_comment: "muted", auto_archive_on_status: "muted", auto_archive_on_assignee: "muted" }, "completed"],
+ [{ auto_archive_on_agent_trigger: "muted" }, "completed"],
+ [
+ {
+ auto_archive_on_agent_trigger: "muted",
+ auto_archive_on_comment: "muted",
+ auto_archive_on_status: "muted",
+ auto_archive_on_assignee: "muted",
+ },
+ "completed",
+ ],
[autoArchivePreferences([]), "never"],
[{ auto_archive_on_labels: "all" }, "custom"],
+ [{ auto_archive_on_comment: "all" }, "custom"],
[{ auto_archive_completed: "muted" }, "custom"],
] as const)("%j is %s", (preferences, preset) => {
expect(autoArchivePreset(preferences)).toBe(preset);
@@ -17,6 +27,7 @@ describe("autoArchivePreferences", () => {
it("sets every action, on or off", () => {
expect(autoArchivePreferences(["auto_archive_completed", "auto_archive_on_labels"])).toEqual({
auto_archive_completed: "all",
+ auto_archive_on_agent_trigger: "muted",
auto_archive_on_comment: "muted",
auto_archive_on_status: "muted",
auto_archive_on_assignee: "muted",
diff --git a/packages/core/notification-preferences/auto-archive-presets.ts b/packages/core/notification-preferences/auto-archive-presets.ts
index 6c1c42a240..77ccc799ed 100644
--- a/packages/core/notification-preferences/auto-archive-presets.ts
+++ b/packages/core/notification-preferences/auto-archive-presets.ts
@@ -3,6 +3,7 @@ import { notificationPreferenceValue } from "./patch";
export const AUTO_ARCHIVE_KEYS = [
"auto_archive_completed",
+ "auto_archive_on_agent_trigger",
"auto_archive_on_comment",
"auto_archive_on_status",
"auto_archive_on_assignee",
@@ -23,9 +24,7 @@ export const AUTO_ARCHIVE_PRESETS: Record<AutoArchivePreset, readonly AutoArchiv
completed: ["auto_archive_completed"],
handled: [
"auto_archive_completed",
- "auto_archive_on_comment",
- "auto_archive_on_status",
- "auto_archive_on_assignee",
+ "auto_archive_on_agent_trigger",
],
};
diff --git a/packages/core/notification-preferences/patch.ts b/packages/core/notification-preferences/patch.ts
index 14205539a8..fceaac4126 100644
--- a/packages/core/notification-preferences/patch.ts
+++ b/packages/core/notification-preferences/patch.ts
@@ -7,7 +7,7 @@ type PreferenceValues = Record<PreferenceKey, string | undefined>;
* The value each key means when it is missing. Every key the settings UI can
* write must be listed, or its change is silently never sent. Must match the
* server's defaults (`mutedByDefault` in server/internal/inbox/registry.go,
- * `autoArchiveOnByDefault` in server/cmd/server/notification_listeners.go).
+ * `autoArchiveOnByDefault` in server/internal/inbox/auto_archive.go).
*/
const PREFERENCE_DEFAULTS: { [K in PreferenceKey]-?: NonNullable<NotificationPreferences[K]> } = {
assignments: "all",
@@ -21,9 +21,10 @@ const PREFERENCE_DEFAULTS: { [K in PreferenceKey]-?: NonNullable<NotificationPre
agent_activity: "all",
system_notifications: "all",
auto_archive_completed: "all",
- auto_archive_on_comment: "all",
- auto_archive_on_status: "all",
- auto_archive_on_assignee: "all",
+ auto_archive_on_agent_trigger: "all",
+ auto_archive_on_comment: "muted",
+ auto_archive_on_status: "muted",
+ auto_archive_on_assignee: "muted",
auto_archive_on_priority: "muted",
auto_archive_on_project: "muted",
auto_archive_on_dates: "muted",
diff --git a/packages/core/types/notification-preference.ts b/packages/core/types/notification-preference.ts
index 6d2fd9c54c..151d6b5e7e 100644
--- a/packages/core/types/notification-preference.ts
+++ b/packages/core/types/notification-preference.ts
@@ -14,11 +14,14 @@ export type NotificationGroupKey =
/**
* Each action you take on an issue that can archive your own notifications on
* it. `auto_archive_completed` is moving it to a done or closed status;
- * `auto_archive_on_status` is moving it to a started status; moving it to an
- * unstarted one (backlog, todo) archives nothing.
+ * `auto_archive_on_agent_trigger` is any action that starts, merges into,
+ * steers or reruns an agent on the issue; `auto_archive_on_status` is moving
+ * it to a started status (unstarted statuses like backlog/todo archive nothing
+ * unless they trigger an agent).
*/
export type AutoArchiveKey =
| "auto_archive_completed"
+ | "auto_archive_on_agent_trigger"
| "auto_archive_on_comment"
| "auto_archive_on_status"
| "auto_archive_on_assignee"
diff --git a/packages/views/inbox/components/auto-archive-prompt-dialog.test.tsx b/packages/views/inbox/components/auto-archive-prompt-dialog.test.tsx
index cafc2f454f..74629470d0 100644
--- a/packages/views/inbox/components/auto-archive-prompt-dialog.test.tsx
+++ b/packages/views/inbox/components/auto-archive-prompt-dialog.test.tsx
@@ -36,6 +36,7 @@ function renderDialog({ prompt, active = true }: { prompt: boolean; active?: boo
const off = {
auto_archive_completed: "muted",
+ auto_archive_on_agent_trigger: "muted",
auto_archive_on_comment: "muted",
auto_archive_on_status: "muted",
auto_archive_on_assignee: "muted",
@@ -59,7 +60,10 @@ describe("AutoArchivePromptDialog", () => {
expect(screen.getByRole("dialog", { name: "Archive notifications once you've handled them" })).toBeInTheDocument();
const choices = screen.getAllByRole("radio").map((radio) => [radio.textContent, radio.getAttribute("aria-checked")]);
expect(choices).toEqual([
- ["After you reply, move it forward or reassignRecommendedIssues you've dealt with leave your Inbox", "true"],
+ [
+ "When you complete it or trigger an agentRecommendedCompleting an issue or starting an agent archives it; organizing or commenting without waking an agent leaves it in place",
+ "true",
+ ],
["When you complete itOnly completing or cancelling an issue archives it", "false"],
["NeverYou archive notifications yourself", "false"],
]);
@@ -68,7 +72,7 @@ describe("AutoArchivePromptDialog", () => {
it("saves the choice for every pending workspace and closes", async () => {
const user = userEvent.setup();
renderDialog({ prompt: true });
- await user.click(screen.getByRole("radio", { name: /When you complete it/ }));
+ await user.click(screen.getByRole("radio", { name: /Only completing or cancelling an issue/ }));
await user.click(screen.getByRole("button", { name: "Done" }));
expect(resolve).toHaveBeenCalledWith({ ...off, auto_archive_completed: "all" }, expect.anything());
expect(screen.queryByRole("dialog")).toBeNull();
diff --git a/packages/views/locales/en/inbox.json b/packages/views/locales/en/inbox.json
index c9c9ff3c97..6c1c7c8c57 100644
--- a/packages/views/locales/en/inbox.json
+++ b/packages/views/locales/en/inbox.json
@@ -225,7 +225,7 @@
"title": "Archive notifications once you've handled them",
"description": "The Inbox can now archive an issue's notifications when you act on it. Only your own actions count, and a later notification brings the issue back.",
"options": {
- "handled": "Issues you've dealt with leave your Inbox",
+ "handled": "Completing an issue or starting an agent archives it; organizing or commenting without waking an agent leaves it in place",
"completed": "Only completing or cancelling an issue archives it",
"never": "You archive notifications yourself"
},
diff --git a/packages/views/locales/en/settings.json b/packages/views/locales/en/settings.json
index ed81a6d3c0..bbad988ef1 100644
--- a/packages/views/locales/en/settings.json
+++ b/packages/views/locales/en/settings.json
@@ -869,7 +869,7 @@
"auto_presets": {
"never": "Never",
"completed": "When you complete it",
- "handled": "After you reply, move it forward or reassign",
+ "handled": "When you complete it or trigger an agent",
"custom": "Custom",
"custom_item": "Custom..."
},
@@ -880,6 +880,7 @@
},
"auto_actions": {
"completed": "Complete",
+ "agent_trigger": "Trigger an agent",
"comment": "Reply",
"status": "Move it forward",
"assignee": "Reassign",
diff --git a/packages/views/locales/es/inbox.json b/packages/views/locales/es/inbox.json
index 1ee115ed1e..2936a25b4b 100644
--- a/packages/views/locales/es/inbox.json
+++ b/packages/views/locales/es/inbox.json
@@ -225,7 +225,7 @@
"title": "Archiva las notificaciones cuando ya las has gestionado",
"description": "La bandeja de entrada ya puede archivar las notificaciones de una tarea cuando actúas sobre ella. Solo cuentan tus propias acciones, y una notificación posterior devuelve la tarea.",
"options": {
- "handled": "Las tareas que ya gestionaste salen de tu bandeja",
+ "handled": "Completar una tarea o iniciar un agente la archiva; organizarla o comentar sin activar un agente la deja en su sitio",
"completed": "Solo completar o cancelar una tarea la archiva",
"never": "Archivas las notificaciones tú mismo"
},
diff --git a/packages/views/locales/es/settings.json b/packages/views/locales/es/settings.json
index 61de3b00f2..651e8fa9cd 100644
--- a/packages/views/locales/es/settings.json
+++ b/packages/views/locales/es/settings.json
@@ -869,7 +869,7 @@
"auto_presets": {
"never": "Nunca",
"completed": "Cuando la completas",
- "handled": "Al responder, avanzar el estado o reasignar",
+ "handled": "Cuando la completas o activas un agente",
"custom": "Personalizado",
"custom_item": "Personalizado..."
},
@@ -880,6 +880,7 @@
},
"auto_actions": {
"completed": "Completar",
+ "agent_trigger": "Activar un agente",
"comment": "Responder",
"status": "Avanzar el estado",
"assignee": "Reasignar",
diff --git a/packages/views/locales/fr/inbox.json b/packages/views/locales/fr/inbox.json
index 641914ab1a..8b5691eede 100644
--- a/packages/views/locales/fr/inbox.json
+++ b/packages/views/locales/fr/inbox.json
@@ -225,7 +225,7 @@
"title": "Archiver les notifications une fois traitées",
"description": "La boîte de réception peut désormais archiver les notifications d'une tâche quand vous agissez dessus. Seules vos propres actions comptent, et une nouvelle notification fait revenir la tâche.",
"options": {
- "handled": "Les tâches traitées quittent votre boîte de réception",
+ "handled": "Terminer une tâche ou lancer un agent l'archive ; l'organiser ou commenter sans réveiller d'agent la laisse en place",
"completed": "Seul le fait de terminer ou d'annuler une tâche l'archive",
"never": "Vous archivez vous-même les notifications"
},
diff --git a/packages/views/locales/fr/settings.json b/packages/views/locales/fr/settings.json
index bf64bd905b..3d1243cca5 100644
--- a/packages/views/locales/fr/settings.json
+++ b/packages/views/locales/fr/settings.json
@@ -869,7 +869,7 @@
"auto_presets": {
"never": "Jamais",
"completed": "Quand vous la terminez",
- "handled": "Après une réponse, une avancée de statut ou une réattribution",
+ "handled": "Quand vous la terminez ou déclenchez un agent",
"custom": "Personnalisé",
"custom_item": "Personnalisé..."
},
@@ -880,6 +880,7 @@
},
"auto_actions": {
"completed": "Terminer",
+ "agent_trigger": "Déclencher un agent",
"comment": "Répondre",
"status": "Faire avancer le statut",
"assignee": "Réassigner",
diff --git a/packages/views/locales/ja/inbox.json b/packages/views/locales/ja/inbox.json
index eac8e2887d..78e5b9cf85 100644
--- a/packages/views/locales/ja/inbox.json
+++ b/packages/views/locales/ja/inbox.json
@@ -220,7 +220,7 @@
"title": "対応済みの通知を自動でアーカイブ",
"description": "タスクに対応すると、その通知をインボックスから自動でアーカイブできるようになりました。自分の操作だけが対象で、新しい通知が届くとタスクは戻ってきます。",
"options": {
- "handled": "対応したタスクはインボックスに残りません",
+ "handled": "タスクの完了やエージェントの起動でアーカイブされ、整理やエージェントを起こさないコメントはそのまま残ります",
"completed": "タスクを完了またはキャンセルしたときだけアーカイブします",
"never": "通知は自分でアーカイブします"
},
diff --git a/packages/views/locales/ja/settings.json b/packages/views/locales/ja/settings.json
index 31ce87d5e9..bec92aa0c0 100644
--- a/packages/views/locales/ja/settings.json
+++ b/packages/views/locales/ja/settings.json
@@ -859,7 +859,7 @@
"auto_presets": {
"never": "しない",
"completed": "完了したとき",
- "handled": "返信・ステータス前進・担当変更の後",
+ "handled": "完了またはエージェントを起動したとき",
"custom": "カスタム",
"custom_item": "カスタム..."
},
@@ -870,6 +870,7 @@
},
"auto_actions": {
"completed": "完了",
+ "agent_trigger": "エージェントを起動",
"comment": "返信",
"status": "ステータスを進める",
"assignee": "担当者変更",
diff --git a/packages/views/locales/ko/inbox.json b/packages/views/locales/ko/inbox.json
index bfb7d65c24..c7cb7591b0 100644
--- a/packages/views/locales/ko/inbox.json
+++ b/packages/views/locales/ko/inbox.json
@@ -220,7 +220,7 @@
"title": "처리한 알림을 자동으로 보관하세요",
"description": "이제 태스크를 처리하면 그 알림을 인박스에서 자동으로 보관할 수 있습니다. 내 동작만 해당되며, 새 알림이 오면 태스크가 다시 돌아옵니다.",
"options": {
- "handled": "처리한 태스크는 인박스에 남지 않습니다",
+ "handled": "태스크를 완료하거나 에이전트를 시작하면 보관되고, 정리하거나 에이전트를 깨우지 않는 댓글은 그대로 남습니다",
"completed": "태스크를 완료하거나 취소할 때만 보관합니다",
"never": "알림은 직접 보관합니다"
},
diff --git a/packages/views/locales/ko/settings.json b/packages/views/locales/ko/settings.json
index 29cd8668a9..e487409bc0 100644
--- a/packages/views/locales/ko/settings.json
+++ b/packages/views/locales/ko/settings.json
@@ -859,7 +859,7 @@
"auto_presets": {
"never": "안 함",
"completed": "완료했을 때",
- "handled": "답글, 상태 진행, 담당자 변경 후",
+ "handled": "완료하거나 에이전트를 실행했을 때",
"custom": "사용자 지정",
"custom_item": "사용자 지정..."
},
@@ -870,6 +870,7 @@
},
"auto_actions": {
"completed": "완료",
+ "agent_trigger": "에이전트 실행",
"comment": "답글",
"status": "상태 진행",
"assignee": "담당자 변경",
diff --git a/packages/views/locales/ru/inbox.json b/packages/views/locales/ru/inbox.json
index 500467ece3..c80cdb99c1 100644
--- a/packages/views/locales/ru/inbox.json
+++ b/packages/views/locales/ru/inbox.json
@@ -235,7 +235,7 @@
"title": "Архивируйте уведомления, когда задача обработана",
"description": "Теперь «Входящие» могут архивировать уведомления задачи, когда вы с ней работаете. Учитываются только ваши действия, а новое уведомление вернёт задачу.",
"options": {
- "handled": "Обработанные задачи уходят из «Входящих»",
+ "handled": "Завершение задачи или запуск агента архивирует её; упорядочивание и комментарии без запуска агента оставляют её на месте",
"completed": "Архивируется только при завершении или отмене задачи",
"never": "Вы архивируете уведомления сами"
},
diff --git a/packages/views/locales/ru/settings.json b/packages/views/locales/ru/settings.json
index 31c9893f77..12fe736a28 100644
--- a/packages/views/locales/ru/settings.json
+++ b/packages/views/locales/ru/settings.json
@@ -889,7 +889,7 @@
"auto_presets": {
"never": "Никогда",
"completed": "Когда вы её завершаете",
- "handled": "После ответа, продвижения статуса или переназначения",
+ "handled": "При завершении или запуске агента",
"custom": "Свои настройки",
"custom_item": "Свои настройки..."
},
@@ -900,6 +900,7 @@
},
"auto_actions": {
"completed": "Завершить",
+ "agent_trigger": "Запустить агента",
"comment": "Ответить",
"status": "Продвинуть статус",
"assignee": "Переназначить",
diff --git a/packages/views/locales/zh-Hans/inbox.json b/packages/views/locales/zh-Hans/inbox.json
index 9e53f4015e..1410e9cd69 100644
--- a/packages/views/locales/zh-Hans/inbox.json
+++ b/packages/views/locales/zh-Hans/inbox.json
@@ -220,7 +220,7 @@
"title": "处理完的通知,可以自动归档",
"description": "收件箱新增了自动归档:你处理完一个任务,它的通知就会移出收件箱。只算你自己的操作,有新动态会重新进收件箱。",
"options": {
- "handled": "处理过的任务不再留在收件箱",
+ "handled": "完成任务或触发智能体运行时自动归档;只整理字段或不触发智能体的评论留在原地",
"completed": "只有完成或取消任务才归档",
"never": "自己手动归档"
},
diff --git a/packages/views/locales/zh-Hans/settings.json b/packages/views/locales/zh-Hans/settings.json
index 9b2dd7525a..af9a5b1382 100644
--- a/packages/views/locales/zh-Hans/settings.json
+++ b/packages/views/locales/zh-Hans/settings.json
@@ -859,7 +859,7 @@
"auto_presets": {
"never": "从不",
"completed": "完成任务时",
- "handled": "回复、推进状态或转交后",
+ "handled": "完成或触发智能体时",
"custom": "自定义",
"custom_item": "自定义..."
},
@@ -870,6 +870,7 @@
},
"auto_actions": {
"completed": "完成",
+ "agent_trigger": "触发智能体",
"comment": "回复",
"status": "推进状态",
"assignee": "转交",
diff --git a/packages/views/locales/zh-Hant/inbox.json b/packages/views/locales/zh-Hant/inbox.json
index b55693a539..248ac78da4 100644
--- a/packages/views/locales/zh-Hant/inbox.json
+++ b/packages/views/locales/zh-Hant/inbox.json
@@ -220,7 +220,7 @@
"title": "處理完的通知,可以自動歸檔",
"description": "收件箱新增了自動歸檔:你處理完一個任務,它的通知就會移出收件箱。只算你自己的操作,有新動態會重新進收件箱。",
"options": {
- "handled": "處理過的任務不再留在收件箱",
+ "handled": "完成任務或觸發 AI 代理執行時自動歸檔;只整理欄位或不觸發 AI 代理的留言留在原地",
"completed": "只有完成或取消任務才歸檔",
"never": "自己手動歸檔"
},
diff --git a/packages/views/locales/zh-Hant/settings.json b/packages/views/locales/zh-Hant/settings.json
index 8a11b1f42b..575937da5e 100644
--- a/packages/views/locales/zh-Hant/settings.json
+++ b/packages/views/locales/zh-Hant/settings.json
@@ -859,7 +859,7 @@
"auto_presets": {
"never": "從不",
"completed": "完成任務時",
- "handled": "回覆、推進狀態或轉交後",
+ "handled": "完成或觸發 AI 代理時",
"custom": "自訂",
"custom_item": "自訂..."
},
@@ -870,6 +870,7 @@
},
"auto_actions": {
"completed": "完成",
+ "agent_trigger": "觸發 AI 代理",
"comment": "回覆",
"status": "推進狀態",
"assignee": "轉交",
diff --git a/packages/views/settings/components/notifications-tab.test.tsx b/packages/views/settings/components/notifications-tab.test.tsx
index 7c1ec05a62..d99e9df04c 100644
--- a/packages/views/settings/components/notifications-tab.test.tsx
+++ b/packages/views/settings/components/notifications-tab.test.tsx
@@ -118,6 +118,7 @@ describe("Inbox notification settings", () => {
const ALL_ACTIONS_OFF = {
auto_archive_completed: "muted",
+ auto_archive_on_agent_trigger: "muted",
auto_archive_on_comment: "muted",
auto_archive_on_status: "muted",
auto_archive_on_assignee: "muted",
@@ -126,6 +127,7 @@ describe("Inbox notification settings", () => {
Object.fromEntries(
[
"auto_archive_completed",
+ "auto_archive_on_agent_trigger",
"auto_archive_on_comment",
"auto_archive_on_status",
"auto_archive_on_assignee",
@@ -141,7 +143,7 @@ describe("Inbox notification settings", () => {
});
it.each<{ preferences: Record<string, string>; shown: string; custom: boolean }>([
- { preferences: {}, shown: "After you reply, move it forward or reassign", custom: false },
+ { preferences: {}, shown: "When you complete it or trigger an agent", custom: false },
{ preferences: { ...ALL_ACTIONS_OFF, auto_archive_completed: "all" }, shown: "When you complete it", custom: false },
{ preferences: ALL_ACTIONS_OFF, shown: "Never", custom: false },
{ preferences: { auto_archive_on_labels: "all" }, shown: "Custom", custom: true },
@@ -159,7 +161,7 @@ describe("Inbox notification settings", () => {
expect(options.map((option) => [option.textContent, option.getAttribute("aria-selected")])).toEqual([
["Never", "false"],
["When you complete it", "false"],
- ["After you reply, move it forward or reassignRecommended", "true"],
+ ["When you complete it or trigger an agentRecommended", "true"],
["Custom...", "false"],
]);
});
@@ -187,9 +189,10 @@ describe("Inbox notification settings", () => {
.map((box) => [box.closest("label")?.textContent, box.getAttribute("aria-checked")]);
expect(checked).toEqual([
["Complete", "true"],
- ["Reply", "true"],
- ["Move it forward", "true"],
- ["Reassign", "true"],
+ ["Trigger an agent", "true"],
+ ["Reply", "false"],
+ ["Move it forward", "false"],
+ ["Reassign", "false"],
["Change priority", "false"],
["Change project", "false"],
["Change dates", "false"],
@@ -200,9 +203,7 @@ describe("Inbox notification settings", () => {
expect(mutate).toHaveBeenCalledWith(
ACTIONS_OFF_BUT([
"auto_archive_completed",
- "auto_archive_on_comment",
- "auto_archive_on_status",
- "auto_archive_on_assignee",
+ "auto_archive_on_agent_trigger",
"auto_archive_on_labels",
]),
expect.anything(),
diff --git a/packages/views/settings/components/notifications-tab.tsx b/packages/views/settings/components/notifications-tab.tsx
index 7c508005f6..19e993959b 100644
--- a/packages/views/settings/components/notifications-tab.tsx
+++ b/packages/views/settings/components/notifications-tab.tsx
@@ -66,6 +66,7 @@ const AUTO_ARCHIVE_GROUPS = [
key: "settle",
actions: [
{ key: "auto_archive_completed", label: "completed" },
+ { key: "auto_archive_on_agent_trigger", label: "agent_trigger" },
{ key: "auto_archive_on_comment", label: "comment" },
{ key: "auto_archive_on_status", label: "status" },
{ key: "auto_archive_on_assignee", label: "assignee" },
diff --git a/server/cmd/server/notification_listeners.go b/server/cmd/server/notification_listeners.go
index a7c68c9352..a7cd11ee28 100644
--- a/server/cmd/server/notification_listeners.go
+++ b/server/cmd/server/notification_listeners.go
@@ -3,11 +3,8 @@ package main
import (
"context"
"encoding/json"
- "errors"
"log/slog"
- "slices"
- "github.com/jackc/pgx/v5"
"github.com/jackc/pgx/v5/pgtype"
"github.com/multica-ai/multica/server/internal/events"
"github.com/multica-ai/multica/server/internal/handler"
@@ -332,58 +329,17 @@ func archiveStaleTaskFailedInbox(
"row_count", len(rows), "recipient_count", count)
}
-// Preference keys, one per action you take on an issue, that archive your own
-// notifications on it. Completing means moving it to a done or closed status;
-// a status change means moving it to a started status. Moving it to an
-// unstarted status (backlog, todo) is triage, not handling, and archives
-// nothing. Settling actions are on unless "muted"; edits that only tidy the
-// issue are off unless "all".
-const (
- autoArchiveCompletedPref = "auto_archive_completed"
- autoArchiveCommentPref = "auto_archive_on_comment"
- autoArchiveStatusPref = "auto_archive_on_status"
- autoArchiveAssigneePref = "auto_archive_on_assignee"
- autoArchivePriorityPref = "auto_archive_on_priority"
- autoArchiveProjectPref = "auto_archive_on_project"
- autoArchiveDatesPref = "auto_archive_on_dates"
- autoArchiveLabelsPref = "auto_archive_on_labels"
-)
-
-var autoArchiveOnByDefault = map[string]bool{
- autoArchiveCompletedPref: true,
- autoArchiveCommentPref: true,
- autoArchiveStatusPref: true,
- autoArchiveAssigneePref: true,
-}
-
-// Why the actor's notifications were archived, sent as `reason` on
-// inbox:batch-archived so the client can tell its user's own action apart.
-const (
- archiveReasonCompleted = "issue_status_terminal"
- archiveReasonActed = "actor_acted"
-)
-
-// autoArchivesOn reports whether prefs archive the actor's notifications when
-// they take action. nil prefs, a member without a stored row, applies the
-// defaults.
-func autoArchivesOn(prefs map[string]string, action string) bool {
- if autoArchiveOnByDefault[action] {
- return prefs[action] != "muted"
- }
- return prefs[action] == "all"
-}
-
// issueFieldActions lists the auto-archive actions an issue:updated payload
// took on fields other than status, which depends on the status category.
// Title, description and parent edits archive nothing.
func issueFieldActions(payload map[string]any) []string {
var actions []string
for _, field := range []struct{ changed, action string }{
- {"assignee_changed", autoArchiveAssigneePref},
- {"priority_changed", autoArchivePriorityPref},
- {"project_changed", autoArchiveProjectPref},
- {"start_date_changed", autoArchiveDatesPref},
- {"due_date_changed", autoArchiveDatesPref},
+ {"assignee_changed", inbox.AutoArchiveAssigneePref},
+ {"priority_changed", inbox.AutoArchivePriorityPref},
+ {"project_changed", inbox.AutoArchiveProjectPref},
+ {"start_date_changed", inbox.AutoArchiveDatesPref},
+ {"due_date_changed", inbox.AutoArchiveDatesPref},
} {
if changed, _ := payload[field.changed].(bool); changed {
actions = append(actions, field.action)
@@ -392,87 +348,6 @@ func issueFieldActions(payload map[string]any) []string {
return actions
}
-// archiveActorIssueInbox archives the actor's own notifications for an issue,
-// read or not, when their preferences archive on one of the actions they just
-// took on it. Completing archives the same set "Archive completed" clears by
-// hand. Other recipients keep theirs: someone else acting on an issue is news
-// they have not seen yet. A later notification brings the issue back.
-func archiveActorIssueInbox(
- ctx context.Context,
- queries *db.Queries,
- bus *events.Bus,
- workspaceID string,
- issueID string,
- actorType string,
- actorID string,
- actions ...string,
-) {
- if actorType != "member" || actorID == "" || issueID == "" || len(actions) == 0 {
- return
- }
-
- // FAIL CLOSED: archiving on a guess hides notifications the user wanted.
- pref, err := queries.GetNotificationPreference(ctx, db.GetNotificationPreferenceParams{
- WorkspaceID: parseUUID(workspaceID),
- UserID: parseUUID(actorID),
- })
- var prefs map[string]string
- switch {
- case errors.Is(err, pgx.ErrNoRows):
- case err != nil:
- slog.Warn("auto-archive actor issue inbox: load preference failed; keeping rows",
- "workspace_id", workspaceID, "issue_id", issueID, "actions", actions, "error", err)
- return
- default:
- if err := json.Unmarshal(pref.Preferences, &prefs); err != nil {
- slog.Warn("auto-archive actor issue inbox: bad preference JSON; keeping rows",
- "workspace_id", workspaceID, "issue_id", issueID, "actions", actions, "error", err)
- return
- }
- }
- var archivedOn []string
- for _, action := range actions {
- if autoArchivesOn(prefs, action) {
- archivedOn = append(archivedOn, action)
- }
- }
- if len(archivedOn) == 0 {
- return
- }
- reason := archiveReasonActed
- if slices.Contains(archivedOn, autoArchiveCompletedPref) {
- reason = archiveReasonCompleted
- }
-
- count, err := queries.ArchiveInboxByIssue(ctx, db.ArchiveInboxByIssueParams{
- WorkspaceID: parseUUID(workspaceID),
- RecipientType: "member",
- RecipientID: parseUUID(actorID),
- IssueID: parseUUID(issueID),
- })
- if err != nil {
- slog.Error("auto-archive actor issue inbox: query failed",
- "workspace_id", workspaceID, "issue_id", issueID, "reason", reason, "error", err)
- return
- }
- if count == 0 {
- return
- }
- bus.Publish(events.Event{
- Type: protocol.EventInboxBatchArchived,
- WorkspaceID: workspaceID,
- Payload: map[string]any{
- "recipient_id": actorID,
- "count": count,
- "issue_id": issueID,
- "reason": reason,
- },
- })
-
- slog.Info("auto-archive actor issue inbox: archived rows",
- "workspace_id", workspaceID, "issue_id", issueID, "reason", reason, "row_count", count)
-}
-
type inboxArchivedRecipient struct {
Type string
ID pgtype.UUID
@@ -1148,9 +1023,9 @@ func registerNotificationListeners(bus *events.Bus, queries *db.Queries) {
slog.Warn("resolve issue status category for actor issue inbox archive; keeping rows",
"issue_id", issue.ID, "status", issue.Status, "error", categoryErr)
case category == issuestatus.CategoryDone, category == issuestatus.CategoryClosed:
- archiveActions = append(archiveActions, autoArchiveCompletedPref)
+ archiveActions = append(archiveActions, inbox.AutoArchiveCompletedPref)
case category == issuestatus.CategoryStarted:
- archiveActions = append(archiveActions, autoArchiveStatusPref)
+ archiveActions = append(archiveActions, inbox.AutoArchiveStatusPref)
}
}
@@ -1226,7 +1101,7 @@ func registerNotificationListeners(bus *events.Bus, queries *db.Queries) {
}
}
- archiveActorIssueInbox(ctx, queries, bus, e.WorkspaceID, issue.ID, e.ActorType, e.ActorID, archiveActions...)
+ inbox.ArchiveActorIssueInbox(ctx, queries, bus, e.WorkspaceID, issue.ID, e.ActorType, e.ActorID, archiveActions...)
})
bus.Subscribe(protocol.EventIssueLabelsChanged, func(e events.Event) {
@@ -1235,7 +1110,7 @@ func registerNotificationListeners(bus *events.Bus, queries *db.Queries) {
return
}
issueID, _ := payload["issue_id"].(string)
- archiveActorIssueInbox(ctx, queries, bus, e.WorkspaceID, issueID, e.ActorType, e.ActorID, autoArchiveLabelsPref)
+ inbox.ArchiveActorIssueInbox(ctx, queries, bus, e.WorkspaceID, issueID, e.ActorType, e.ActorID, inbox.AutoArchiveLabelsPref)
})
// comment:created — notify all subscribers except the commenter
@@ -1304,7 +1179,7 @@ func registerNotificationListeners(bus *events.Bus, queries *db.Queries) {
// A quick action posts its prompt as the member's own comment, so
// running one counts the same as replying.
if authorType == "member" {
- archiveActorIssueInbox(ctx, queries, bus, e.WorkspaceID, issueID, e.ActorType, e.ActorID, autoArchiveCommentPref)
+ inbox.ArchiveActorIssueInbox(ctx, queries, bus, e.WorkspaceID, issueID, e.ActorType, e.ActorID, inbox.AutoArchiveCommentPref)
}
})
diff --git a/server/cmd/server/notification_listeners_test.go b/server/cmd/server/notification_listeners_test.go
index d38a80ace1..101dcabc22 100644
--- a/server/cmd/server/notification_listeners_test.go
+++ b/server/cmd/server/notification_listeners_test.go
@@ -1662,21 +1662,25 @@ func publishLabelsChangedBy(bus *events.Bus, issueID, actorID string) {
}
// TestNotification_HandlingArchivesIssueInbox verifies that commenting on an
-// issue, changing its status or reassigning it archives the actor's own
-// notifications on it by default, that tidying edits do once turned on, and
-// that other recipients keep theirs.
+// issue, advancing its status, reassigning it, or tidying it archives the
+// actor's own notifications once enabled in preferences, and that other
+// recipients keep theirs.
func TestNotification_HandlingArchivesIssueInbox(t *testing.T) {
queries := db.New(testPool)
- defaultEmail := "[email protected]"
- defaultID := createNotificationMember(t, defaultEmail)
- t.Cleanup(func() { cleanupTestUser(t, defaultEmail) })
-
- tidyEmail := "[email protected]"
- tidyID := createNotificationMember(t, tidyEmail)
- t.Cleanup(func() { cleanupTestUser(t, tidyEmail) })
- for _, key := range []string{"auto_archive_on_priority", "auto_archive_on_project", "auto_archive_on_dates", "auto_archive_on_labels"} {
- setNotificationPref(t, tidyID, key, "all")
+ customEmail := "[email protected]"
+ customID := createNotificationMember(t, customEmail)
+ t.Cleanup(func() { cleanupTestUser(t, customEmail) })
+ for _, key := range []string{
+ "auto_archive_on_comment",
+ "auto_archive_on_status",
+ "auto_archive_on_assignee",
+ "auto_archive_on_priority",
+ "auto_archive_on_project",
+ "auto_archive_on_dates",
+ "auto_archive_on_labels",
+ } {
+ setNotificationPref(t, customID, key, "all")
}
for _, tc := range []struct {
@@ -1684,23 +1688,23 @@ func TestNotification_HandlingArchivesIssueInbox(t *testing.T) {
actor string
act func(bus *events.Bus, issueID, actorID string)
}{
- {"comment", defaultID, func(bus *events.Bus, issueID, actorID string) { publishCommentBy(bus, issueID, "member", actorID) }},
- {"status", defaultID, func(bus *events.Bus, issueID, actorID string) {
+ {"comment", customID, func(bus *events.Bus, issueID, actorID string) { publishCommentBy(bus, issueID, "member", actorID) }},
+ {"status", customID, func(bus *events.Bus, issueID, actorID string) {
publishIssueFieldsBy(bus, issueID, actorID, "status_changed")
}},
- {"assignee", defaultID, func(bus *events.Bus, issueID, actorID string) {
+ {"assignee", customID, func(bus *events.Bus, issueID, actorID string) {
publishIssueFieldsBy(bus, issueID, actorID, "assignee_changed")
}},
- {"priority", tidyID, func(bus *events.Bus, issueID, actorID string) {
+ {"priority", customID, func(bus *events.Bus, issueID, actorID string) {
publishIssueFieldsBy(bus, issueID, actorID, "priority_changed")
}},
- {"project", tidyID, func(bus *events.Bus, issueID, actorID string) {
+ {"project", customID, func(bus *events.Bus, issueID, actorID string) {
publishIssueFieldsBy(bus, issueID, actorID, "project_changed")
}},
- {"due date", tidyID, func(bus *events.Bus, issueID, actorID string) {
+ {"due date", customID, func(bus *events.Bus, issueID, actorID string) {
publishIssueFieldsBy(bus, issueID, actorID, "due_date_changed")
}},
- {"labels", tidyID, publishLabelsChangedBy},
+ {"labels", customID, publishLabelsChangedBy},
} {
t.Run(tc.name, func(t *testing.T) {
bus := newNotificationBus(t, queries)
@@ -1735,11 +1739,10 @@ func TestNotification_HandlingArchivesIssueInbox(t *testing.T) {
}
}
-// TestNotification_HandlingKeepsInbox verifies that the inbox stays for
-// tidying edits by default, for an action the member turned off, and for an
-// agent actor. Completing stays off when muted even though status changes are
-// on: each action is its own choice. Moving to an unstarted status is triage,
-// not handling.
+// TestNotification_HandlingKeepsInbox verifies that the inbox stays by default
+// for field edits and plain comments that do not trigger an agent, for an
+// action the member turned off, and for an agent actor. Moving to an unstarted
+// status never archives even when status-advance auto-archive is turned on.
func TestNotification_HandlingKeepsInbox(t *testing.T) {
queries := db.New(testPool)
@@ -1747,10 +1750,15 @@ func TestNotification_HandlingKeepsInbox(t *testing.T) {
defaultID := createNotificationMember(t, defaultEmail)
t.Cleanup(func() { cleanupTestUser(t, defaultEmail) })
+ statusOnEmail := "[email protected]"
+ statusOnID := createNotificationMember(t, statusOnEmail)
+ t.Cleanup(func() { cleanupTestUser(t, statusOnEmail) })
+ setNotificationPref(t, statusOnID, "auto_archive_on_status", "all")
+
mutedEmail := "[email protected]"
mutedID := createNotificationMember(t, mutedEmail)
t.Cleanup(func() { cleanupTestUser(t, mutedEmail) })
- for _, key := range []string{"auto_archive_completed", "auto_archive_on_comment", "auto_archive_on_assignee"} {
+ for _, key := range []string{"auto_archive_completed", "auto_archive_on_agent_trigger", "auto_archive_on_comment", "auto_archive_on_assignee"} {
setNotificationPref(t, mutedID, key, "muted")
}
@@ -1759,6 +1767,15 @@ func TestNotification_HandlingKeepsInbox(t *testing.T) {
recipient string
act func(bus *events.Bus, issueID string)
}{
+ {"comment without agent trigger by default", defaultID, func(bus *events.Bus, issueID string) {
+ publishCommentBy(bus, issueID, "member", defaultID)
+ }},
+ {"status advance without agent trigger by default", defaultID, func(bus *events.Bus, issueID string) {
+ publishIssueFieldsBy(bus, issueID, defaultID, "status_changed")
+ }},
+ {"assignee change without agent trigger by default", defaultID, func(bus *events.Bus, issueID string) {
+ publishIssueFieldsBy(bus, issueID, defaultID, "assignee_changed")
+ }},
{"tidying edits by default", defaultID, func(bus *events.Bus, issueID string) {
publishIssueFieldsBy(bus, issueID, defaultID,
"title_changed", "priority_changed", "project_changed", "start_date_changed", "due_date_changed")
@@ -1774,11 +1791,11 @@ func TestNotification_HandlingKeepsInbox(t *testing.T) {
{"completing turned off", mutedID, func(bus *events.Bus, issueID string) {
publishStatusChangeBy(bus, issueID, "done", "in_review", "member", mutedID)
}},
- {"triage from backlog to todo", defaultID, func(bus *events.Bus, issueID string) {
- publishStatusChangeBy(bus, issueID, "todo", "backlog", "member", defaultID)
+ {"triage from backlog to todo even with status enabled", statusOnID, func(bus *events.Bus, issueID string) {
+ publishStatusChangeBy(bus, issueID, "todo", "backlog", "member", statusOnID)
}},
- {"reopening to todo", defaultID, func(bus *events.Bus, issueID string) {
- publishStatusChangeBy(bus, issueID, "todo", "done", "member", defaultID)
+ {"reopening to todo even with status enabled", statusOnID, func(bus *events.Bus, issueID string) {
+ publishStatusChangeBy(bus, issueID, "todo", "done", "member", statusOnID)
}},
} {
t.Run(tc.name, func(t *testing.T) {
diff --git a/server/internal/handler/auto_archive_agent_trigger_test.go b/server/internal/handler/auto_archive_agent_trigger_test.go
new file mode 100644
index 0000000000..a350dc764b
--- /dev/null
+++ b/server/internal/handler/auto_archive_agent_trigger_test.go
@@ -0,0 +1,238 @@
+package handler
+
+import (
+ "context"
+ "net/http"
+ "sync"
+ "testing"
+
+ "github.com/multica-ai/multica/server/internal/events"
+ "github.com/multica-ai/multica/server/internal/testutil"
+ "github.com/multica-ai/multica/server/pkg/dbid"
+ "github.com/multica-ai/multica/server/pkg/protocol"
+)
+
+func seedActorInboxRow(t *testing.T, issueID string) {
+ t.Helper()
+ dbfx.Exec(t, `
+ INSERT INTO inbox_item (id, workspace_id, recipient_type, recipient_id, type, severity, issue_id, title, body, actor_type, actor_id, details)
+ VALUES ($1, $2, 'member', $3, 'new_comment', 'info', $4, 'auto archive test', 'body', 'member', $3, '{}'::jsonb)
+ `, uuidToString(dbid.NewV7()), testWorkspaceID, testUserID, issueID)
+ dbfx.Cleanup(t, `DELETE FROM inbox_item WHERE issue_id = $1`, issueID)
+}
+
+func activeInboxCount(t *testing.T, issueID string) int {
+ t.Helper()
+ var n int
+ if err := testPool.QueryRow(context.Background(), `
+ SELECT COUNT(*) FROM inbox_item
+ WHERE workspace_id = $1 AND recipient_type = 'member' AND recipient_id = $2
+ AND issue_id = $3 AND NOT archived
+ `, testWorkspaceID, testUserID, issueID).Scan(&n); err != nil {
+ t.Fatalf("count active inbox: %v", err)
+ }
+ return n
+}
+
+func TestAutoArchiveOnAgentTrigger_UpdateIssue(t *testing.T) {
+ if testHandler == nil || testPool == nil {
+ t.Skip("database not available")
+ }
+ agentID := seededReadyAgentID(t)
+ noRuntimeAgentID := dbfx.Agent(t, "AutoArchive No Runtime", "", testutil.Cols{"owner_id": testUserID})
+ t.Cleanup(func() {
+ _, _ = testPool.Exec(context.Background(), `
+ DELETE FROM notification_preference WHERE workspace_id = $1 AND user_id = $2
+ `, testWorkspaceID, testUserID)
+ })
+
+ var mu sync.Mutex
+ archivedReasons := map[string][]any{}
+ testHandler.Bus.Subscribe(protocol.EventInboxBatchArchived, func(e events.Event) {
+ payload, _ := e.Payload.(map[string]any)
+ if payload["recipient_id"] == testUserID {
+ if id, ok := payload["issue_id"].(string); ok {
+ mu.Lock()
+ archivedReasons[id] = append(archivedReasons[id], payload["reason"])
+ mu.Unlock()
+ }
+ }
+ })
+
+ t.Run("backlog unassigned to todo keeps inbox", func(t *testing.T) {
+ issue := createIssueForTest(t, map[string]any{"title": "backlog unassigned", "status": "backlog"})
+ seedActorInboxRow(t, issue.ID)
+ updateIssueForOutcome(t, issue.ID, map[string]any{"status": "todo"})
+ if got := activeInboxCount(t, issue.ID); got != 1 {
+ t.Fatalf("active inbox = %d, want 1", got)
+ }
+ })
+
+ t.Run("backlog assigned to agent promoted to todo archives inbox", func(t *testing.T) {
+ issue := createIssueForTest(t, map[string]any{"title": "backlog promote agent", "status": "backlog"})
+ updateIssueForOutcome(t, issue.ID, map[string]any{"assignee_type": "agent", "assignee_id": agentID})
+ seedActorInboxRow(t, issue.ID)
+ updateIssueForOutcome(t, issue.ID, map[string]any{"status": "todo"})
+ if got := activeInboxCount(t, issue.ID); got != 0 {
+ t.Fatalf("active inbox = %d, want 0", got)
+ }
+ mu.Lock()
+ reasons := archivedReasons[issue.ID]
+ mu.Unlock()
+ if len(reasons) != 1 || reasons[0] != "actor_acted" {
+ t.Fatalf("reasons = %v, want [actor_acted]", reasons)
+ }
+ })
+
+ t.Run("assigning agent in backlog defers run and keeps inbox", func(t *testing.T) {
+ issue := createIssueForTest(t, map[string]any{"title": "backlog assign agent", "status": "backlog"})
+ seedActorInboxRow(t, issue.ID)
+ updateIssueForOutcome(t, issue.ID, map[string]any{"assignee_type": "agent", "assignee_id": agentID})
+ if got := activeInboxCount(t, issue.ID); got != 1 {
+ t.Fatalf("active inbox = %d, want 1", got)
+ }
+ })
+
+ t.Run("assigning agent in todo starts run and archives inbox", func(t *testing.T) {
+ issue := createIssueForTest(t, map[string]any{"title": "todo assign agent", "status": "todo"})
+ seedActorInboxRow(t, issue.ID)
+ updateIssueForOutcome(t, issue.ID, map[string]any{"assignee_type": "agent", "assignee_id": agentID})
+ if got := activeInboxCount(t, issue.ID); got != 0 {
+ t.Fatalf("active inbox = %d, want 0", got)
+ }
+ })
+
+ t.Run("assigning agent with suppress_run keeps inbox", func(t *testing.T) {
+ issue := createIssueForTest(t, map[string]any{"title": "todo suppress", "status": "todo"})
+ seedActorInboxRow(t, issue.ID)
+ updateIssueForOutcome(t, issue.ID, map[string]any{"assignee_type": "agent", "assignee_id": agentID, "suppress_run": true})
+ if got := activeInboxCount(t, issue.ID); got != 1 {
+ t.Fatalf("active inbox = %d, want 1", got)
+ }
+ })
+
+ t.Run("assigning blocked agent without runtime keeps inbox", func(t *testing.T) {
+ issue := createIssueForTest(t, map[string]any{"title": "todo blocked agent", "status": "todo"})
+ seedActorInboxRow(t, issue.ID)
+ updateIssueForOutcome(t, issue.ID, map[string]any{"assignee_type": "agent", "assignee_id": noRuntimeAgentID})
+ if got := activeInboxCount(t, issue.ID); got != 1 {
+ t.Fatalf("active inbox = %d, want 1", got)
+ }
+ })
+
+ t.Run("assigning member or unassigning keeps inbox", func(t *testing.T) {
+ issue := createIssueForTest(t, map[string]any{"title": "todo member", "status": "todo"})
+ seedActorInboxRow(t, issue.ID)
+ updateIssueForOutcome(t, issue.ID, map[string]any{"assignee_type": "member", "assignee_id": testUserID})
+ if got := activeInboxCount(t, issue.ID); got != 1 {
+ t.Fatalf("active inbox after member assign = %d, want 1", got)
+ }
+ updateIssueForOutcome(t, issue.ID, map[string]any{"assignee_type": nil, "assignee_id": nil})
+ if got := activeInboxCount(t, issue.ID); got != 1 {
+ t.Fatalf("active inbox after unassign = %d, want 1", got)
+ }
+ })
+
+ t.Run("muted preference keeps inbox even when agent starts", func(t *testing.T) {
+ dbfx.Exec(t, `
+ INSERT INTO notification_preference (workspace_id, user_id, preferences)
+ VALUES ($1, $2, '{"auto_archive_on_agent_trigger": "muted"}'::jsonb)
+ ON CONFLICT (workspace_id, user_id) DO UPDATE SET preferences = EXCLUDED.preferences
+ `, testWorkspaceID, testUserID)
+ defer func() {
+ _, _ = testPool.Exec(context.Background(), `
+ DELETE FROM notification_preference WHERE workspace_id = $1 AND user_id = $2
+ `, testWorkspaceID, testUserID)
+ }()
+
+ issue := createIssueForTest(t, map[string]any{"title": "muted agent trigger", "status": "todo"})
+ seedActorInboxRow(t, issue.ID)
+ updateIssueForOutcome(t, issue.ID, map[string]any{"assignee_type": "agent", "assignee_id": agentID})
+ if got := activeInboxCount(t, issue.ID); got != 1 {
+ t.Fatalf("active inbox = %d, want 1 when muted", got)
+ }
+ })
+}
+
+func TestAutoArchiveOnAgentTrigger_CommentAndRerun(t *testing.T) {
+ if testHandler == nil || testPool == nil {
+ t.Skip("database not available")
+ }
+ agentID := seededReadyAgentID(t)
+ noRuntimeAgentID := dbfx.Agent(t, "AutoArchive Comment No Runtime", "", testutil.Cols{"owner_id": testUserID})
+ t.Cleanup(func() {
+ _, _ = testPool.Exec(context.Background(), `
+ DELETE FROM notification_preference WHERE workspace_id = $1 AND user_id = $2
+ `, testWorkspaceID, testUserID)
+ })
+
+ postComment := func(t *testing.T, issueID string, body map[string]any) {
+ t.Helper()
+ testutil.Call(t, testHandler.CreateComment,
+ withURLParam(newRequest("POST", "/api/issues/"+issueID+"/comments", body), "id", issueID)).Want(http.StatusCreated)
+ }
+
+ t.Run("plain comment on unassigned issue keeps inbox", func(t *testing.T) {
+ issue := createIssueForTest(t, map[string]any{"title": "comment unassigned", "status": "todo"})
+ seedActorInboxRow(t, issue.ID)
+ postComment(t, issue.ID, map[string]any{"content": "just a human note"})
+ if got := activeInboxCount(t, issue.ID); got != 1 {
+ t.Fatalf("active inbox = %d, want 1", got)
+ }
+ })
+
+ t.Run("note comment on agent issue keeps inbox", func(t *testing.T) {
+ issue := createIssueForTest(t, map[string]any{"title": "comment /note", "status": "backlog"})
+ updateIssueForOutcome(t, issue.ID, map[string]any{"assignee_type": "agent", "assignee_id": agentID})
+ seedActorInboxRow(t, issue.ID)
+ postComment(t, issue.ID, map[string]any{"content": "/note internal memo"})
+ if got := activeInboxCount(t, issue.ID); got != 1 {
+ t.Fatalf("active inbox = %d, want 1", got)
+ }
+ })
+
+ t.Run("suppressed comment trigger keeps inbox", func(t *testing.T) {
+ issue := createIssueForTest(t, map[string]any{"title": "comment suppressed", "status": "backlog"})
+ updateIssueForOutcome(t, issue.ID, map[string]any{"assignee_type": "agent", "assignee_id": agentID})
+ seedActorInboxRow(t, issue.ID)
+ postComment(t, issue.ID, map[string]any{
+ "content": "reply without waking agent",
+ "suppress_agent_ids": []string{agentID},
+ })
+ if got := activeInboxCount(t, issue.ID); got != 1 {
+ t.Fatalf("active inbox = %d, want 1", got)
+ }
+ })
+
+ t.Run("comment mentioning blocked agent keeps inbox", func(t *testing.T) {
+ issue := createIssueForTest(t, map[string]any{"title": "comment blocked", "status": "todo"})
+ seedActorInboxRow(t, issue.ID)
+ postComment(t, issue.ID, map[string]any{
+ "content": "[@NoRuntime](mention://agent/" + noRuntimeAgentID + ") please check",
+ })
+ if got := activeInboxCount(t, issue.ID); got != 1 {
+ t.Fatalf("active inbox = %d, want 1", got)
+ }
+ })
+
+ t.Run("comment triggering assigned agent archives inbox", func(t *testing.T) {
+ issue := createIssueForTest(t, map[string]any{"title": "comment wakes agent", "status": "backlog"})
+ updateIssueForOutcome(t, issue.ID, map[string]any{"assignee_type": "agent", "assignee_id": agentID})
+ seedActorInboxRow(t, issue.ID)
+ postComment(t, issue.ID, map[string]any{"content": "please take a look"})
+ if got := activeInboxCount(t, issue.ID); got != 0 {
+ t.Fatalf("active inbox = %d, want 0", got)
+ }
+ })
+
+ t.Run("rerunning issue archives inbox", func(t *testing.T) {
+ issue := createIssueForTest(t, map[string]any{"title": "rerun wakes agent", "status": "backlog"})
+ updateIssueForOutcome(t, issue.ID, map[string]any{"assignee_type": "agent", "assignee_id": agentID})
+ seedActorInboxRow(t, issue.ID)
+ testutil.Call(t, testHandler.RerunIssue,
+ withURLParam(newRequest("POST", "/api/issues/"+issue.ID+"/rerun", map[string]any{}), "id", issue.ID)).Want(http.StatusAccepted)
+ if got := activeInboxCount(t, issue.ID); got != 0 {
+ t.Fatalf("active inbox = %d, want 0", got)
+ }
+ })
+}
diff --git a/server/internal/handler/comment.go b/server/internal/handler/comment.go
index 70fd62b7c5..0bdcc66e8a 100644
--- a/server/internal/handler/comment.go
+++ b/server/internal/handler/comment.go
@@ -2021,6 +2021,9 @@ func (h *Handler) triggerTasksForComment(ctx context.Context, issue db.Issue, co
for agentID, result := range steered {
enqueued[agentID] = result
}
+ if commentResultsTriggeredAgent(enqueued) {
+ h.archiveActorInboxOnAgentTrigger(ctx, uuidToString(issue.WorkspaceID), uuidToString(issue.ID), actorType, actorID)
+ }
outcomes := commentTriggerOutcomes(targets, enqueued)
h.noteCommentInvocationDenied(ctx, issue, comment, outcomes)
return outcomes
diff --git a/server/internal/handler/issue.go b/server/internal/handler/issue.go
index f6a9fcfc6f..f0f24836cb 100644
--- a/server/internal/handler/issue.go
+++ b/server/internal/handler/issue.go
@@ -4379,6 +4379,9 @@ func (h *Handler) UpdateIssue(w http.ResponseWriter, r *http.Request) {
h.stopPreviousAssigneeRuns(r.Context(), prevIssue, issue, actorType, actorID)
}
resp.RunOutcome = h.resolveIssueRun(r, issue, trigger, runDecided, req.SuppressRun, actorType, actorID, workspaceID, handoffNote)
+ if issueRunTriggeredAgent(resp.RunOutcome) {
+ h.archiveActorInboxOnAgentTrigger(r.Context(), workspaceID, uuidToString(issue.ID), actorType, actorID)
+ }
// Sub-issue rules on the parent (the child_done system rule and sub-issue
// conditions): the write recorded the change; process it now. A failure
@@ -5210,6 +5213,9 @@ func (h *Handler) BatchUpdateIssues(w http.ResponseWriter, r *http.Request) {
h.stopPreviousAssigneeRuns(r.Context(), prevIssue, issue, actorType, actorID)
}
runOutcome = h.resolveIssueRun(r, issue, trigger, runDecided, req.Updates.SuppressRun, actorType, actorID, workspaceID, batchHandoffNote)
+ if issueRunTriggeredAgent(runOutcome) {
+ h.archiveActorInboxOnAgentTrigger(r.Context(), workspaceID, issueID, actorType, actorID)
+ }
// No status change — not even → cancelled — cancels active tasks here,
// mirroring UpdateIssue (MUL-4465). See that handler for the rationale.
diff --git a/server/internal/handler/issue_wakeup.go b/server/internal/handler/issue_wakeup.go
index 1c92475e6b..4e1c2f476b 100644
--- a/server/internal/handler/issue_wakeup.go
+++ b/server/internal/handler/issue_wakeup.go
@@ -369,6 +369,8 @@ func (h *Handler) TriggerIssueWakeup(w http.ResponseWriter, r *http.Request) {
wakeupError(w, err)
return
}
+ actorType, actorID := h.resolveActor(r, requestUserID(r), uuidToString(issue.WorkspaceID))
+ h.archiveActorInboxOnAgentTrigger(r.Context(), uuidToString(issue.WorkspaceID), uuidToString(issue.ID), actorType, actorID)
w.WriteHeader(http.StatusNoContent)
}
diff --git a/server/internal/handler/notification_preference.go b/server/internal/handler/notification_preference.go
index 13e3a46930..ca39ebcf9a 100644
--- a/server/internal/handler/notification_preference.go
+++ b/server/internal/handler/notification_preference.go
@@ -1,6 +1,7 @@
package handler
import (
+ "context"
"encoding/json"
"errors"
"log/slog"
@@ -20,31 +21,32 @@ import (
// preferences map so a single endpoint covers all user notification
// preferences. The `auto_archive_*` keys are not event groups either: each
// says whether one action you take on an issue archives your notifications on
-// it. Completing, commenting, other status changes and reassigning archive
-// unless "muted"; priority, project, date and label edits only with "all".
-// `after_auto_archive` is where the client goes when the notification you are
-// reading is archived that way.
+// it. Completing and triggering an agent archive unless "muted"; commenting,
+// status changes, reassigning, priority, project, date and label edits archive
+// only with "all". `after_auto_archive` is where the client goes when the
+// notification you are reading is archived that way.
var validNotifGroups = map[string]bool{
- "assignments": true,
- "status_changes": true,
- "comments": true,
- "chat_replies": true,
- "mentions": true,
- "reactions": true,
- "updates": true,
- "agent_activity": true,
- "new_issues": true,
- "system_notifications": true,
- "auto_archive_completed": true,
- "auto_archive_on_comment": true,
- "auto_archive_on_status": true,
- "auto_archive_on_assignee": true,
- "auto_archive_on_priority": true,
- "auto_archive_on_project": true,
- "auto_archive_on_dates": true,
- "auto_archive_on_labels": true,
- "after_auto_archive": true,
- "others_issues": true,
+ "assignments": true,
+ "status_changes": true,
+ "comments": true,
+ "chat_replies": true,
+ "mentions": true,
+ "reactions": true,
+ "updates": true,
+ "agent_activity": true,
+ "new_issues": true,
+ "system_notifications": true,
+ "auto_archive_completed": true,
+ "auto_archive_on_agent_trigger": true,
+ "auto_archive_on_comment": true,
+ "auto_archive_on_status": true,
+ "auto_archive_on_assignee": true,
+ "auto_archive_on_priority": true,
+ "auto_archive_on_project": true,
+ "auto_archive_on_dates": true,
+ "auto_archive_on_labels": true,
+ "after_auto_archive": true,
+ "others_issues": true,
}
// validNotifValues is the set of allowed preference values for a group not
@@ -267,3 +269,28 @@ func (h *Handler) ResolveAutoArchivePrompt(w http.ResponseWriter, r *http.Reques
}
h.GetNotificationPreferences(w, r)
}
+
+func (h *Handler) archiveActorInboxOnAgentTrigger(ctx context.Context, workspaceID, issueID, actorType, actorID string) {
+ inbox.ArchiveActorIssueInbox(ctx, h.Queries, h.Bus, workspaceID, issueID, actorType, actorID, inbox.AutoArchiveAgentTriggerPref)
+}
+
+// issueRunTriggeredAgent reports whether an issue write actually handed work to
+// an agent (queued a fresh run or coalesced into a pending one). Deferred
+// (backlog parking, suppress_run, self-loop) and blocked outcomes do not count.
+func issueRunTriggeredAgent(outcome *IssueRunOutcome) bool {
+ return outcome != nil && (outcome.Status == DispatchQueued || outcome.Status == DispatchCoalesced)
+}
+
+// commentResultsTriggeredAgent reports whether a comment actually reached at
+// least one agent (queued, coalesced into a pending run, deferred to an active
+// run's completion reconcile, or steered into a running turn). Blocked targets
+// do not count.
+func commentResultsTriggeredAgent(results map[string]commentEnqueueResult) bool {
+ for _, res := range results {
+ switch res.status {
+ case DispatchQueued, DispatchCoalesced, DispatchDeferred, DispatchSteered:
+ return true
+ }
+ }
+ return false
+}
diff --git a/server/internal/handler/notification_preference_test.go b/server/internal/handler/notification_preference_test.go
index f4e989b476..1d2c35bfee 100644
--- a/server/internal/handler/notification_preference_test.go
+++ b/server/internal/handler/notification_preference_test.go
@@ -448,7 +448,7 @@ func TestAutoArchivePromptResolvesEveryPendingWorkspace(t *testing.T) {
otherUserID := dbfx.User(t, "Auto-archive teammate", strings.ToLower(suffix)+"@multica.test")
dbfx.Member(t, testWorkspaceID, otherUserID, "member")
- pending := `{"auto_archive_on_comment": "muted", "auto_archive_on_status": "muted",
+ pending := `{"auto_archive_on_agent_trigger": "muted", "auto_archive_on_comment": "muted", "auto_archive_on_status": "muted",
"auto_archive_on_assignee": "muted", "auto_archive_prompt": "pending", "updates": "muted"}`
rows := [][2]string{{testWorkspaceID, testUserID}, {otherWorkspaceID, testUserID}, {testWorkspaceID, otherUserID}}
for _, row := range rows {
@@ -522,27 +522,28 @@ func TestAutoArchivePromptResolvesEveryPendingWorkspace(t *testing.T) {
resolve := httptest.NewRecorder()
testHandler.ResolveAutoArchivePrompt(resolve, notificationPreferenceRequest(t, http.MethodPost, map[string]string{
- "auto_archive_completed": "all",
- "auto_archive_on_comment": "all",
- "auto_archive_on_status": "all",
- "auto_archive_on_assignee": "all",
+ "auto_archive_completed": "all",
+ "auto_archive_on_agent_trigger": "all",
+ "auto_archive_on_comment": "muted",
+ "auto_archive_on_status": "muted",
+ "auto_archive_on_assignee": "muted",
}))
after := decode(resolve)
if after.AutoArchivePrompt {
t.Fatal("auto_archive_prompt still true after resolving")
}
- if after.Preferences["auto_archive_on_comment"] != "all" || after.Preferences["updates"] != "muted" {
+ if after.Preferences["auto_archive_on_agent_trigger"] != "all" || after.Preferences["updates"] != "muted" {
t.Fatalf("resolved preferences = %#v", after.Preferences)
}
for _, workspaceID := range []string{testWorkspaceID, otherWorkspaceID} {
prefs := stored(workspaceID, testUserID)
- if _, ok := prefs[autoArchivePromptKey]; ok || prefs["auto_archive_on_status"] != "all" {
+ if _, ok := prefs[autoArchivePromptKey]; ok || prefs["auto_archive_on_agent_trigger"] != "all" {
t.Errorf("workspace %s not resolved: %#v", workspaceID, prefs)
}
}
if prefs := stored(testWorkspaceID, otherUserID); prefs[autoArchivePromptKey] != "pending" ||
- prefs["auto_archive_on_status"] != "muted" {
+ prefs["auto_archive_on_agent_trigger"] != "muted" {
t.Errorf("another member's prompt changed: %#v", prefs)
}
}
diff --git a/server/internal/handler/task_lifecycle.go b/server/internal/handler/task_lifecycle.go
index 1278144a76..b06cc57287 100644
--- a/server/internal/handler/task_lifecycle.go
+++ b/server/internal/handler/task_lifecycle.go
@@ -270,6 +270,7 @@ func (h *Handler) rerunIssue(w http.ResponseWriter, r *http.Request, issue db.Is
writeError(w, http.StatusBadRequest, err.Error())
return
}
+ h.archiveActorInboxOnAgentTrigger(r.Context(), workspaceID, uuidToString(issue.ID), actorType, actorID)
resp := taskToResponse(*task, uuidToString(issue.WorkspaceID))
h.hydrateTaskAttributions(r.Context(), []*TaskAttribution{resp.Attribution})
writeJSON(w, http.StatusAccepted, resp)
diff --git a/server/internal/handler/task_supplement.go b/server/internal/handler/task_supplement.go
index 8710e0b19e..b56b866783 100644
--- a/server/internal/handler/task_supplement.go
+++ b/server/internal/handler/task_supplement.go
@@ -409,6 +409,7 @@ func (h *Handler) CreateTaskSupplement(w http.ResponseWriter, r *http.Request) {
"comment": resp, "issue_title": issue.Title, "issue_revision": created.IssueRevision,
})
h.notifyTaskSupplementAvailable(task)
+ h.archiveActorInboxOnAgentTrigger(r.Context(), uuidToString(issue.WorkspaceID), uuidToString(issue.ID), "member", uuidToString(authorID))
writeJSON(w, http.StatusCreated, resp)
}
diff --git a/server/internal/inbox/auto_archive.go b/server/internal/inbox/auto_archive.go
new file mode 100644
index 0000000000..520bff6e7d
--- /dev/null
+++ b/server/internal/inbox/auto_archive.go
@@ -0,0 +1,147 @@
+package inbox
+
+import (
+ "context"
+ "encoding/json"
+ "errors"
+ "log/slog"
+ "slices"
+
+ "github.com/jackc/pgx/v5"
+ "github.com/multica-ai/multica/server/internal/events"
+ "github.com/multica-ai/multica/server/internal/util"
+ db "github.com/multica-ai/multica/server/pkg/db/generated"
+ "github.com/multica-ai/multica/server/pkg/protocol"
+)
+
+// Preference keys, one per action you take on an issue, that archive your own
+// notifications on it. Completing means moving it to a done or closed status;
+// triggering an agent means your action actually queued, coalesced, deferred
+// to an active run, steered, or reran an agent on the issue. Completing and
+// triggering an agent are on unless "muted"; other edits are off unless "all".
+const (
+ AutoArchiveCompletedPref = "auto_archive_completed"
+ AutoArchiveAgentTriggerPref = "auto_archive_on_agent_trigger"
+ AutoArchiveCommentPref = "auto_archive_on_comment"
+ AutoArchiveStatusPref = "auto_archive_on_status"
+ AutoArchiveAssigneePref = "auto_archive_on_assignee"
+ AutoArchivePriorityPref = "auto_archive_on_priority"
+ AutoArchiveProjectPref = "auto_archive_on_project"
+ AutoArchiveDatesPref = "auto_archive_on_dates"
+ AutoArchiveLabelsPref = "auto_archive_on_labels"
+)
+
+var autoArchiveOnByDefault = map[string]bool{
+ AutoArchiveCompletedPref: true,
+ AutoArchiveAgentTriggerPref: true,
+}
+
+// Why the actor's notifications were archived, sent as `reason` on
+// inbox:batch-archived so the client can tell its user's own action apart.
+const (
+ ArchiveReasonCompleted = "issue_status_terminal"
+ ArchiveReasonActed = "actor_acted"
+)
+
+// AutoArchivesOn reports whether prefs archive the actor's notifications when
+// they take action. nil prefs, a member without a stored row, applies the
+// defaults.
+func AutoArchivesOn(prefs map[string]string, action string) bool {
+ if autoArchiveOnByDefault[action] {
+ return prefs[action] != "muted"
+ }
+ return prefs[action] == "all"
+}
+
+// ArchiveActorIssueInbox archives the actor's own notifications for an issue,
+// read or not, when their preferences archive on one of the actions they just
+// took on it. Completing archives the same set "Archive completed" clears by
+// hand. Other recipients keep theirs: someone else acting on an issue is news
+// they have not seen yet. A later notification brings the issue back.
+func ArchiveActorIssueInbox(
+ ctx context.Context,
+ queries *db.Queries,
+ pub Publisher,
+ workspaceID string,
+ issueID string,
+ actorType string,
+ actorID string,
+ actions ...string,
+) {
+ if actorType != "member" || actorID == "" || issueID == "" || workspaceID == "" || len(actions) == 0 {
+ return
+ }
+ wsUUID, err := util.ParseUUID(workspaceID)
+ if err != nil {
+ return
+ }
+ actorUUID, err := util.ParseUUID(actorID)
+ if err != nil {
+ return
+ }
+ issueUUID, err := util.ParseUUID(issueID)
+ if err != nil {
+ return
+ }
+
+ // FAIL CLOSED: archiving on a guess hides notifications the user wanted.
+ pref, err := queries.GetNotificationPreference(ctx, db.GetNotificationPreferenceParams{
+ WorkspaceID: wsUUID,
+ UserID: actorUUID,
+ })
+ var prefs map[string]string
+ switch {
+ case errors.Is(err, pgx.ErrNoRows):
+ case err != nil:
+ slog.Warn("auto-archive actor issue inbox: load preference failed; keeping rows",
+ "workspace_id", workspaceID, "issue_id", issueID, "actions", actions, "error", err)
+ return
+ default:
+ if err := json.Unmarshal(pref.Preferences, &prefs); err != nil {
+ slog.Warn("auto-archive actor issue inbox: bad preference JSON; keeping rows",
+ "workspace_id", workspaceID, "issue_id", issueID, "actions", actions, "error", err)
+ return
+ }
+ }
+ var archivedOn []string
+ for _, action := range actions {
+ if AutoArchivesOn(prefs, action) {
+ archivedOn = append(archivedOn, action)
+ }
+ }
+ if len(archivedOn) == 0 {
+ return
+ }
+ reason := ArchiveReasonActed
+ if slices.Contains(archivedOn, AutoArchiveCompletedPref) {
+ reason = ArchiveReasonCompleted
+ }
+
+ count, err := queries.ArchiveInboxByIssue(ctx, db.ArchiveInboxByIssueParams{
+ WorkspaceID: wsUUID,
+ RecipientType: "member",
+ RecipientID: actorUUID,
+ IssueID: issueUUID,
+ })
+ if err != nil {
+ slog.Error("auto-archive actor issue inbox: query failed",
+ "workspace_id", workspaceID, "issue_id", issueID, "reason", reason, "error", err)
+ return
+ }
+ if count == 0 {
+ return
+ }
+ publish(pub, events.Event{
+ Type: protocol.EventInboxBatchArchived,
+ WorkspaceID: workspaceID,
+ Payload: map[string]any{
+ "recipient_id": actorID,
+ "count": count,
+ "issue_id": issueID,
+ "reason": reason,
+ },
+ })
+
+ slog.Info("auto-archive actor issue inbox: archived rows",
+ "workspace_id", workspaceID, "issue_id", issueID, "reason", reason, "row_count", count)
+}
diff --git a/server/internal/migrations/auto_archive_prompt_migration_test.go b/server/internal/migrations/auto_archive_prompt_migration_test.go
index 3e60cbc96f..2c0a496df8 100644
--- a/server/internal/migrations/auto_archive_prompt_migration_test.go
+++ b/server/internal/migrations/auto_archive_prompt_migration_test.go
@@ -97,6 +97,9 @@ func TestAutoArchivePromptAsksOnlyMembersWhoArchived(t *testing.T) {
if _, err := conn.Exec(ctx, readMigrationFile(t, "718_auto_archive_prompt.up.sql")); err != nil {
t.Fatalf("apply 718 up: %v", err)
}
+ if _, err := conn.Exec(ctx, readMigrationFile(t, "722_auto_archive_agent_trigger_prompt.up.sql")); err != nil {
+ t.Fatalf("apply 722 up: %v", err)
+ }
stored := func() map[string]map[string]string {
t.Helper()
@@ -124,18 +127,20 @@ func TestAutoArchivePromptAsksOnlyMembersWhoArchived(t *testing.T) {
got := stored()
want := map[string]map[string]string{
ws + "/" + archiver: {
- "auto_archive_on_comment": "muted",
- "auto_archive_on_status": "muted",
- "auto_archive_on_assignee": "muted",
- "auto_archive_prompt": "pending",
+ "auto_archive_on_agent_trigger": "muted",
+ "auto_archive_on_comment": "muted",
+ "auto_archive_on_status": "muted",
+ "auto_archive_on_assignee": "muted",
+ "auto_archive_prompt": "pending",
},
ws + "/" + chooser: {
- "auto_archive_completed": "muted",
- "auto_archive_on_comment": "all",
- "auto_archive_on_status": "muted",
- "auto_archive_on_assignee": "muted",
- "auto_archive_prompt": "pending",
- "updates": "muted",
+ "auto_archive_completed": "muted",
+ "auto_archive_on_agent_trigger": "muted",
+ "auto_archive_on_comment": "all",
+ "auto_archive_on_status": "muted",
+ "auto_archive_on_assignee": "muted",
+ "auto_archive_prompt": "pending",
+ "updates": "muted",
},
}
if len(got) != len(want) {
@@ -152,6 +157,15 @@ func TestAutoArchivePromptAsksOnlyMembersWhoArchived(t *testing.T) {
}
}
+ if _, err := conn.Exec(ctx, readMigrationFile(t, "722_auto_archive_agent_trigger_prompt.down.sql")); err != nil {
+ t.Fatalf("apply 722 down: %v", err)
+ }
+ for key, prefs := range stored() {
+ if _, ok := prefs["auto_archive_on_agent_trigger"]; ok {
+ t.Errorf("%s still has auto_archive_on_agent_trigger after 722 down: %v", key, prefs)
+ }
+ }
+
if _, err := conn.Exec(ctx, readMigrationFile(t, "718_auto_archive_prompt.down.sql")); err != nil {
t.Fatalf("apply 718 down: %v", err)
}
diff --git a/server/migrations/722_auto_archive_agent_trigger_prompt.down.sql b/server/migrations/722_auto_archive_agent_trigger_prompt.down.sql
new file mode 100644
index 0000000000..ab86a3f4a2
--- /dev/null
+++ b/server/migrations/722_auto_archive_agent_trigger_prompt.down.sql
@@ -0,0 +1,5 @@
+UPDATE notification_preference
+SET preferences = preferences - 'auto_archive_on_agent_trigger',
+ updated_at = now()
+WHERE preferences ->> 'auto_archive_prompt' = 'pending'
+ AND preferences ->> 'auto_archive_on_agent_trigger' = 'muted';
diff --git a/server/migrations/722_auto_archive_agent_trigger_prompt.up.sql b/server/migrations/722_auto_archive_agent_trigger_prompt.up.sql
new file mode 100644
index 0000000000..f8ce13cb26
--- /dev/null
+++ b/server/migrations/722_auto_archive_agent_trigger_prompt.up.sql
@@ -0,0 +1,10 @@
+-- MUL-9820: the default auto-archive preset now archives when you complete an
+-- issue or trigger an agent, rather than on any comment, status advance or
+-- reassignment. Keep the one-time prompt rows seeded by migration 718 on their
+-- pre-release behavior (completing only) by also muting
+-- auto_archive_on_agent_trigger until the member answers. Any value they
+-- already stored wins.
+UPDATE notification_preference
+SET preferences = jsonb_build_object('auto_archive_on_agent_trigger', 'muted') || preferences,
+ updated_at = now()
+WHERE preferences ->> 'auto_archive_prompt' = 'pending';