Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
feat(issues): add sub-issues to the issue sidebar (#10786)
沙雕的小鱼儿 boyfeiyu8fa8e4f72598
diff --git a/apps/docs/content/docs/issues.fr.mdx b/apps/docs/content/docs/issues.fr.mdxindex 4898a6978e..b670cd6b89 100644--- a/apps/docs/content/docs/issues.fr.mdx+++ b/apps/docs/content/docs/issues.fr.mdx@@ -140,6 +140,8 @@ Une tâche appartient à un [projet](/projects) au plus ; le projet fournit desUn travail plus important peut être découpé en sous-tâches : la tâche parente conserve l'objectif global tandis que les sous-tâches avancent indépendamment. Les statuts de la tâche parente et des sous-tâches ne s'influencent pas.+Ouvrez une sous-tâche directe depuis **Sous-tâches** dans la barre latérale droite de la tâche. Jusqu'à 10 sous-tâches, l'ordre correspond à la liste principale. Au-delà, les 10 premières s'affichent en donnant la priorité aux sous-tâches non terminées, tout en conservant l'ordre des étapes dans chaque groupe. **Afficher N de plus** déplie toute la liste dans la barre latérale ; **Réduire** revient aux 10 premières. Votre position de lecture est conservée et la barre latérale reste ouverte sur écran étroit. La progression compte toutes les sous-tâches. **Personnaliser la barre latérale** permet de masquer ou de réordonner cette section.+Les sous-tâches peuvent recevoir une **Étape** pour avancer par lots — 1, 2, 3. Lorsque toutes les sous-tâches de la première étape non terminée atteignent `done` ou `cancelled`, la tâche parente reçoit une notification « sous-tâches terminées » ; si l'assigné de la tâche parente est un agent, celui-ci se réveille et décide s'il lance l'étape suivante. Les sous-tâches sans étape forment un seul lot et ne déclenchent qu'une notification, lorsqu'elles sont toutes terminées. Ce réveil est déclenché par le système ; ses règles et les autres types de réveil sont décrits dans [Réveils de tâches](/issue-wakeups).## Vues et affichage [#changer-de-vue]diff --git a/apps/docs/content/docs/issues.ja.mdx b/apps/docs/content/docs/issues.ja.mdxindex 20a050a0e7..5cef7604d8 100644--- a/apps/docs/content/docs/issues.ja.mdx+++ b/apps/docs/content/docs/issues.ja.mdx@@ -140,6 +140,8 @@ import { DeliverablesDemo } from "@/components/demos/deliverables-demo";大きな作業は子タスクに分割できます。親タスクが全体の目標を保持し、子タスクはそれぞれ独立して進みます。親子のステータスは連動しません。+タスクの右サイドバーの**サブタスク**から、直接の子タスクを開けます。10 件以下では本文の一覧と同じ順序です。10 件を超える場合は未完了の子タスクを優先して最初の 10 件を表示し、各グループ内ではステージ順を保ちます。**さらに N 件表示** でサイドバー内にすべて展開し、**折りたたむ** で最初の 10 件に戻します。本文の閲覧位置は変わらず、狭い画面でもサイドバーは開いたままです。進捗はすべての子タスクを集計します。**サイドバーをカスタマイズ**で、このセクションの表示や順序を変更できます。+子タスクには**ステージ**(stage)を設定でき、1、2、3 とバッチごとに進められます。未完了の最も早いステージのすべての子タスクが `done` または `cancelled` に到達すると、親タスクに子タスク完了の通知が届きます。親タスクの担当者がエージェントの場合は、そのエージェントが起こされ、次のステージへ進むかどうかを判断します。ステージ未設定の子タスクは同じバッチとして扱われ、すべて終了したときに一度だけ通知されます。このウェイクアップはシステムが行います。ルールとほかのウェイクアップの種類は[タスクのウェイクアップ](/issue-wakeups)を参照してください。## ビューと表示設定 [#ビューの切り替え]diff --git a/apps/docs/content/docs/issues.ko.mdx b/apps/docs/content/docs/issues.ko.mdxindex 386df9a60e..b471d5605e 100644--- a/apps/docs/content/docs/issues.ko.mdx+++ b/apps/docs/content/docs/issues.ko.mdx@@ -140,6 +140,8 @@ import { DeliverablesDemo } from "@/components/demos/deliverables-demo";큰 작업은 하위 태스크로 나눌 수 있습니다. 상위 태스크에는 전체 목표를 남기고 하위 태스크는 각각 독립적으로 진행합니다. 상위와 하위 태스크의 상태는 서로 연동되지 않습니다.+태스크 오른쪽 사이드바의 **하위 태스크**에서 직속 하위 태스크를 열 수 있습니다. 10개 이하면 본문 목록과 같은 순서이며, 10개를 넘으면 미완료 항목을 우선해 처음 10개를 표시하고 각 그룹 안에서는 단계 순서를 유지합니다. **N개 더 보기**로 사이드바에서 전체를 펼치고, **접기**로 처음 10개로 돌아갑니다. 본문을 읽던 위치는 바뀌지 않으며 좁은 화면에서도 사이드바는 열린 상태를 유지합니다. 진행률은 전체 하위 태스크를 기준으로 계산합니다. **사이드바 사용자 지정**에서 이 섹션을 숨기거나 순서를 바꿀 수 있습니다.+하위 태스크에는 **단계**(stage)를 지정해 1, 2, 3처럼 묶어서 진행할 수 있습니다. 현재 가장 이른 미완료 단계의 모든 하위 태스크가 `done` 또는 `cancelled`가 되면 상위 태스크에 "하위 태스크 완료" 알림이 전달됩니다. 상위 태스크 담당자가 에이전트이면 에이전트가 깨어나 다음 단계로 진행할지 결정합니다. 단계를 지정하지 않은 하위 태스크는 같은 묶음으로 간주하며 모두 끝났을 때 한 번 알립니다. 이 깨우기는 시스템이 합니다. 규칙과 다른 깨우기 방식은 [태스크 깨우기](/issue-wakeups)를 참고하세요.## 뷰와 표시 설정 [#보기-전환]diff --git a/apps/docs/content/docs/issues.mdx b/apps/docs/content/docs/issues.mdxindex 067eaeaea0..44b745fa75 100644--- a/apps/docs/content/docs/issues.mdx+++ b/apps/docs/content/docs/issues.mdx@@ -140,6 +140,8 @@ An issue belongs to at most one [project](/projects); the project provides shareLarger work can be split into sub-issues: the parent issue keeps the overall goal while sub-issues progress independently. Parent and child statuses do not affect each other.+Open a direct child from **Sub-issues** in the issue's right sidebar. With 10 or fewer children, their order matches the inline list. With more, it initially shows 10, putting unfinished children first and keeping stage order within each group. **Show N more** expands all children in the sidebar; **Collapse** returns to the first 10. Both keep your reading position and leave the narrow-screen sidebar open. Progress counts all children. **Customize sidebar** lets you hide or reorder this section.+Creating a sub-issue from a parent prefills its project and, when set, its assignee. In manual create, **Copy parent fields** lets you choose priority, labels, dates, or individual custom properties to copy. Only the selected values replace your form values, once; later parent changes do not sync. The child keeps its own description and status. Labels, start date, and custom properties stay in the manual draft when switching to Create with agent.Sub-issues can be given a **stage** to advance in batches — 1, 2, 3. When every sub-issue in the earliest unfinished stage reaches `done` or `cancelled`, the parent issue receives a "sub-issues completed" notification; when the parent's assignee is an agent, it wakes up and decides whether to start the next stage. Sub-issues without a stage count as one batch and notify once when they all finish. The system triggers this wakeup; see [Issue wakeups](/issue-wakeups) for its rules and the other kinds of wakeup.diff --git a/apps/docs/content/docs/issues.zh-Hant.mdx b/apps/docs/content/docs/issues.zh-Hant.mdxindex 5343f5ab39..870ff12e15 100644--- a/apps/docs/content/docs/issues.zh-Hant.mdx+++ b/apps/docs/content/docs/issues.zh-Hant.mdx@@ -140,6 +140,8 @@ AI 代理會隨工作進展更新任務狀態:預設開始工作時改為 `in_較大的工作可以拆成子任務:父任務保留整體目標,子任務各自獨立推進。父子狀態互不聯動。+在任務右側欄的**子任務**區可以直接開啟子任務。不超過 10 筆時,順序與正文列表一致;超過時預設顯示 10 筆,未完成項目優先,兩組內各自保持階段順序。點擊**再顯示 N 筆**會在側欄展開全部,點擊**收合**恢復前 10 筆,正文閱讀位置不變,窄螢幕側欄也不會關閉。進度始終統計全部子任務。透過**自訂側邊欄**可以隱藏或調整這個分區的順序。+子任務可以設定**階段**(stage),按 1、2、3 分批推進。當前最早未完成階段的全部子任務到達 `done` 或 `cancelled` 時,父任務會收到"子任務完成"通知;父任務的負責人是 AI 代理時,它會被喚醒並決定是否推進下一階段。未設定階段的子任務視為同一批,全部結束時通知一次。這次喚醒由系統發起,規則和其他喚醒方式見[任務喚醒](/issue-wakeups)。## 檢視和顯示設定 [#切換檢視]diff --git a/apps/docs/content/docs/issues.zh.mdx b/apps/docs/content/docs/issues.zh.mdxindex f31dc50f8c..7e034c2bc3 100644--- a/apps/docs/content/docs/issues.zh.mdx+++ b/apps/docs/content/docs/issues.zh.mdx@@ -140,6 +140,8 @@ import { DeliverablesDemo } from "@/components/demos/deliverables-demo";较大的工作可以拆成子任务:父任务保留整体目标,子任务各自独立推进。父子状态互不联动。+在任务右侧栏的**子任务**区可以直接打开子任务。不超过 10 条时,顺序与正文列表一致;超过时默认显示 10 条,未完成项优先,两组内各自保持阶段顺序。点击**再显示 N 条**会在侧栏展开全部,点击**收起**恢复前 10 条,正文阅读位置不变,窄屏侧栏也不会关闭。进度始终统计全部子任务。通过**自定义侧边栏**可以隐藏或调整这个分区的顺序。+从父任务创建子任务时,会预填项目;父任务已指派时,也会预填负责人。手动创建中可通过**复制父任务字段**选择优先级、标签、日期或某个自定义属性。仅覆盖选中的字段,复制一次,父任务后续修改不再同步。子任务的描述和状态独立。切换到智能体创建时,标签、开始日期和自定义属性保留在手动草稿中。子任务可以设置**阶段**(stage),按 1、2、3 分批推进。当前最早未完成阶段的全部子任务到达 `done` 或 `cancelled` 时,父任务会收到"子任务完成"通知;父任务的负责人是智能体时,它会被唤醒并决定是否推进下一阶段。未设置阶段的子任务视为同一批,全部结束时通知一次。这次唤醒由系统发起,规则和其他唤醒方式见[任务唤醒](/issue-wakeups)。diff --git a/packages/core/issues/stores/issue-sidebar-sections-persistence.test.ts b/packages/core/issues/stores/issue-sidebar-sections-persistence.test.tsnew file mode 100644index 0000000000..b2ef00e896--- /dev/null+++ b/packages/core/issues/stores/issue-sidebar-sections-persistence.test.ts@@ -0,0 +1,73 @@+// @vitest-environment jsdom+import { beforeEach, describe, expect, it } from "vitest";+import {+ ISSUE_SIDEBAR_SECTIONS,+ selectIssueSidebarOrder,+ useIssueSidebarSectionsStore,+} from "@multica/core/issues/stores";++const STORAGE_KEY = "multica_issue_sidebar_sections";+// The order persisted before the Sub-issues section was introduced.+const OLD_ORDER = [+ "properties", "quick_actions", "wakeups", "plugins", "parent", "duplicates",+ "pull_requests", "environments", "deliverables", "apps", "execution_log", "details", "metadata",+];++async function reloadPreferences() {+ const saved = localStorage.getItem(STORAGE_KEY)!;+ useIssueSidebarSectionsStore.getState().reset();+ localStorage.setItem(STORAGE_KEY, saved);+ await useIssueSidebarSectionsStore.persist.rehydrate();+}++describe("Sub-issues sidebar persisted preferences", () => {+ beforeEach(() => {+ localStorage.clear();+ useIssueSidebarSectionsStore.getState().reset();+ });++ it.each([+ { name: "default", order: OLD_ORDER },+ { name: "customized", order: [...OLD_ORDER].reverse() },+ ])("hydrates an older $name order without changing existing relative order", async ({ order: savedOrder }) => {+ localStorage.setItem(STORAGE_KEY, JSON.stringify({+ state: { order: [...savedOrder, "unknown", "parent"], hidden: ["parent", "apps", "properties", "apps", "unknown"] },+ version: 0,+ }));+ await useIssueSidebarSectionsStore.persist.rehydrate();+ const state = useIssueSidebarSectionsStore.getState();+ const order = [...selectIssueSidebarOrder(state)];+ expect(order.filter((id) => id !== "sub_issues")).toEqual(savedOrder);+ expect(order.indexOf("sub_issues")).toBe(order.indexOf("parent") + 1);+ expect(order.filter((id) => id === "sub_issues")).toHaveLength(1);+ expect(state.hidden).toEqual(["parent", "apps"]);+ await reloadPreferences();+ expect(selectIssueSidebarOrder(useIssueSidebarSectionsStore.getState())).toEqual(order);+ expect(useIssueSidebarSectionsStore.getState().hidden).toEqual(["parent", "apps"]);+ });++ it("persists hiding and reordering Sub-issues, then restores defaults", async () => {+ const store = useIssueSidebarSectionsStore;+ store.getState().setHidden("sub_issues", true);+ store.getState().setOrder(["sub_issues", ...ISSUE_SIDEBAR_SECTIONS]);+ await reloadPreferences();+ expect(selectIssueSidebarOrder(store.getState())[0]).toBe("sub_issues");+ expect(store.getState().hidden).toEqual(["sub_issues"]);+ store.getState().setHidden("sub_issues", false);+ await reloadPreferences();+ expect(store.getState().hidden).toEqual([]);+ expect(selectIssueSidebarOrder(store.getState())[0]).toBe("sub_issues");+ store.getState().reset();+ await reloadPreferences();+ expect(store.getState().order).toBeNull();+ expect(store.getState().hidden).toEqual([]);+ expect(selectIssueSidebarOrder(store.getState())).toEqual(ISSUE_SIDEBAR_SECTIONS);+ });++ it("shows a newly added section for an uncustomized older save", async () => {+ localStorage.setItem(STORAGE_KEY, JSON.stringify({ state: { order: null, hidden: ["metadata"] }, version: 0 }));+ await useIssueSidebarSectionsStore.persist.rehydrate();+ expect(selectIssueSidebarOrder(useIssueSidebarSectionsStore.getState())).toContain("sub_issues");+ expect(useIssueSidebarSectionsStore.getState().hidden).toEqual(["metadata"]);+ });+});diff --git a/packages/core/issues/stores/issue-sidebar-sections-store.ts b/packages/core/issues/stores/issue-sidebar-sections-store.tsindex b410f6bead..49d53dc0aa 100644--- a/packages/core/issues/stores/issue-sidebar-sections-store.ts+++ b/packages/core/issues/stores/issue-sidebar-sections-store.ts@@ -11,6 +11,7 @@ export const ISSUE_SIDEBAR_SECTIONS = ["wakeups","plugins","parent",+ "sub_issues","duplicates","pull_requests","environments",diff --git a/packages/views/issues/components/issue-detail.test.tsx b/packages/views/issues/components/issue-detail.test.tsxindex 93086a730b..a016e59471 100644--- a/packages/views/issues/components/issue-detail.test.tsx+++ b/packages/views/issues/components/issue-detail.test.tsx@@ -18,6 +18,7 @@ import enAgents from "../../locales/en/agents.json";import enCommon from "../../locales/en/common.json";import enIssues from "../../locales/en/issues.json";import { useIssueSidebarSectionsStore } from "@multica/core/issues/stores/issue-sidebar-sections-store";+import { useSubIssuesCollapseStore } from "@multica/core/issues/stores/sub-issues-collapse-store";vi.mock("./issue-wakeup-header-chip", () => ({IssueWakeupHeaderChip: ({ onOpen }: { onOpen: () => void }) => (@@ -3664,6 +3665,7 @@ describe("IssueDetail (shared)", () => {describe("sub-issues list", () => {beforeEach(() => {+ useSubIssuesCollapseStore.setState({ collapsedIssueIds: new Set() });useSubIssueDisplayStore.setState({rowProperties: { ...DEFAULT_SUB_ISSUE_ROW_PROPERTIES },rowPropertyIds: [],@@ -3690,6 +3692,160 @@ describe("IssueDetail (shared)", () => {...overrides,});+ const inlineChildren = () => within(document.querySelector<HTMLElement>('[class~="group/sub-issues"]')!);+ const findInlineChild = (title: string) => waitFor(() => inlineChildren().getByText(title));++ it("offers direct sidebar child links and an independent disclosure", async () => {+ mockApiObj.listChildIssues.mockResolvedValue({+ issues: [+ subIssue({ id: "child-open", identifier: "TES-11", title: "Open destination", status: "todo" }),+ subIssue({ id: "child-done", identifier: "TES-12", title: "Custom completion", status: "verified", status_category: "done" }),+ subIssue({ id: "child-cancelled", identifier: "TES-13", title: "Cancelled destination", status: "cancelled" }),+ ],+ });+ const { container } = renderIssueDetail();+ await waitFor(() => expect(container.querySelector('[data-issue-sidebar-section="sub_issues"]')).not.toBeNull());+ const sidebar = within(container.querySelector<HTMLElement>('[data-issue-sidebar-section="sub_issues"]')!);+ expect(sidebar.getAllByRole("link")).toHaveLength(3);+ expect(sidebar.getByRole("link", { name: /TES-11 Open destination/ })).toHaveAttribute("href", "/test/issues/child-open");+ expect(sidebar.getByRole("link", { name: /TES-13 Cancelled destination/ })).toBeInTheDocument();+ expect(sidebar.getByRole("progressbar", { name: "Sub-issues" })).toHaveAttribute("aria-valuenow", "1");+ expect(sidebar.getByRole("progressbar", { name: "Sub-issues" })).toHaveAttribute("aria-valuemax", "3");+ const toggle = sidebar.getByRole("button", { name: "Sub-issues" });+ expect(toggle).toHaveAttribute("aria-expanded", "true");+ fireEvent.click(toggle);+ expect(toggle).toHaveAttribute("aria-expanded", "false");+ expect(sidebar.queryAllByRole("link")).toHaveLength(0);+ expect(inlineChildren().getByText("Open destination")).toBeInTheDocument();+ fireEvent.click(toggle);+ expect(sidebar.getAllByRole("link")).toHaveLength(3);+ });++ const stagedSidebarChildren = () => Array.from({ length: 25 }, (_, i) => subIssue({+ id: `child-${i + 1}`,+ number: i + 1,+ identifier: `TES-${i + 1}`,+ title: `Child ${i + 1}`,+ stage: i % 3 === 0 ? 2 : i % 3 === 1 ? 1 : null,+ status: i === 1 || i >= 20 ? "verified" : i === 2 ? "declined" : i === 5 ? "cancelled" : "todo",+ status_category: i === 1 || i >= 20 ? "done" : i === 2 ? "closed" : undefined,+ }));++ it.each([false, true])("expands unfinished-first sidebar children in place (mobile: %s)", async (isMobile) => {+ mockViewport.isMobile = isMobile;+ mockApiObj.listChildIssues.mockResolvedValue({ issues: stagedSidebarChildren() });+ const { container } = renderIssueDetail();+ await findInlineChild("Child 25");+ const section = container.querySelector<HTMLDivElement>('[class~="group/sub-issues"]')!;+ const inlineOrder = inlineChildren().getAllByText(/^Child \d+$/).map((row) => row.textContent);+ fireEvent.click(within(section).getByRole("button", { name: "Sub-issues" }));+ const scroller = container.querySelector<HTMLDivElement>("[data-tab-scroll-root]")!;+ scroller.scrollTop = 600;+ vi.spyOn(scroller, "getBoundingClientRect").mockReturnValue({ top: 100 } as DOMRect);+ vi.spyOn(section, "getBoundingClientRect").mockReturnValue({ top: -200 } as DOMRect);+ let sheet: HTMLElement | undefined;+ if (isMobile) {+ fireEvent.click(screen.getByRole("button", { name: enIssues.detail.sidebar_tooltip }));+ sheet = await screen.findByRole("dialog");+ }+ const sidebar = within(document.querySelector<HTMLElement>('[data-issue-sidebar-section="sub_issues"]')!);+ const childLinks = () => sidebar.getAllByRole("link").map((link) => link.getAttribute("href"));+ const urls = (numbers: number[]) => numbers.map((n) => `/test/issues/child-${n}`);+ const firstTen = [5, 8, 11, 14, 17, 20, 1, 4, 7, 10];+ expect(childLinks()).toEqual(urls(firstTen));+ expect(sidebar.getByText("6/25")).toBeInTheDocument();+ expect(sidebar.getByRole("progressbar")).toHaveAttribute("aria-valuemax", "25");+ expect(sidebar.getByRole("progressbar")).toHaveAttribute("aria-valuenow", "6");+ const showMore = sidebar.getByRole("button", { name: "Show 15 more" });+ expect(showMore).toHaveAttribute("aria-expanded", "false");+ fireEvent.click(showMore);+ expect(childLinks()).toEqual(urls([+ 5, 8, 11, 14, 17, 20, 1, 4, 7, 10, 13, 16, 19, 9, 12, 15, 18,+ 2, 23, 22, 25, 3, 6, 21, 24,+ ]));+ expect(inlineChildren().queryByText("Child 25")).not.toBeInTheDocument();+ expect(scroller.scrollTop).toBe(600);+ if (isMobile) {+ expect(screen.getByRole("dialog")).toBe(sheet);+ expect(document.querySelector('[data-slot="sheet-overlay"]')).not.toBeNull();+ }+ const collapse = sidebar.getByRole("button", { name: "Collapse" });+ expect(collapse).toHaveAttribute("aria-expanded", "true");+ fireEvent.click(collapse);+ expect(childLinks()).toEqual(urls(firstTen));+ expect(sidebar.getByRole("button", { name: "Show 15 more" })).toHaveAttribute("aria-expanded", "false");+ expect(sidebar.getByText("6/25")).toBeInTheDocument();+ expect(scroller.scrollTop).toBe(600);+ expect(inlineChildren().queryByText("Child 25")).not.toBeInTheDocument();+ if (isMobile) {+ expect(screen.getByRole("dialog")).toBe(sheet);+ expect(document.querySelector('[data-slot="sheet-overlay"]')).not.toBeNull();+ fireEvent.keyDown(sheet!, { key: "Escape" });+ await waitFor(() => expect(screen.queryByRole("dialog")).not.toBeInTheDocument());+ }+ fireEvent.click(within(section).getByRole("button", { name: "Sub-issues" }));+ expect(inlineChildren().getAllByText(/^Child \d+$/).map((row) => row.textContent)).toEqual(inlineOrder);+ });++ it("keeps inline stage order including completed children at the ten-child limit", async () => {+ mockApiObj.listChildIssues.mockResolvedValue({ issues: stagedSidebarChildren().slice(0, 10) });+ const { container } = renderIssueDetail();+ await findInlineChild("Child 10");+ const sidebar = within(container.querySelector<HTMLElement>('[data-issue-sidebar-section="sub_issues"]')!);+ expect(sidebar.getAllByRole("link").map((link) => link.getAttribute("href"))).toEqual(+ [2, 5, 8, 1, 4, 7, 10, 3, 6, 9].map((n) => `/test/issues/child-${n}`),+ );+ expect(sidebar.queryByRole("button", { name: /Show .* more|Collapse|View all/ })).not.toBeInTheDocument();+ expect(sidebar.getByText("1/10")).toBeInTheDocument();+ });++ it("shows the remaining count when only one child is hidden", async () => {+ mockApiObj.listChildIssues.mockResolvedValue({ issues: stagedSidebarChildren().slice(0, 11) });+ const { container } = renderIssueDetail();+ await findInlineChild("Child 11");+ const sidebar = within(container.querySelector<HTMLElement>('[data-issue-sidebar-section="sub_issues"]')!);+ expect(sidebar.getAllByRole("link")).toHaveLength(10);+ fireEvent.click(sidebar.getByRole("button", { name: "Show 1 more" }));+ expect(sidebar.getAllByRole("link")).toHaveLength(11);+ fireEvent.click(sidebar.getByRole("button", { name: "Collapse" }));+ expect(sidebar.getAllByRole("link")).toHaveLength(10);+ });++ it("leaves the sidebar slot empty while loading and when no children exist", async () => {+ let resolveChildren!: (value: { issues: Issue[] }) => void;+ mockApiObj.listChildIssues.mockImplementation(() => new Promise((resolve) => {+ resolveChildren = resolve;+ }));+ const { container } = renderIssueDetail();+ await screen.findByText("Implement authentication");+ const sidebar = () => container.querySelector('[data-issue-sidebar-section="sub_issues"]');+ expect(sidebar()?.childElementCount).toBe(0);+ await act(async () => resolveChildren({ issues: [] }));+ expect(sidebar()?.childElementCount).toBe(0);+ });++ it("removes cached sidebar links after a child query loses access", async () => {+ let rejectChildren!: (reason: unknown) => void;+ mockApiObj.listChildIssues.mockImplementation(() => new Promise((_resolve, reject) => {+ rejectChildren = reject;+ }));+ const queryClient = createTestQueryClient();+ queryClient.setQueryData(issueKeys.children("ws-1", "issue-1"), [+ subIssue({ id: "child-private", identifier: "TES-11", title: "Previously authorized child" }),+ ]);+ const { container } = render(+ <I18nProvider locale="en" resources={TEST_RESOURCES}>+ <QueryClientProvider client={queryClient}>+ <IssueDetail issueId="issue-1" />+ </QueryClientProvider>+ </I18nProvider>,+ );+ const sidebar = () => container.querySelector<HTMLElement>('[data-issue-sidebar-section="sub_issues"]')!;+ await waitFor(() => expect(within(sidebar()).getByRole("link", { name: /Previously authorized child/ })).toBeInTheDocument());+ await act(async () => rejectChildren(new ApiError("Access denied", 403, "Forbidden")));+ await waitFor(() => expect(sidebar().childElementCount).toBe(0));+ });+it("jumps from the outline to the expanded sub-issues section without comments", async () => {// Preview/order behavior lives in thread-minimap.test.tsx; this tests the real section.mockApiObj.listTimeline.mockResolvedValue([]);@@ -3697,10 +3853,10 @@ describe("IssueDetail (shared)", () => {issues: [subIssue({ id: "child-1", title: "Child destination" })],});const { container } = renderIssueDetail();- await screen.findByText("Child destination");+ await findInlineChild("Child destination");const section = container.querySelector<HTMLDivElement>(".group\\/sub-issues")!;fireEvent.click(within(section).getByRole("button", { name: "Sub-issues" }));- expect(screen.queryByText("Child destination")).not.toBeInTheDocument();+ expect(within(section).queryByText("Child destination")).not.toBeInTheDocument();const scroller = container.querySelector<HTMLDivElement>("[data-tab-scroll-root]")!;scroller.scrollTop = 600;@@ -3709,7 +3865,7 @@ describe("IssueDetail (shared)", () => {fireEvent.click(within(screen.getByRole("navigation", { name: "Quick navigation" })).getByRole("button", { name: "Sub-issues" }));- expect(await screen.findByText("Child destination")).toBeInTheDocument();+ expect(await findInlineChild("Child destination")).toBeInTheDocument();await waitFor(() => expect(scroller.scrollTop).toBe(284));});@@ -3740,7 +3896,7 @@ describe("IssueDetail (shared)", () => {renderIssueDetail();- await screen.findByText("Fix login flow");+ await findInlineChild("Fix login flow");// Label chips ride inside the row link.expect(screen.getByText("backend")).toBeInTheDocument();expect(screen.getByText("auth")).toBeInTheDocument();@@ -3750,7 +3906,7 @@ describe("IssueDetail (shared)", () => {const due = screen.getByText("Jan 1");expect(due.closest("span")?.className).toContain("text-destructive");// Bare row shows no due date / no progress chip of its own.- const bareRow = screen.getByText("Ship dashboards").closest("a");+ const bareRow = inlineChildren().getByText("Ship dashboards").closest("a");expect(bareRow?.textContent).not.toContain("/");});@@ -3777,7 +3933,7 @@ describe("IssueDetail (shared)", () => {renderIssueDetail();- await screen.findByText("Fix login flow");+ await findInlineChild("Fix login flow");expect(screen.queryByText("backend")).not.toBeInTheDocument();expect(screen.queryByText("Jan 1")).not.toBeInTheDocument();});@@ -3819,7 +3975,7 @@ describe("IssueDetail (shared)", () => {renderIssueDetail();- await screen.findByText("Fix login flow");+ await findInlineChild("Fix login flow");// Chip renders only on the row that has a value for the property.expect(await screen.findByText("Sprint 3")).toBeInTheDocument();expect(screen.getAllByText("Sprint 3")).toHaveLength(1);@@ -3872,7 +4028,7 @@ describe("IssueDetail (shared)", () => {renderIssueDetail();- await screen.findByText("Wrapped up");+ await findInlineChild("Wrapped up");const due = screen.getByText("Jan 1");expect(due.closest("span")?.className).not.toContain("text-destructive");expect(due.closest("span")?.className).toContain("text-muted-foreground");diff --git a/packages/views/issues/components/issue-detail.tsx b/packages/views/issues/components/issue-detail.tsxindex 15467a63da..ec7f21a2ab 100644--- a/packages/views/issues/components/issue-detail.tsx+++ b/packages/views/issues/components/issue-detail.tsx@@ -586,6 +586,8 @@ function isOptionalPropSet(}}+const SIDEBAR_SUB_ISSUES_LIMIT = 10;+// groupSubIssuesByStage orders a parent's children for display: staged groups// ascending by stage, then the unstaged group (stage === null) last. Callers// render a per-group stage header only when the set is actually staged.@@ -1557,6 +1559,10 @@ export function IssueDetail({ issueId, onDelete, onDone, onUnsubscribeArchive, dconst [propertiesOpen, setPropertiesOpen] = useState(true);const [detailsOpen, setDetailsOpen] = useState(false);const [parentIssueOpen, setParentIssueOpen] = useState(true);+ const [sidebarSubIssuesOpen, setSidebarSubIssuesOpen] = useState(true);+ const [sidebarSubIssuesExpanded, setSidebarSubIssuesExpanded] = useState(false);+ const sidebarSubIssuesListId = useId();+ useEffect(() => setSidebarSubIssuesExpanded(false), [id]);const [pullRequestsOpen, setPullRequestsOpen] = useState(true);const githubSettings = useGitHubSettings();const pluginsEnabled = useFeatureEnabled(PLUGINS_V1_FLAG, false);@@ -2531,6 +2537,15 @@ export function IssueDetail({ issueId, onDelete, onDone, onUnsubscribeArchive, d});}, [setSubIssuesCollapsed, scrollContainerEl]);const doneChildCount = childIssues.filter((child) => issueBehavesAs(child, "done")).length;+ const sidebarChildIssues = useMemo(() => {+ let ordered = groupSubIssuesByStage(childIssues).flatMap(({ items }) => items);+ if (ordered.length > SIDEBAR_SUB_ISSUES_LIMIT) {+ const unfinished = ordered.filter((child) => !issueBehavesAsAny(child, ["done", "closed"]));+ const finished = ordered.filter((child) => issueBehavesAsAny(child, ["done", "closed"]));+ ordered = [...unfinished, ...finished];+ }+ return sidebarSubIssuesExpanded ? ordered : ordered.slice(0, SIDEBAR_SUB_ISSUES_LIMIT);+ }, [childIssues, sidebarSubIssuesExpanded]);// The sub-issue list owns its selection, reset per issue. Rows, select-all// and the inline batch toolbar must read the same one: a peek renders this@@ -3339,6 +3354,72 @@ export function IssueDetail({ issueId, onDelete, onDone, onUnsubscribeArchive, d</div>}</div>),+ sub_issues: childIssuesLoaded && childIssues.length > 0 && (+ <div>+ <IssueSidebarSectionHeader+ title={t(($) => $.detail.sub_issues_label)}+ open={sidebarSubIssuesOpen}+ onOpenChange={setSidebarSubIssuesOpen}+ status={+ <span+ role="progressbar"+ aria-label={t(($) => $.detail.sub_issues_label)}+ aria-valuemin={0}+ aria-valuemax={childIssues.length}+ aria-valuenow={doneChildCount}+ aria-valuetext={t(($) => $.detail.sub_issues_nav_progress, { done: doneChildCount, total: childIssues.length })}+ className="inline-flex shrink-0 items-center gap-1.5 pr-2 text-caption tabular-nums text-muted-foreground"+ >+ <ProgressRing done={doneChildCount} total={childIssues.length} size={11} />+ <span>{doneChildCount}/{childIssues.length}</span>+ </span>+ }+ />+ {sidebarSubIssuesOpen && (+ <ul id={sidebarSubIssuesListId} className="px-2">+ {sidebarChildIssues.map((child) => (+ <li key={child.id}>+ <AppLink+ href={paths.issueDetail(child.id)}+ title={`${child.identifier} ${child.title}`}+ aria-label={`${child.identifier} ${child.title}, ${resolveStatusLabel(child.status)}`}+ className="group flex min-w-0 items-center gap-1.5 rounded-md px-2 py-2 text-label transition-colors hover:bg-accent/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"+ >+ <span role="img" aria-label={resolveStatusLabel(child.status)} className="shrink-0">+ <StatusIcon+ status={child.status}+ color={resolveStatusColor(child.status)}+ icon={resolveStatusIcon(child.status)}+ category={issueStatusCategory(child) ?? undefined}+ className="h-3.5 w-3.5"+ />+ </span>+ <span className="max-w-[45%] shrink-0 truncate text-muted-foreground">{child.identifier}</span>+ <span className="min-w-0 truncate group-hover:text-foreground">{child.title}</span>+ </AppLink>+ </li>+ ))}+ {childIssues.length > SIDEBAR_SUB_ISSUES_LIMIT && (+ <li>+ <Button+ type="button"+ variant="ghost"+ size="sm"+ className="w-full justify-start text-muted-foreground"+ aria-expanded={sidebarSubIssuesExpanded}+ aria-controls={sidebarSubIssuesListId}+ onClick={() => setSidebarSubIssuesExpanded((expanded) => !expanded)}+ >+ {sidebarSubIssuesExpanded+ ? t(($) => $.detail.sub_issues_show_less)+ : t(($) => $.detail.sub_issues_show_more, { count: childIssues.length - SIDEBAR_SUB_ISSUES_LIMIT })}+ </Button>+ </li>+ )}+ </ul>+ )}+ </div>+ ),duplicates: <IssueDuplicatesSection issueId={issue.id} />,// Pull requests — unavailable when the workspace disables the PR sidebar// (or the GitHub master switch is off). Backend data is kept eitherdiff --git a/packages/views/issues/components/issue-sidebar-settings.tsx b/packages/views/issues/components/issue-sidebar-settings.tsxindex a9237d0edb..cebe22ef9d 100644--- a/packages/views/issues/components/issue-sidebar-settings.tsx+++ b/packages/views/issues/components/issue-sidebar-settings.tsx@@ -55,6 +55,7 @@ export function useIssueSidebarSectionLabels(): Record<IssueSidebarSection, striwakeups: t(($) => $.wakeups.title),plugins: t(($) => $.plugins.panels),parent: t(($) => $.detail.section_parent_issue),+ sub_issues: t(($) => $.detail.sub_issues_label),duplicates: t(($) => $.duplicates.section_title),pull_requests: t(($) => $.detail.section_pull_requests),environments: t(($) => $.environments.section_title),diff --git a/packages/views/locales/en/issues.json b/packages/views/locales/en/issues.jsonindex 44024131f0..c1639bcbb8 100644--- a/packages/views/locales/en/issues.json+++ b/packages/views/locales/en/issues.json@@ -583,6 +583,9 @@"quick_jump_label": "Quick navigation","description_nav_label": "Issue description","sub_issues_nav_progress": "{{done}}/{{total}} completed",+ "sub_issues_show_more_one": "Show {{count}} more",+ "sub_issues_show_more_other": "Show {{count}} more",+ "sub_issues_show_less": "Collapse","thread_nav_label": "Jump to comment thread","thread_nav_resolved_label": "{{title}} (resolved)","thread_nav_reply_label": "{{author}}: {{title}}",diff --git a/packages/views/locales/es/issues.json b/packages/views/locales/es/issues.jsonindex 05bf496487..572fe89ad0 100644--- a/packages/views/locales/es/issues.json+++ b/packages/views/locales/es/issues.json@@ -585,6 +585,9 @@"quick_jump_label": "Navegación rápida","description_nav_label": "Descripción de la tarea","sub_issues_nav_progress": "{{done}}/{{total}} completadas",+ "sub_issues_show_more_one": "Mostrar {{count}} más",+ "sub_issues_show_more_other": "Mostrar {{count}} más",+ "sub_issues_show_less": "Contraer","thread_nav_show_replies_one": "Mostrar {{count}} respuesta","thread_nav_show_replies_other": "Mostrar {{count}} respuestas","thread_nav_hide_replies": "Ocultar respuestas",diff --git a/packages/views/locales/fr/issues.json b/packages/views/locales/fr/issues.jsonindex aa86cacc97..ceb4bf8782 100644--- a/packages/views/locales/fr/issues.json+++ b/packages/views/locales/fr/issues.json@@ -583,6 +583,9 @@"quick_jump_label": "Navigation rapide","description_nav_label": "Description de la tâche","sub_issues_nav_progress": "{{done}}/{{total}} terminées",+ "sub_issues_show_more_one": "Afficher {{count}} de plus",+ "sub_issues_show_more_other": "Afficher {{count}} de plus",+ "sub_issues_show_less": "Réduire","thread_nav_label": "Aller au fil de commentaires","thread_nav_resolved_label": "{{title}} (résolu)","thread_nav_reply_label": "{{author}} : {{title}}",diff --git a/packages/views/locales/ja/issues.json b/packages/views/locales/ja/issues.jsonindex 34ac890c5d..a835de7a3e 100644--- a/packages/views/locales/ja/issues.json+++ b/packages/views/locales/ja/issues.json@@ -575,6 +575,8 @@"quick_jump_label": "クイックナビゲーション","description_nav_label": "タスクの説明","sub_issues_nav_progress": "{{done}}/{{total}} 完了",+ "sub_issues_show_more_other": "さらに {{count}} 件表示",+ "sub_issues_show_less": "折りたたむ","thread_nav_label": "スレッドへ移動","thread_nav_resolved_label": "{{title}}(解決済み)","thread_nav_reply_label": "{{author}}:{{title}}",diff --git a/packages/views/locales/ko/issues.json b/packages/views/locales/ko/issues.jsonindex 1b0fed4197..4907025097 100644--- a/packages/views/locales/ko/issues.json+++ b/packages/views/locales/ko/issues.json@@ -575,6 +575,8 @@"quick_jump_label": "빠른 탐색","description_nav_label": "태스크 설명","sub_issues_nav_progress": "{{done}}/{{total}} 완료",+ "sub_issues_show_more_other": "{{count}}개 더 보기",+ "sub_issues_show_less": "접기","thread_nav_label": "스레드로 이동","thread_nav_resolved_label": "{{title}} (해결됨)","thread_nav_reply_label": "{{author}}: {{title}}",diff --git a/packages/views/locales/ru/issues.json b/packages/views/locales/ru/issues.jsonindex 1e91644048..a73cd561b8 100644--- a/packages/views/locales/ru/issues.json+++ b/packages/views/locales/ru/issues.json@@ -593,6 +593,11 @@"quick_jump_label": "Быстрая навигация","description_nav_label": "Описание задачи","sub_issues_nav_progress": "Завершено: {{done}}/{{total}}",+ "sub_issues_show_more_one": "Показать ещё {{count}}",+ "sub_issues_show_more_few": "Показать ещё {{count}}",+ "sub_issues_show_more_many": "Показать ещё {{count}}",+ "sub_issues_show_more_other": "Показать ещё {{count}}",+ "sub_issues_show_less": "Свернуть","thread_nav_label": "Перейти к треду комментариев","thread_nav_resolved_label": "{{title}} (решено)","thread_nav_reply_label": "{{author}}: {{title}}",diff --git a/packages/views/locales/zh-Hans/issues.json b/packages/views/locales/zh-Hans/issues.jsonindex fc2d6455d6..e7e66c0781 100644--- a/packages/views/locales/zh-Hans/issues.json+++ b/packages/views/locales/zh-Hans/issues.json@@ -573,6 +573,8 @@"quick_jump_label": "快捷跳转","description_nav_label": "任务描述","sub_issues_nav_progress": "已完成 {{done}}/{{total}}",+ "sub_issues_show_more_other": "再显示 {{count}} 条",+ "sub_issues_show_less": "收起","thread_nav_label": "快速跳转到讨论","thread_nav_resolved_label": "{{title}}(已解决)","thread_nav_reply_label": "{{author}}:{{title}}",diff --git a/packages/views/locales/zh-Hant/issues.json b/packages/views/locales/zh-Hant/issues.jsonindex 3c06b7fb00..94ec3f00b5 100644--- a/packages/views/locales/zh-Hant/issues.json+++ b/packages/views/locales/zh-Hant/issues.json@@ -573,6 +573,8 @@"quick_jump_label": "快捷跳轉","description_nav_label": "任務描述","sub_issues_nav_progress": "已完成 {{done}}/{{total}}",+ "sub_issues_show_more_other": "再顯示 {{count}} 筆",+ "sub_issues_show_less": "收合","thread_nav_label": "快速跳轉到討論","thread_nav_resolved_label": "{{title}}(已解決)","thread_nav_reply_label": "{{author}}:{{title}}",