Merge pull request #361 from JimmyPang02/fix/issue-mention-on-comment

fix: issue mentions should not suppress on_comment trigger
This commit is contained in:
Bohan Jiang 2026-04-03 18:42:16 +08:00 committed by GitHub
commit beeb8bc107
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 19 additions and 1 deletions

View file

@ -202,8 +202,16 @@ func (h *Handler) CreateComment(w http.ResponseWriter, r *http.Request) {
// is announcing to everyone, not specifically requesting work from the agent.
func (h *Handler) commentMentionsOthersButNotAssignee(content string, issue db.Issue) bool {
mentions := util.ParseMentions(content)
// Filter out issue mentions — they are cross-references, not @people.
filtered := mentions[:0]
for _, m := range mentions {
if m.Type != "issue" {
filtered = append(filtered, m)
}
}
mentions = filtered
if len(mentions) == 0 {
return false // No mentions — normal on_comment behavior
return false // No mentions (or only issue refs) — normal on_comment behavior
}
// @all is a broadcast to all members — suppress agent trigger.
if util.HasMentionAll(mentions) {

View file

@ -86,6 +86,16 @@ func TestCommentMentionsOthersButNotAssignee(t *testing.T) {
content: fmt.Sprintf("[@All](mention://all/all) [@Agent](mention://agent/%s) fyi", agentAssigneeID),
want: true,
},
{
name: "issue mention only → allow trigger (cross-reference, not @person)",
content: "[PAN-1](mention://issue/44c266e7-f6dd-4be3-9140-5ac40233f79c) is related",
want: false,
},
{
name: "issue mention + other agent → suppress (agent mention matters)",
content: fmt.Sprintf("[PAN-1](mention://issue/44c266e7-f6dd-4be3-9140-5ac40233f79c) cc [@Other](mention://agent/%s)", otherAgentID),
want: true,
},
}
for _, tt := range tests {