feat(agent): trigger agent on member comment (on_comment trigger)
When a member comments on an issue assigned to an agent, automatically enqueue a new task if the agent has on_comment trigger enabled (or no triggers configured). Combined with session persistence, the agent resumes its prior conversation context and sees the new feedback. - Add HasActiveTaskForIssue query to prevent duplicate task enqueue - Refactor shouldEnqueueAgentTask into reusable isAgentTriggerEnabled - Add shouldEnqueueOnComment with active-task and status guards - Call trigger logic from CreateComment handler
This commit is contained in:
parent
5b2c61cfab
commit
32f795e1ef
2 changed files with 35 additions and 1 deletions
|
|
@ -125,6 +125,14 @@ func (h *Handler) CreateComment(w http.ResponseWriter, r *http.Request) {
|
|||
"issue_status": issue.Status,
|
||||
})
|
||||
|
||||
// If the issue is assigned to an agent with on_comment trigger, enqueue a new task.
|
||||
// The agent will resume its prior session and see this comment.
|
||||
if h.shouldEnqueueOnComment(r.Context(), issue) {
|
||||
if _, err := h.TaskService.EnqueueTaskForIssue(r.Context(), issue); err != nil {
|
||||
slog.Warn("enqueue agent task on comment failed", "issue_id", issueID, "error", err)
|
||||
}
|
||||
}
|
||||
|
||||
writeJSON(w, http.StatusCreated, resp)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue