Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
MUL-5958: 回复人类评论时跳过 assignee 兜底 (#6676)
Multica Evea937710fc746
diff --git a/apps/docs/content/docs/mentioning-agents.ja.mdx b/apps/docs/content/docs/mentioning-agents.ja.mdxindex d3f2081b9e..20a28443f0 100644--- a/apps/docs/content/docs/mentioning-agents.ja.mdx+++ b/apps/docs/content/docs/mentioning-agents.ja.mdx@@ -39,7 +39,7 @@ import { Callout } from "fumadocs-ui/components/callout";1. エージェントのコメントへの返信は、そのエージェントに渡されます。2. すでにエージェントが参加しているスレッドでの返信は、そのスレッドのエージェントを引き継ぎます。-3. どちらにも当てはまらない場合は、イシューの担当エージェントに渡されます。担当者がスクワッドのときはリーダーが処理します。+3. どちらにも当てはまらない最上位のコメントは、現在の担当エージェントに渡されます。担当者がスクワッドのときはリーダーが処理します。メンバーのコメントへの通常の返信は担当者へフォールバックしません。エージェントやスクワッドに参加してほしい場合は、明示的に @メンションしてください。コメントが他の対象(メンバーを含む)を明示的に @メンションしている場合、担当者へのフォールバックは適用されません。diff --git a/apps/docs/content/docs/mentioning-agents.ko.mdx b/apps/docs/content/docs/mentioning-agents.ko.mdxindex a0b2110a40..63cd56cff5 100644--- a/apps/docs/content/docs/mentioning-agents.ko.mdx+++ b/apps/docs/content/docs/mentioning-agents.ko.mdx@@ -39,7 +39,7 @@ import { Callout } from "fumadocs-ui/components/callout";1. 에이전트의 댓글에 답하면 해당 에이전트에게 전달됩니다.2. 이미 에이전트가 참여한 논의에 답하면 그 논의의 에이전트에게 전달됩니다.-3. 둘 다 해당하지 않으면 이슈의 에이전트 담당자에게 전달됩니다. 담당자가 스쿼드이면 리더가 처리합니다.+3. 둘 다 해당하지 않는 최상위 댓글은 현재 에이전트 담당자에게 전달됩니다. 담당자가 스쿼드이면 리더가 처리합니다. 멤버의 댓글에 직접 다는 일반 답글은 담당자에게 폴백되지 않습니다. 에이전트나 스쿼드를 참여시키려면 명시적으로 @멘션하세요.댓글에서 다른 대상(멤버 포함)을 명시적으로 @멘션하면 담당자 폴백을 사용하지 않습니다.diff --git a/apps/docs/content/docs/mentioning-agents.mdx b/apps/docs/content/docs/mentioning-agents.mdxindex 032759cf61..42cc93a9c3 100644--- a/apps/docs/content/docs/mentioning-agents.mdx+++ b/apps/docs/content/docs/mentioning-agents.mdx@@ -39,7 +39,7 @@ A plain comment (containing no @ at all) is routed by discussion context:1. Replying to an agent's comment hands it to that agent.2. Replying inside a discussion an agent already participates in keeps that discussion's agent.-3. Otherwise it goes to the issue's agent assignee; when the assignee is a squad, the leader handles it.+3. A top-level comment that matches neither case goes to the issue's agent assignee; when the assignee is a squad, the leader handles it. A plain reply directly to a member does not fall back to the assignee; @-mention an agent or squad explicitly when you want one to join.When a comment explicitly @-mentions other targets (including members), the assignee fallback no longer applies.diff --git a/apps/docs/content/docs/mentioning-agents.zh.mdx b/apps/docs/content/docs/mentioning-agents.zh.mdxindex 6622dc4b7b..5723d26577 100644--- a/apps/docs/content/docs/mentioning-agents.zh.mdx+++ b/apps/docs/content/docs/mentioning-agents.zh.mdx@@ -39,7 +39,7 @@ import { Callout } from "fumadocs-ui/components/callout";1. 回复智能体的评论时,交给该智能体。2. 在已有智能体参与的讨论中回复时,沿用这条讨论的智能体。-3. 都不满足时,交给 issue 的智能体负责人;负责人是小队时,由 leader 处理。+3. 都不满足的最外层评论,交给当前的智能体负责人;负责人是小队时,由 leader 处理。直接回复成员的普通评论不会走负责人兜底;需要智能体或小队加入时,请明确 @提及。评论明确 @了其他对象(包括成员)时,不再使用负责人兜底。diff --git a/server/cmd/server/comment_trigger_integration_test.go b/server/cmd/server/comment_trigger_integration_test.goindex b8af50e424..7a543e874a 100644--- a/server/cmd/server/comment_trigger_integration_test.go+++ b/server/cmd/server/comment_trigger_integration_test.go@@ -317,7 +317,7 @@ func TestCommentTriggerOnComment(t *testing.T) {}})- t.Run("reply to member thread without mentions falls back to assignee", func(t *testing.T) {+ t.Run("reply to unowned member thread without mentions does not trigger assignee", func(t *testing.T) {clearTasks(t, issueID)// Member starts a thread.threadID := postComment(t, issueID, "Hey team, what do you think?", nil)@@ -325,22 +325,30 @@ func TestCommentTriggerOnComment(t *testing.T) {clearTasks(t, issueID)// Another member reply (same user in this test, but the key is parent is by member).postComment(t, issueID, "I agree with you", strPtr(threadID))- if n := countPendingTasks(t, issueID); n != 1 {- t.Errorf("expected 1 pending task (assignee fallback), got %d", n)+ if n := countPendingTasks(t, issueID); n != 0 {+ t.Errorf("expected 0 pending tasks (unowned member thread), got %d", n)}})- t.Run("reply to member thread after agent replied triggers agent", func(t *testing.T) {+ t.Run("reply to member thread after agent handled root continues agent", func(t *testing.T) {clearTasks(t, issueID)// Member starts a thread (top-level comment).threadID := postComment(t, issueID, "Please fix this bug", nil)- clearTasks(t, issueID)+ // Complete, but retain, the root-triggered task so the thread keeps its+ // conversation owner without leaving pending work behind.+ if _, err := testPool.Exec(context.Background(), `+ UPDATE agent_task_queue+ SET status = 'completed', completed_at = now()+ WHERE issue_id = $1 AND trigger_comment_id = $2+ `, issueID, threadID); err != nil {+ t.Fatalf("failed to complete root-triggered task: %v", err)+ }// Agent replies in the thread.postCommentAsAgent(t, issueID, "Working on it, found the root cause.", agentID, strPtr(threadID))// Member follows up in the same thread without @mentioning the agent.postComment(t, issueID, "Great, please also check the edge case", strPtr(threadID))if n := countPendingTasks(t, issueID); n != 1 {- t.Errorf("expected 1 pending task (agent participated in thread), got %d", n)+ t.Errorf("expected 1 pending task (conversation continuation), got %d", n)}})diff --git a/server/internal/handler/comment.go b/server/internal/handler/comment.goindex f0e6743719..bf9a04e231 100644--- a/server/internal/handler/comment.go+++ b/server/internal/handler/comment.go@@ -2679,6 +2679,12 @@ func (h *Handler) computeCommentAgentTriggers(ctx context.Context, issue db.Issu}return triggers, nil}+ // A plain member-to-member reply must not start the issue assignee just+ // because the thread has no agent owner. Explicit mentions and existing+ // conversation owners were already resolved above.+ if parentComment.AuthorType == "member" {+ return nil, nil+ }}if trigger, ok := h.routeAssigneeFallback(ctx, issue, actorType, actorID, opts); ok {diff --git a/server/internal/handler/comment_trigger_preview_test.go b/server/internal/handler/comment_trigger_preview_test.goindex 8e307a9b1c..b0ea00bd1e 100644--- a/server/internal/handler/comment_trigger_preview_test.go+++ b/server/internal/handler/comment_trigger_preview_test.go@@ -173,6 +173,58 @@ func requirePreviewAgents(t *testing.T, preview CommentTriggerPreviewResponse, w}}+func TestCommentTriggers_PlainReplyToUnownedMemberRootSkipsAssigneeFallback(t *testing.T) {+ if testHandler == nil || testPool == nil {+ t.Skip("database not available")+ }++ assigneeID := createHandlerTestAgent(t, "Unowned Member Thread Assignee", nil)+ leaderID := createHandlerTestAgent(t, "Unowned Member Thread Leader", nil)+ squadID := createCommentTriggerPreviewSquad(t, "Unowned Member Thread Squad", leaderID)++ tests := []struct {+ name string+ assigneeType string+ assigneeID string+ routedAgentID string+ }{+ {+ name: "agent assignee",+ assigneeType: "agent",+ assigneeID: assigneeID,+ routedAgentID: assigneeID,+ },+ {+ name: "squad assignee",+ assigneeType: "squad",+ assigneeID: squadID,+ routedAgentID: leaderID,+ },+ }++ for _, tt := range tests {+ t.Run(tt.name, func(t *testing.T) {+ issueID := createCommentTriggerPreviewIssue(t, "plain reply to unowned member thread", tt.assigneeType, tt.assigneeID)+ rootID := insertMemberRootCommentForTriggerPreviewTest(t, issueID, "human-only discussion")+ replyContent := "plain human reply"++ preview := previewCommentTriggersForTest(t, issueID, CommentTriggerPreviewRequest{+ Content: replyContent,+ ParentID: &rootID,+ })+ requirePreviewAgents(t, preview)++ postCommentForTriggerPreviewTest(t, issueID, map[string]any{+ "content": replyContent,+ "parent_id": rootID,+ })+ if got := countQueuedCommentTriggerTasks(t, issueID, tt.routedAgentID); got != 0 {+ t.Fatalf("plain member reply queued assignee tasks = %d, want 0", got)+ }+ })+ }+}+func TestPreviewCommentTriggers_PlainReplyToMemberRootMentionRoutesToMentionedAgent(t *testing.T) {if testHandler == nil || testPool == nil {t.Skip("database not available")diff --git a/server/internal/handler/handler_test.go b/server/internal/handler/handler_test.goindex 72b275c5e1..21b1b5c9ef 100644--- a/server/internal/handler/handler_test.go+++ b/server/internal/handler/handler_test.go@@ -3857,10 +3857,11 @@ func TestNestedMemberReplyUsesDirectParentForMentionInheritance(t *testing.T) {}}-// TestNestedMemberReplyWithMemberParentFallsBackToAssignee verifies that a-// nested reply whose direct parent is human-owned does not route to a sibling-// agent reply. It falls through to the issue assignee instead.-func TestNestedMemberReplyUsesDirectParentForAssigneeParticipation(t *testing.T) {+// TestNestedMemberReplyUnderMemberSkipsAssigneeFallback verifies that a nested+// reply whose direct parent is human-owned neither routes to a sibling agent+// reply nor falls back to the issue assignee. A sibling agent comment alone+// does not establish a conversation owner for the member-authored root.+func TestNestedMemberReplyUnderMemberSkipsAssigneeFallback(t *testing.T) {if testHandler == nil || testPool == nil {t.Skip("database not available")}@@ -3948,8 +3949,8 @@ func TestNestedMemberReplyUsesDirectParentForAssigneeParticipation(t *testing.T)if nested.ParentID == nil || *nested.ParentID != humanParentID {t.Fatalf("stored nested reply parent_id should keep direct parent %s, got %v", humanParentID, nested.ParentID)}- if got := countAssigneeQueued(); got != 1 {- t.Fatalf("plain nested human reply should fall back to assignee; got %d queued tasks", got)+ if got := countAssigneeQueued(); got != 0 {+ t.Fatalf("plain nested human reply queued assignee tasks = %d, want 0", got)}}diff --git a/server/internal/service/builtin_skills/multica-mentioning/SKILL.md b/server/internal/service/builtin_skills/multica-mentioning/SKILL.mdindex af634c7ea2..c35cfe729e 100644--- a/server/internal/service/builtin_skills/multica-mentioning/SKILL.md+++ b/server/internal/service/builtin_skills/multica-mentioning/SKILL.md@@ -99,6 +99,15 @@ first, then removes those agent IDs as a post-filter. A missing or empty fieldpreserves the old behavior. A valid UUID that is not in the computed trigger setis a no-op; a malformed UUID is rejected at the request boundary.+For plain member-authored replies, implicit routing respects the direct+conversation target. Replying directly to an agent can trigger that agent, and+a member-authored thread that already has an agent owner can continue that+conversation. But a reply directly under another member does NOT fall back to+the issue's agent or squad assignee when the thread has no agent owner. Use an+explicit `@agent` or `@squad` mention when that human-to-human reply should also+start agent work. Top-level member comments can still use the issue assignee+fallback.+## @all is the broadcast type`@all` uses the literal `all`, never a UUID:diff --git a/server/internal/service/builtin_skills/multica-mentioning/references/mentioning-source-map.md b/server/internal/service/builtin_skills/multica-mentioning/references/mentioning-source-map.mdindex f85153a607..cdcf45a08b 100644--- a/server/internal/service/builtin_skills/multica-mentioning/references/mentioning-source-map.md+++ b/server/internal/service/builtin_skills/multica-mentioning/references/mentioning-source-map.md@@ -62,6 +62,16 @@ a pointer.| Preview hook includes `editingCommentId` in its query key and sends it to the API | `packages/views/issues/hooks/use-comment-trigger-preview.ts:58-80` || Timeline edit mutation passes suppressed agent IDs through to the API layer | `packages/views/issues/hooks/use-issue-timeline.ts:299-302` |+## Plain replies and implicit routing++| Fact | Source |+| --- | --- |+| A direct reply to an agent resolves through `routeReplyToParentAuthor` before any assignee fallback | `server/internal/handler/comment.go` (search `parentComment.AuthorType == "agent"` inside `computeCommentAgentTriggers`) |+| A member-authored thread with an explicit or task-derived agent owner resolves through `routeThreadRootOwners` and returns before the final fallback | `server/internal/handler/comment.go` (search `routeThreadRootOwners` inside `computeCommentAgentTriggers`) |+| If the direct parent is a member and no thread owner handled the reply, the reply returns no trigger instead of invoking `routeAssigneeFallback` | `server/internal/handler/comment.go` (search `A plain member-to-member reply`) |+| Top-level member comments retain the final agent/squad assignee fallback because they have no parent | `server/internal/handler/comment.go` (the final `routeAssigneeFallback` call in `computeCommentAgentTriggers`) |+| Regression coverage checks Agent and Squad assignees through both trigger preview and actual comment creation/enqueue | `server/internal/handler/comment_trigger_preview_test.go` (search `PlainReplyToUnownedMemberRootSkipsAssigneeFallback`) |+## Edit-preview pending-task dedup| Fact | Source |