feat: support multiple agents running concurrently on the same issue
- Relax ClaimAgentTask SQL constraint from per-issue to per-(issue, agent) serialization, allowing different agents to run in parallel on the same issue - Update GetActiveTaskForIssue API to return all active tasks (array) instead of just the first one - Refactor AgentLiveCard to render one card per active task, routing WebSocket messages by task_id for independent timelines - Fix shouldEnqueueOnComment to use per-agent dedup so a mentioned agent's pending task doesn't block the assigned agent's on_comment trigger Closes MUL-160
This commit is contained in:
parent
638033c9ff
commit
b94108768e
8 changed files with 139 additions and 86 deletions
|
|
@ -536,17 +536,22 @@ func (h *Handler) ListTaskMessages(w http.ResponseWriter, r *http.Request) {
|
|||
writeJSON(w, http.StatusOK, resp)
|
||||
}
|
||||
|
||||
// GetActiveTaskForIssue returns the currently running task for an issue, if any.
|
||||
// GetActiveTaskForIssue returns all currently active tasks for an issue.
|
||||
// Returns { tasks: [...] } array (may be empty).
|
||||
func (h *Handler) GetActiveTaskForIssue(w http.ResponseWriter, r *http.Request) {
|
||||
issueID := chi.URLParam(r, "id")
|
||||
|
||||
tasks, err := h.Queries.ListActiveTasksByIssue(r.Context(), parseUUID(issueID))
|
||||
if err != nil || len(tasks) == 0 {
|
||||
writeJSON(w, http.StatusOK, map[string]any{"task": nil})
|
||||
return
|
||||
if err != nil {
|
||||
tasks = nil
|
||||
}
|
||||
|
||||
writeJSON(w, http.StatusOK, map[string]any{"task": taskToResponse(tasks[0])})
|
||||
resp := make([]AgentTaskResponse, len(tasks))
|
||||
for i, t := range tasks {
|
||||
resp[i] = taskToResponse(t)
|
||||
}
|
||||
|
||||
writeJSON(w, http.StatusOK, map[string]any{"tasks": resp})
|
||||
}
|
||||
|
||||
// CancelTask cancels a running or queued task by ID.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue