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) <noreply@anthropic.com>
This commit is contained in:
LinYushen 2026-04-01 16:15:59 +08:00 committed by GitHub
parent 57cb32f09a
commit 005025b05c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 0 additions and 16 deletions

View file

@ -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" {

View file

@ -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