From 0431ee2ee0cc23a00ceb70593cbe20412c112eee Mon Sep 17 00:00:00 2001 From: Jiayuan Date: Tue, 31 Mar 2026 18:16:58 +0800 Subject: [PATCH] fix(issues): show execution logs for mention-triggered agent tasks AgentLiveCard and TaskRunHistory were gated on assigneeType === "agent", so mention-triggered tasks on non-agent-assigned issues never showed their execution logs. Remove that guard so any issue with agent tasks displays live output and execution history. Also populate IssueID in ListTaskMessages response so the live card's WS event filtering works correctly on catch-up after reconnect. --- .../issues/components/agent-live-card.tsx | 17 ++++------------- .../features/issues/components/issue-detail.tsx | 4 +--- server/internal/handler/daemon.go | 9 +++++++++ 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/apps/web/features/issues/components/agent-live-card.tsx b/apps/web/features/issues/components/agent-live-card.tsx index 2147ce6a..4c9e0b15 100644 --- a/apps/web/features/issues/components/agent-live-card.tsx +++ b/apps/web/features/issues/components/agent-live-card.tsx @@ -97,12 +97,10 @@ function buildTimeline(msgs: TaskMessagePayload[]): TimelineItem[] { interface AgentLiveCardProps { issueId: string; - assigneeType: string | null; - assigneeId: string | null; agentName?: string; } -export function AgentLiveCard({ issueId, assigneeType, assigneeId, agentName }: AgentLiveCardProps) { +export function AgentLiveCard({ issueId, agentName }: AgentLiveCardProps) { const { getActorName } = useActorName(); const [activeTask, setActiveTask] = useState(null); const [items, setItems] = useState([]); @@ -113,11 +111,6 @@ export function AgentLiveCard({ issueId, assigneeType, assigneeId, agentName }: // Check for active task on mount useEffect(() => { - if (assigneeType !== "agent" || !assigneeId) { - setActiveTask(null); - return; - } - let cancelled = false; api.getActiveTaskForIssue(issueId).then(({ task }) => { if (!cancelled) { @@ -135,7 +128,7 @@ export function AgentLiveCard({ issueId, assigneeType, assigneeId, agentName }: }).catch(() => {}); return () => { cancelled = true; }; - }, [issueId, assigneeType, assigneeId]); + }, [issueId]); // Handle real-time task messages useWSEvent( @@ -280,17 +273,15 @@ export function AgentLiveCard({ issueId, assigneeType, assigneeId, agentName }: interface TaskRunHistoryProps { issueId: string; - assigneeType: string | null; } -export function TaskRunHistory({ issueId, assigneeType }: TaskRunHistoryProps) { +export function TaskRunHistory({ issueId }: TaskRunHistoryProps) { const [tasks, setTasks] = useState([]); const [open, setOpen] = useState(false); useEffect(() => { - if (assigneeType !== "agent") return; api.listTasksByIssue(issueId).then(setTasks).catch(() => {}); - }, [issueId, assigneeType]); + }, [issueId]); // Refresh when a task completes useWSEvent( diff --git a/apps/web/features/issues/components/issue-detail.tsx b/apps/web/features/issues/components/issue-detail.tsx index abe41e0b..e66ef95c 100644 --- a/apps/web/features/issues/components/issue-detail.tsx +++ b/apps/web/features/issues/components/issue-detail.tsx @@ -663,15 +663,13 @@ export function IssueDetail({ issueId, onDelete, defaultSidebarOpen = true, layo
{/* Agent execution history */}
- +
{/* Timeline entries */} diff --git a/server/internal/handler/daemon.go b/server/internal/handler/daemon.go index ae7803c4..d08f080d 100644 --- a/server/internal/handler/daemon.go +++ b/server/internal/handler/daemon.go @@ -477,12 +477,20 @@ func (h *Handler) ReportTaskMessages(w http.ResponseWriter, r *http.Request) { func (h *Handler) ListTaskMessages(w http.ResponseWriter, r *http.Request) { taskID := chi.URLParam(r, "taskId") + task, err := h.Queries.GetAgentTask(r.Context(), parseUUID(taskID)) + if err != nil { + writeError(w, http.StatusNotFound, "task not found") + return + } + messages, err := h.Queries.ListTaskMessages(r.Context(), parseUUID(taskID)) if err != nil { writeError(w, http.StatusInternalServerError, "failed to list task messages") return } + issueID := uuidToString(task.IssueID) + resp := make([]protocol.TaskMessagePayload, len(messages)) for i, m := range messages { var input map[string]any @@ -491,6 +499,7 @@ func (h *Handler) ListTaskMessages(w http.ResponseWriter, r *http.Request) { } resp[i] = protocol.TaskMessagePayload{ TaskID: taskID, + IssueID: issueID, Seq: int(m.Seq), Type: m.Type, Tool: m.Tool.String,