Skip to content

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

Go

fix(inbox): stop notifying squad members on @squad mentions (#10794)

Bohan Jiang001a382512f0
diff --git a/apps/docs/content/docs/comments.fr.mdx b/apps/docs/content/docs/comments.fr.mdx
index e77b38f042..3da3a83066 100644
--- a/apps/docs/content/docs/comments.fr.mdx
+++ b/apps/docs/content/docs/comments.fr.mdx
@@ -96,7 +96,7 @@ Tapez `@` et choisissez une cible dans la liste :
|---|---|
| **Membre** | Reçoit une notification de mention dans la boîte de réception ; une @mention dans un commentaire ne crée pas d'abonnement. |
| **Agent** | Crée une exécution pour cet agent ; les agents n'ont pas de boîte de réception. |
-| **Squad** | Notifie les membres du squad et déclenche le chef du squad. |
+| **Squad** | Déclenche le chef du squad ; les membres du squad ne sont pas notifiés. |
| **Tâche** | Insère un lien vers une autre tâche — aucune notification, aucun déclenchement d'agent. |
| **@all** | Notifie tous les membres de l'espace de travail et ne déclenche aucun agent. |
diff --git a/apps/docs/content/docs/comments.ja.mdx b/apps/docs/content/docs/comments.ja.mdx
index 35af9cdf9f..a69f127b78 100644
--- a/apps/docs/content/docs/comments.ja.mdx
+++ b/apps/docs/content/docs/comments.ja.mdx
@@ -96,7 +96,7 @@ Web と Desktop では、投稿済みのコメント(自分のコメントを
|---|---|
| **メンバー** | インボックスにメンション通知が届きます。コメント内の @ では購読は発生しません。 |
| **エージェント** | そのエージェントの実行を作成します。エージェントにインボックスはありません。 |
-| **スクワッド** | スクワッドのメンバーに通知し、スクワッドのリーダーをトリガーします。 |
+| **スクワッド** | スクワッドのリーダーをトリガーします。スクワッドのメンバーには通知されません。 |
| **タスク** | 別のタスクへのリンクを挿入します。通知もエージェントのトリガーもありません。 |
| **@all** | すべてのワークスペースメンバーに通知し、どのエージェントもトリガーしません。 |
diff --git a/apps/docs/content/docs/comments.ko.mdx b/apps/docs/content/docs/comments.ko.mdx
index 8566115e36..a1370199ec 100644
--- a/apps/docs/content/docs/comments.ko.mdx
+++ b/apps/docs/content/docs/comments.ko.mdx
@@ -96,7 +96,7 @@ Web과 Desktop에서는 게시된 댓글(본인 댓글 포함)의 텍스트를
|---|---|
| **멤버** | 인박스에 멘션 알림이 도착합니다. 댓글의 @멘션 자체로는 구독되지 않습니다. |
| **에이전트** | 해당 에이전트의 실행이 생성됩니다. 에이전트에는 인박스가 없습니다. |
-| **스쿼드** | 스쿼드의 멤버에게 알리고 스쿼드 리더의 실행을 트리거합니다. |
+| **스쿼드** | 스쿼드 리더의 실행을 트리거합니다. 스쿼드 멤버에게는 알림이 가지 않습니다. |
| **태스크** | 다른 태스크의 링크를 삽입합니다. 알림을 보내거나 에이전트를 트리거하지 않습니다. |
| **@all** | 워크스페이스의 모든 멤버에게 알립니다. 에이전트는 트리거하지 않습니다. |
diff --git a/apps/docs/content/docs/comments.mdx b/apps/docs/content/docs/comments.mdx
index 30214ebdf2..31347f657c 100644
--- a/apps/docs/content/docs/comments.mdx
+++ b/apps/docs/content/docs/comments.mdx
@@ -96,7 +96,7 @@ Type `@` and pick a target from the list:
|---|---|
| **Member** | Gets a mention notification in the inbox; an @ in a comment does not create a subscription. |
| **Agent** | Creates a run for that agent; agents have no inbox. |
-| **Squad** | Notifies the squad's members and triggers the squad leader. |
+| **Squad** | Triggers the squad leader; squad members are not notified. |
| **Issue** | Inserts a link to another issue — no notification, no agent trigger. |
| **@all** | Notifies every workspace member and triggers no agent. |
diff --git a/apps/docs/content/docs/comments.zh-Hant.mdx b/apps/docs/content/docs/comments.zh-Hant.mdx
index b2e6b9b90a..d411ac7edd 100644
--- a/apps/docs/content/docs/comments.zh-Hant.mdx
+++ b/apps/docs/content/docs/comments.zh-Hant.mdx
@@ -96,7 +96,7 @@ import { ResolveThreadDemo } from "@/components/demos/resolve-thread-demo";
|---|---|
| **成員** | 收件箱收到提及通知;評論中的 @ 不會產生訂閱。 |
| **AI 代理** | 為該 AI 代理建立一次執行;AI 代理沒有收件箱。 |
-| **小隊** | 通知小隊中的成員,並觸發小隊 leader 執行。 |
+| **小隊** | 觸發小隊 leader 執行,不通知小隊成員。 |
| **任務** | 插入另一條任務的連結,不發通知,不觸發 AI 代理。 |
| **@all** | 通知全部工作區成員,不觸發任何 AI 代理。 |
diff --git a/apps/docs/content/docs/comments.zh.mdx b/apps/docs/content/docs/comments.zh.mdx
index ab59a96092..e2bd7ce6f4 100644
--- a/apps/docs/content/docs/comments.zh.mdx
+++ b/apps/docs/content/docs/comments.zh.mdx
@@ -96,7 +96,7 @@ import { ResolveThreadDemo } from "@/components/demos/resolve-thread-demo";
|---|---|
| **成员** | 收件箱收到提及通知;评论中的 @ 不会产生订阅。 |
| **智能体** | 为该智能体创建一次运行;智能体没有收件箱。 |
-| **小队** | 通知小队中的成员,并触发小队 leader 执行。 |
+| **小队** | 触发小队 leader 执行,不通知小队成员。 |
| **任务** | 插入另一条任务的链接,不发通知,不触发智能体。 |
| **@all** | 通知全部工作区成员,不触发任何智能体。 |
diff --git a/apps/docs/content/docs/inbox.fr.mdx b/apps/docs/content/docs/inbox.fr.mdx
index d2b03d67a8..e1722e5931 100644
--- a/apps/docs/content/docs/inbox.fr.mdx
+++ b/apps/docs/content/docs/inbox.fr.mdx
@@ -105,7 +105,7 @@ Reporter retire une tâche de votre boîte de réception jusqu'à l'heure choisi
Tant qu'une tâche est reportée :
- ses nouvelles notifications attendent avec elle et ne comptent pas dans le badge non lu. À son retour, la ligne indique **Report terminé** et le nombre de nouveautés arrivées entre-temps ;
-- elle revient plus tôt si quelqu'un vous mentionne nommément, si elle vous est assignée, si une exécution échoue, si une app demande votre action ou si toutes ses sous-tâches sont terminées. Les mentions `@all` et d'escouade ne la réveillent pas ;
+- elle revient plus tôt si quelqu'un vous mentionne nommément, si elle vous est assignée, si une exécution échoue, si une app demande votre action ou si toutes ses sous-tâches sont terminées. Les mentions `@all` ne la réveillent pas ;
- **Tout marquer comme lu** et les actions d'archivage groupé l'ignorent. L'archiver met fin au report, tout comme terminer vous-même la tâche quand **Archiver les tâches que vous terminez** est activé ;
- ouvrir la tâche depuis ailleurs ne la marque pas comme lue et ne met pas fin au report. Son en-tête indique quand elle revient ; ouvrez-le pour la faire revenir maintenant (`H`) ou changer l'heure.
diff --git a/apps/docs/content/docs/inbox.ja.mdx b/apps/docs/content/docs/inbox.ja.mdx
index c25052918a..8037f878c7 100644
--- a/apps/docs/content/docs/inbox.ja.mdx
+++ b/apps/docs/content/docs/inbox.ja.mdx
@@ -105,7 +105,7 @@ multica inbox list --project <project-id> --type mentioned --output json
スヌーズ中のタスクは次のように扱われます。
- 新しい通知も一緒に待機し、未読バッジには数えられません。戻ってきた行には **スヌーズ終了** と、その間に届いた更新の数が表示されます。
-- 名指しでメンションされたとき、自分に割り当てられたとき、実行が失敗したとき、アプリが操作を求めたとき、すべてのサブタスクが完了したときは早めに戻ります。`@all` とスクワッドへのメンションでは戻りません。
+- 名指しでメンションされたとき、自分に割り当てられたとき、実行が失敗したとき、アプリが操作を求めたとき、すべてのサブタスクが完了したときは早めに戻ります。`@all` へのメンションでは戻りません。
- **すべて既読にする** や一括アーカイブはスヌーズ中のタスクをスキップします。アーカイブするとスヌーズは終了します。**自分が完了したタスクをアーカイブ** がオンのときに自分でタスクを完了した場合も同じです。
- ほかの場所からタスクを開いても既読にはならず、スヌーズも終了しません。ヘッダーに戻る時間が表示され、そこから今すぐ戻す(`H`)か時間を変更できます。
diff --git a/apps/docs/content/docs/inbox.ko.mdx b/apps/docs/content/docs/inbox.ko.mdx
index e60c715a8f..04d6fae42e 100644
--- a/apps/docs/content/docs/inbox.ko.mdx
+++ b/apps/docs/content/docs/inbox.ko.mdx
@@ -105,7 +105,7 @@ multica inbox list --project <project-id> --type mentioned --output json
태스크를 미뤄둔 동안에는:
- 새 알림도 함께 기다리며 읽지 않음 배지에 포함되지 않습니다. 돌아온 행에는 **다시 알림 종료**와 그동안 쌓인 업데이트 수가 표시됩니다.
-- 누군가 이름으로 멘션하거나, 나에게 할당되거나, 실행이 실패하거나, 앱이 작업을 요청하거나, 모든 하위 태스크가 끝나면 일찍 돌아옵니다. `@all`과 스쿼드 멘션으로는 돌아오지 않습니다.
+- 누군가 이름으로 멘션하거나, 나에게 할당되거나, 실행이 실패하거나, 앱이 작업을 요청하거나, 모든 하위 태스크가 끝나면 일찍 돌아옵니다. `@all` 멘션으로는 돌아오지 않습니다.
- **모두 읽음으로 표시**와 일괄 보관은 미뤄둔 태스크를 건너뜁니다. 보관하면 미루기가 끝나며, **내가 완료한 태스크 보관**이 켜진 상태에서 직접 태스크를 완료한 경우도 마찬가지입니다.
- 다른 곳에서 태스크를 열어도 읽음으로 바뀌지 않고 미루기도 끝나지 않습니다. 헤더에 돌아올 시간이 표시되며, 거기서 지금 되돌리거나(`H`) 시간을 바꿀 수 있습니다.
diff --git a/apps/docs/content/docs/inbox.mdx b/apps/docs/content/docs/inbox.mdx
index be14b668d9..48235f3921 100644
--- a/apps/docs/content/docs/inbox.mdx
+++ b/apps/docs/content/docs/inbox.mdx
@@ -105,7 +105,7 @@ Snooze takes an issue out of your inbox until a time you pick, then brings it ba
While an issue is snoozed:
- new notifications on it wait with it and don't count toward the unread badge. When it comes back, the row says **Snooze ended** and how many updates arrived meanwhile;
-- it comes back early when someone mentions you by name, it is assigned to you, a run fails, an app asks for your action, or all its sub-issues finish. `@all` and squad mentions don't wake it;
+- it comes back early when someone mentions you by name, it is assigned to you, a run fails, an app asks for your action, or all its sub-issues finish. `@all` mentions don't wake it;
- **Mark all as read** and the archive-all actions leave it alone. Archiving it ends the snooze, and so does completing the issue yourself while **Archive issues you complete** is on;
- opening the issue from anywhere else doesn't read it or end the snooze. Its header shows when it comes back; open that to bring it back now (`H`) or change the time.
diff --git a/apps/docs/content/docs/inbox.zh-Hant.mdx b/apps/docs/content/docs/inbox.zh-Hant.mdx
index 17e976ac42..43c6c2c793 100644
--- a/apps/docs/content/docs/inbox.zh-Hant.mdx
+++ b/apps/docs/content/docs/inbox.zh-Hant.mdx
@@ -105,7 +105,7 @@ multica inbox list --project <project-id> --type mentioned --output json
任務延後期間:
- 它的新通知會跟著一起等,不計入未讀角標。回來時,這一列會顯示 **延後到期** 以及期間有多少則動態;
-- 有人點名 @ 你、它被指派給你、執行失敗、應用程式請求你操作,或全部子任務完成時,它會提前回來。`@all` 和小隊提及不會喚醒它;
+- 有人點名 @ 你、它被指派給你、執行失敗、應用程式請求你操作,或全部子任務完成時,它會提前回來。`@all` 提及不會喚醒它;
- **全部標為已讀** 和各種全部歸檔操作會跳過它。歸檔它會結束延後;開著 **自動歸檔我完成的任務** 時你自己完成這個任務,也一樣;
- 從別處開啟這個任務不會把它標為已讀,也不會結束延後。任務頁首會顯示它何時回來,點開可以讓它現在回來(`H`)或修改時間。
diff --git a/apps/docs/content/docs/inbox.zh.mdx b/apps/docs/content/docs/inbox.zh.mdx
index ee1927dd5b..fa81e08da0 100644
--- a/apps/docs/content/docs/inbox.zh.mdx
+++ b/apps/docs/content/docs/inbox.zh.mdx
@@ -105,7 +105,7 @@ multica inbox list --project <project-id> --type mentioned --output json
任务延后期间:
- 它的新通知会跟着一起等,不计入未读角标。回来时,这一行会显示 **延后到期** 以及期间有多少条动态;
-- 有人点名 @ 你、它被指派给你、运行失败、应用请求你操作,或全部子任务完成时,它会提前回来。`@all` 和小队提及不会唤醒它;
+- 有人点名 @ 你、它被指派给你、运行失败、应用请求你操作,或全部子任务完成时,它会提前回来。`@all` 提及不会唤醒它;
- **全部标为已读** 和各种全部归档操作会跳过它。归档它会结束延后;开着 **自动归档我完成的任务** 时你自己完成这个任务,也一样;
- 从别处打开这个任务不会把它标为已读,也不会结束延后。任务页头会显示它何时回来,点开可以让它现在回来(`H`)或修改时间。
diff --git a/server/cmd/server/notification_listeners.go b/server/cmd/server/notification_listeners.go
index 2b4f758adf..3dd535f96e 100644
--- a/server/cmd/server/notification_listeners.go
+++ b/server/cmd/server/notification_listeners.go
@@ -817,8 +817,10 @@ func notifyDelegatedIssueCreated(
// notifyMentionedMembers creates inbox items for each @mentioned member,
// excluding the actor and any IDs in the skip set. When an @all mention is
-// present, all workspace members are notified (excluding agents). Returns the
-// members that received a row.
+// present, all workspace members are notified (excluding agents). An @squad
+// mention only triggers the squad leader (handled by the comment-trigger
+// path); it does not notify the squad's human members. Returns the members
+// that received a row.
func notifyMentionedMembers(
bus *events.Bus,
queries *db.Queries,
@@ -834,20 +836,18 @@ func notifyMentionedMembers(
) map[string]bool {
notified := map[string]bool{}
// Collect the set of member IDs to notify, each with how the mention
- // reached them. Naming someone outranks reaching them through a squad,
- // which outranks @all.
+ // reached them. Naming someone outranks reaching them through @all.
recipientIDs := map[string]bool{}
via := map[string]string{}
reach := func(id, how string) {
recipientIDs[id] = true
- if via[id] == inbox.MentionViaMember || (via[id] == inbox.MentionViaSquad && how == inbox.MentionViaAll) {
+ if via[id] == inbox.MentionViaMember {
return
}
via[id] = how
}
hasAll := false
- var squadIDs []string
for _, m := range mentions {
if m.Type == "all" {
hasAll = true
@@ -859,29 +859,6 @@ func notifyMentionedMembers(
}
reach(m.ID, inbox.MentionViaMember)
}
- if m.Type == "squad" {
- squadIDs = append(squadIDs, m.ID)
- }
- }
-
- // Expand each @squad mention to its human members. Agent members of a
- // squad are reached via comment-trigger / assignment paths, not the
- // mention-inbox path, so we only seed member-typed recipients here.
- for _, sid := range squadIDs {
- squadUUID, err := util.ParseUUID(sid)
- if err != nil {
- continue
- }
- members, err := queries.ListSquadMembers(context.Background(), squadUUID)
- if err != nil {
- slog.Error("failed to list squad members for @squad mention", "squad_id", sid, "error", err)
- continue
- }
- for _, sm := range members {
- if sm.MemberType == "member" {
- reach(util.UUIDToString(sm.MemberID), inbox.MentionViaSquad)
- }
- }
}
// If @all is present, expand to all workspace members.
diff --git a/server/cmd/server/notification_membership_test.go b/server/cmd/server/notification_membership_test.go
index 6037da7a0f..6ec32f42f1 100644
--- a/server/cmd/server/notification_membership_test.go
+++ b/server/cmd/server/notification_membership_test.go
@@ -72,7 +72,10 @@ func TestNotification_CurrentMembership(t *testing.T) {
payload := map[string]any{"issue_id": issueID, "issue_title": issue.Title, "issue_status": issue.Status}
expectedType := "mentioned"
content := "[@Recipient](mention://member/" + recipient + ")"
- if source == "description squad created" || source == "description squad updated" || source == "comment squad" {
+ // An @squad mention only triggers the squad leader; the squad's
+ // human members get no inbox row, current or removed.
+ squadSource := source == "description squad created" || source == "description squad updated" || source == "comment squad"
+ if squadSource {
agent := fx.Agent(t, "Leader", "")
squad := fx.Squad(t, "Squad", agent)
fx.SquadMember(t, squad, "member", recipient)
@@ -163,7 +166,7 @@ func TestNotification_CurrentMembership(t *testing.T) {
e.Payload = payload
bus.Publish(e)
want := 1
- if removed {
+ if removed || squadSource {
want = 0
}
if n := fx.Count(t, `SELECT count(*) FROM inbox_item WHERE workspace_id = $1 AND recipient_id = $2`, testWorkspaceID, recipient); n != want {
@@ -177,6 +180,60 @@ func TestNotification_CurrentMembership(t *testing.T) {
}
}
+// A comment that @-mentions both a squad and one of its human members
+// notifies that member exactly once, as a direct mention.
+func TestNotification_SquadAndMemberMention(t *testing.T) {
+ fx := workspaceFixture(t)
+ recipient := fx.User(t, "Recipient", "[email protected]")
+ fx.Member(t, testWorkspaceID, recipient, "member")
+ issueID := fx.Issue(t, "Squad and member mention")
+ commentID := fx.Comment(t, issueID, "Original comment")
+ fx.Cleanup(t, `DELETE FROM inbox_item WHERE issue_id = $1`, issueID)
+ fx.Cleanup(t, `DELETE FROM issue_subscriber WHERE issue_id = $1`, issueID)
+ squad := fx.Squad(t, "Squad", fx.Agent(t, "Leader", ""))
+ fx.SquadMember(t, squad, "member", recipient)
+
+ bus := events.New()
+ registerNotificationListeners(bus, db.New(testPool))
+ content := "[@Squad](mention://squad/" + squad + ") [@Recipient](mention://member/" + recipient + ")"
+ bus.Publish(events.Event{
+ Type: protocol.EventCommentCreated,
+ WorkspaceID: testWorkspaceID,
+ ActorType: "member",
+ ActorID: testUserID,
+ Payload: map[string]any{
+ "issue_id": issueID, "issue_title": "Squad and member mention", "issue_status": "todo",
+ "comment": handler.CommentResponse{ID: commentID, IssueID: issueID, AuthorType: "member", AuthorID: testUserID, Content: content},
+ },
+ })
+
+ rows, err := testPool.Query(context.Background(),
+ `SELECT type, details FROM inbox_item WHERE issue_id = $1 AND recipient_id = $2`, issueID, recipient)
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer rows.Close()
+ var got []string
+ for rows.Next() {
+ var typ string
+ var details []byte
+ if err := rows.Scan(&typ, &details); err != nil {
+ t.Fatal(err)
+ }
+ var d struct {
+ MentionVia string `json:"mention_via"`
+ }
+ _ = json.Unmarshal(details, &d)
+ got = append(got, typ+"/"+d.MentionVia)
+ }
+ if err := rows.Err(); err != nil {
+ t.Fatal(err)
+ }
+ if len(got) != 1 || got[0] != "mentioned/member" {
+ t.Fatalf("inbox rows = %v, want [mentioned/member]", got)
+ }
+}
+
// Only the origin lookup is fault-injected to select the unconfirmed branch;
// task transitions and inbox writes still run against real PostgreSQL.
type originLookupFailure struct{ *pgxpool.Pool }
diff --git a/server/internal/inbox/snooze.go b/server/internal/inbox/snooze.go
index dac664faed..7025a364c2 100644
--- a/server/internal/inbox/snooze.go
+++ b/server/internal/inbox/snooze.go
@@ -15,8 +15,11 @@ const MaxSnooze = 366 * 24 * time.Hour
// the recipient.
const (
MentionViaMember = "member"
- MentionViaSquad = "squad"
- MentionViaAll = "all"
+ // MentionViaSquad is no longer written: an @squad mention only triggers
+ // the squad leader and does not notify squad members. It is kept because
+ // existing inbox rows still carry this value.
+ MentionViaSquad = "squad"
+ MentionViaAll = "all"
)
// wakingTypes are the notifications that end a snooze early: each one asks