Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
fix(timeline): rescue orphaned replies + bump page size to 50 (#2263)
Bohan Jiangb1d874ef5097
diff --git a/packages/core/api/client.ts b/packages/core/api/client.tsindex 7e2d598803..efc37f42bb 100644--- a/packages/core/api/client.ts+++ b/packages/core/api/client.ts@@ -519,7 +519,7 @@ export class ApiClient {async listTimeline(issueId: string,pageParam: TimelinePageParam = { mode: "latest" },- limit = 30,+ limit = 50,): Promise<TimelinePage> {const params = new URLSearchParams();params.set("limit", String(limit));diff --git a/packages/views/issues/components/issue-detail.test.tsx b/packages/views/issues/components/issue-detail.test.tsxindex d21fa3f195..eb32869f94 100644--- a/packages/views/issues/components/issue-detail.test.tsx+++ b/packages/views/issues/components/issue-detail.test.tsx@@ -522,6 +522,43 @@ describe("IssueDetail (shared)", () => {expect(screen.getByText("I can help with this")).toBeInTheDocument();});+ // Orphan-reply rescue (#1857): a reply whose parent is paginated out of the+ // current page used to disappear from the UI entirely, since only the+ // root's CommentCard knew to pull replies from repliesByParent. Now the+ // reply is promoted to top-level and rendered standalone, so the user+ // never loses sight of comment content even when the page boundary cuts+ // through a thread.+ it("renders orphaned replies (parent not in timeline) at top level", async () => {+ mockApiObj.listTimeline.mockResolvedValue({+ entries: [+ {+ type: "comment",+ id: "reply-1",+ actor_type: "member",+ actor_id: "user-1",+ // parent_id refers to a comment that is NOT in this page (would+ // happen if the merge truncation drops the root or pagination+ // splits the thread).+ parent_id: "missing-parent",+ content: "Reply with no visible parent",+ created_at: "2026-01-18T00:00:00Z",+ updated_at: "2026-01-18T00:00:00Z",+ comment_type: "comment",+ },+ ],+ next_cursor: null,+ prev_cursor: null,+ has_more_before: false,+ has_more_after: false,+ });++ renderIssueDetail();++ await waitFor(() => {+ expect(screen.getByText("Reply with no visible parent")).toBeInTheDocument();+ });+ });+it("sends empty description when editor is cleared", async () => {renderIssueDetail();diff --git a/packages/views/issues/components/issue-detail.tsx b/packages/views/issues/components/issue-detail.tsxindex 2bd0ff8d9a..9bbd364c4e 100644--- a/packages/views/issues/components/issue-detail.tsx+++ b/packages/views/issues/components/issue-detail.tsx@@ -292,10 +292,22 @@ export function IssueDetail({ issueId, onDelete, onDone, defaultSidebarOpen = tr// CommentCard can skip re-rendering when the only thing that moved was// unrelated parent state (e.g. composer draft, sidebar toggle).const timelineView = useMemo(() => {- const topLevel = timeline.filter((e) => e.type === "activity" || !e.parent_id);+ // Orphan-reply rescue (#1857): a reply whose parent_id points to a+ // comment that isn't in the loaded timeline gets promoted to top-level+ // instead of disappearing. Without this, paginating between a root and+ // its replies (or a backend bug that drops the root from the page) hides+ // the entire reply subtree because only the root's CommentCard knows to+ // pull its children out of repliesByParent.+ const idsInTimeline = new Set(timeline.map((e) => e.id));+ const topLevel = timeline.filter(+ (e) =>+ e.type === "activity" ||+ !e.parent_id ||+ !idsInTimeline.has(e.parent_id),+ );const repliesByParent = new Map<string, TimelineEntry[]>();for (const e of timeline) {- if (e.type === "comment" && e.parent_id) {+ if (e.type === "comment" && e.parent_id && idsInTimeline.has(e.parent_id)) {const list = repliesByParent.get(e.parent_id) ?? [];list.push(e);repliesByParent.set(e.parent_id, list);diff --git a/server/internal/handler/activity.go b/server/internal/handler/activity.goindex b1d3ccc311..0c55e4de4f 100644--- a/server/internal/handler/activity.go+++ b/server/internal/handler/activity.go@@ -60,7 +60,7 @@ const (// they decorate the comment stream. Without that split, an issue with// sparse comments but dense activity (agent runs, status flips) triggered// "show older" prematurely and felt like comments had vanished.- timelineDefaultLimit = 30+ timelineDefaultLimit = 50timelineMaxLimit = 100)