Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
refactor(transcript): reuse payload helper + cover coalesce timestamps (MUL-3174) (#3958)
Bohan Jiang72179d114595
diff --git a/packages/views/common/task-transcript/build-timeline.test.ts b/packages/views/common/task-transcript/build-timeline.test.tsindex 188ca9f89d..5f70299516 100644--- a/packages/views/common/task-transcript/build-timeline.test.ts+++ b/packages/views/common/task-transcript/build-timeline.test.ts@@ -76,4 +76,29 @@ describe("task transcript timeline", () => {expect(items[0]?.content).not.toContain("abc123xyz");expect(items[0]?.content).not.toContain("def456");});++ it("keeps the latest created_at when coalescing streaming fragments", () => {+ const items = coalesceTimelineItems([+ { seq: 1, type: "text", content: "hello ", created_at: "2026-06-09T09:00:00.000Z" },+ { seq: 2, type: "text", content: "world", created_at: "2026-06-09T09:00:05.000Z" },+ ]);++ expect(items).toEqual([+ expect.objectContaining({+ seq: 1,+ type: "text",+ content: "hello world",+ created_at: "2026-06-09T09:00:05.000Z",+ }),+ ]);+ });++ it("falls back to the previous created_at when the merged fragment has none", () => {+ const items = coalesceTimelineItems([+ { seq: 1, type: "text", content: "hello ", created_at: "2026-06-09T09:00:00.000Z" },+ { seq: 2, type: "text", content: "world" },+ ]);++ expect(items[0]?.created_at).toBe("2026-06-09T09:00:00.000Z");+ });});diff --git a/server/internal/handler/daemon.go b/server/internal/handler/daemon.goindex 6953cd4e45..ef254fde6b 100644--- a/server/internal/handler/daemon.go+++ b/server/internal/handler/daemon.go@@ -2096,21 +2096,8 @@ func (h *Handler) ReportTaskMessages(w http.ResponseWriter, r *http.Request) {}if workspaceID != "" {- createdAt := ""- if created.CreatedAt.Valid {- createdAt = created.CreatedAt.Time.UTC().Format(time.RFC3339Nano)- }- h.publishTask(protocol.EventTaskMessage, workspaceID, "system", "", taskID, protocol.TaskMessagePayload{- TaskID: taskID,- IssueID: uuidToString(task.IssueID),- Seq: msg.Seq,- Type: msg.Type,- Tool: msg.Tool,- Content: msg.Content,- Input: msg.Input,- Output: msg.Output,- CreatedAt: createdAt,- })+ h.publishTask(protocol.EventTaskMessage, workspaceID, "system", "", taskID,+ taskMessageToPayload(created, taskID, uuidToString(task.IssueID)))}}