From 005025b05c15fbded9fe71a204242c117346a3b8 Mon Sep 17 00:00:00 2001 From: LinYushen Date: Wed, 1 Apr 2026 16:15:59 +0800 Subject: [PATCH] fix(server): allow @agent mentions to trigger regardless of issue status (#267) Remove terminal status (done/cancelled) checks that blocked @agent mention triggers and task claiming. Agents should always be triggerable via explicit @mentions, regardless of the issue's current status. Co-authored-by: Claude Opus 4.6 (1M context) --- server/internal/handler/comment.go | 5 ----- server/internal/service/task.go | 11 ----------- 2 files changed, 16 deletions(-) diff --git a/server/internal/handler/comment.go b/server/internal/handler/comment.go index 93cf8f3f..4815304f 100644 --- a/server/internal/handler/comment.go +++ b/server/internal/handler/comment.go @@ -208,11 +208,6 @@ func (h *Handler) commentMentionsOthersButNotAssignee(content string, issue db.I // are already the issue's assignee (handled by on_comment), and agents with // on_mention trigger disabled. func (h *Handler) enqueueMentionedAgentTasks(ctx context.Context, issue db.Issue, comment db.Comment, authorType, authorID string) { - // Don't trigger on terminal statuses. - if issue.Status == "done" || issue.Status == "cancelled" { - return - } - mentions := util.ParseMentions(comment.Content) for _, m := range mentions { if m.Type != "agent" { diff --git a/server/internal/service/task.go b/server/internal/service/task.go index f46d0e14..fb44e613 100644 --- a/server/internal/service/task.go +++ b/server/internal/service/task.go @@ -162,8 +162,6 @@ func (s *TaskService) ClaimTask(ctx context.Context, agentID pgtype.UUID) (*db.A // ClaimTaskForRuntime claims the next runnable task for a runtime while // still respecting each agent's max_concurrent_tasks limit. -// Tasks whose issues are in a terminal status (done/cancelled) are -// automatically cancelled and skipped. func (s *TaskService) ClaimTaskForRuntime(ctx context.Context, runtimeID pgtype.UUID) (*db.AgentTaskQueue, error) { tasks, err := s.Queries.ListPendingTasksByRuntime(ctx, runtimeID) if err != nil { @@ -172,15 +170,6 @@ func (s *TaskService) ClaimTaskForRuntime(ctx context.Context, runtimeID pgtype. triedAgents := map[string]struct{}{} for _, candidate := range tasks { - // Skip tasks whose issues have reached a terminal status. - if issue, err := s.Queries.GetIssue(ctx, candidate.IssueID); err == nil { - if issue.Status == "done" || issue.Status == "cancelled" { - slog.Info("skipping task for terminal issue", "task_id", util.UUIDToString(candidate.ID), "issue_status", issue.Status) - _ = s.Queries.CancelAgentTasksByIssue(ctx, candidate.IssueID) - continue - } - } - agentKey := util.UUIDToString(candidate.AgentID) if _, seen := triedAgents[agentKey]; seen { continue