fix(ui): show each related task once in the Tasks tab (#20315)

## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work.
> - The Tasks tab shows related tasks in separate sections.
> - A task can be both a subtask and a task created from the current
task.
> - The tab showed that task in Subtasks and again in its project group.
> - This pull request removes tasks from project groups when another
section already shows them.
> - Users can scan each task once and keep the subtask progress view.

## Linked Issues or Issue Description

**What happened?**
The Tasks tab shows the same task in Next action or Other subtasks and
again in a project group.

**Expected behavior**
Show each task once. Hide a project group when all its tasks appear in
other sections.

**Steps to reproduce**
1. Open a task that created subtasks in the same project.
2. Open the Tasks tab.
3. Compare Next action and Other subtasks with the project section.

**Paperclip version or commit**
Reproduced in component tests on source commit `189fefb99183`.

**Deployment mode**
Built from source. The fault is in the shared UI component.

No related open pull request was found in searches for duplicate tasks
and TaskDetailTasksPanel.

## What Changed

- Exclude task IDs already shown as subtasks, ancestors, the creation
source, or a root blocker from project groups.
- Show a creation source that is also an ancestor only in Created from.
- Hide empty project groups, including No project.
- Use an index for project lookup.
- Update the product contract and regression tests.

## Verification

- Before the fix, four regression cases failed because task rows or
links appeared twice.
- After the fix, both relation-panel test files pass: 19 tests. Run from
`ui`: `node ../node_modules/vitest/vitest.mjs run --config
vitest.config.ts
src/components/task-detail/TaskDetailTasksPanel.test.tsx
src/components/task-detail/TaskDetailRelationsPanel.test.tsx`.
- Tests cover active and completed subtasks, progress, independent
collapse, duplicate input rows, empty project groups, ancestors, the
creation source, and a root blocker.
- A test with 800 tasks and 120 projects checks unique rows and bounds
task and project lookups.
- `pnpm check:token-gates` and `git diff --check` pass.
- The first CI typecheck found an incomplete blocker-attention test
fixture. The fixture now supplies all required fields. The 19 focused
tests pass again.
- `pnpm --filter @paperclipai/ui typecheck` passes after `pnpm --filter
@paperclipai/plugin-sdk ensure-build-deps`. The first local attempt
lacked the built SDK; the retry built that dependency.
- `pnpm verify` returns exit 2 because the product document requires
broad CI coverage. CI typecheck, build, general tests, browser shards,
and serialized server suites pass on the current head.
- Full local preflight could not finish: the OpenCode CLI install hook
failed, and Cargo is absent. The UI tests ran after installing
dependencies with install hooks disabled.
- No full-stack browser acceptance was run. This change has component
DOM evidence.
- Greptile gives the current head
`f3bfd8fb47154810b85578ee6731246238caf67a` 5/5 with no review threads.
- All 58 current-head checks pass. [CI attempt
2](https://github.com/paperclipai/paperclip/actions/runs/42657701260/attempts/2)
succeeded on `f3bfd8fb47154810b85578ee6731246238caf67a`.
- The first Rust CI job failed in
`reaping_stops_a_dead_runners_provider_and_its_escaped_tool_job`. Its
report listed one unattributed orphan after cleanup. The same Rust code
passed in the previous run. [One job
retry](https://github.com/paperclipai/paperclip/actions/runs/42657701260/job/129311740923)
passed without code changes. The original failure is retained here; its
exact cause was not established. This PR does not change Rust code.

## Risks

- Low risk. This changes UI grouping only. Stored task relationships and
API data stay the same.
- A project section can disappear when every task in it already appears
above. This is the expected result.

## Model Used

- OpenAI GPT-6, through Codex, with reasoning, repository tools, and
code execution. The runtime does not expose a more specific model build
or context window size.

## Checklist

- [x] I have included a thinking path that traces from project context
to this change
- [x] I have specified the model used (with version and capability
details)
- [x] I have checked ROADMAP.md and confirmed this PR does not duplicate
planned core work
- [x] I have searched GitHub for duplicate or related PRs and linked
them above
- [x] I have either (a) linked existing issues with `Fixes: #` / `Closes
#` / `Refs #` OR (b) described the issue in-PR following the relevant
issue template
- [x] I have not referenced internal/instance-local Paperclip issues or
links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip`
URLs)
- [x] My branch name describes the change (e.g. `docs/...`, `fix/...`)
and contains no internal Paperclip ticket id or instance-derived details
- [x] I have run tests locally and they pass
- [x] I have added or updated tests where applicable
- [x] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented any risks above
- [x] All Paperclip CI gates are green
- [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
- [x] I will address all Greptile and reviewer comments before
requesting merge

---------

Co-authored-by: Paperclip <noreply@paperclip.ing>
This commit is contained in:
DottaandPaperclip authored and GitHub committed 2026-11-13 13:28:17 -06:00
1 parent c6301c92ff
commit d738ed5ee4
3 files changed
+100 -9

No files matched your search

+2 -1
View File
@@ -95,7 +95,8 @@ The current issue model includes stable issue identifiers, parent/sub-issues, bl
When an agent creates a subtask or follow-up task, its source task's feed shows
a linked card at creation time with the current title, task number, and status.
The Tasks tab keeps the full relationship list.
The Tasks tab keeps the full relationship list and shows each task once. Project
groups omit tasks already shown in the other sections and disappear when empty.
Agent-owned tasks show **In Progress** only while a task-linked run is queued
or running. When execution ends, their visible status reflects recovery
@@ -58,17 +58,77 @@ describe("TaskDetailTasksPanel", () => {
expect(container.textContent).toContain("No tasks yet.");
});
it("keeps subtask membership separate from creation membership, including overlap", () => {
it("shows overlapping next actions and other subtasks only in the subtask section", () => {
const manual = task("manual-child");
const overlap = task("created-child", { projectId: project.id });
const overlap = task("created-child", { projectId: project.id, status: "in_progress" });
const completed = task("completed-child", { projectId: project.id, status: "done" });
const followup = task("other-parent", { parentId: "elsewhere", projectId: project.id });
render({ subtasks: [manual, overlap], createdTasks: [overlap, followup], projects: [project] });
expect(container.querySelectorAll('[data-task-id="created-child"]')).toHaveLength(2);
render({ subtasks: [manual, overlap, completed], createdTasks: [{ ...overlap }, followup, { ...completed }], projects: [project] });
expect(container.querySelectorAll('[data-task-id="created-child"]')).toHaveLength(1);
expect(container.querySelectorAll('[data-task-id="completed-child"]')).toHaveLength(1);
expect(container.querySelectorAll('[data-task-id="manual-child"]')).toHaveLength(1);
const group = container.querySelector('section[aria-label="Board UI"]')!;
expect(group.textContent).toContain("other-parent");
expect(group.textContent).not.toContain("created-child");
expect(group.textContent).not.toContain("completed-child");
expect(group.textContent).not.toContain("manual-child");
expect(container.querySelectorAll('[role="progressbar"]')).toHaveLength(1);
expect(container.querySelector('[role="progressbar"]')?.getAttribute("aria-valuenow")).toBe("33");
act(() => (container.querySelector('section[aria-label="Subtasks"] button') as HTMLButtonElement).click());
expect(container.querySelector('[data-task-id="created-child"]')).toBeNull();
expect(container.querySelector('[data-task-id="other-parent"]')).not.toBeNull();
});
it.each([project.id, null])("hides a project group when all its tasks are subtasks (project %s)", (projectId) => {
const child = task("child", { projectId });
render({ subtasks: [child, { ...child }], createdTasks: [{ ...child }, child], projects: [project] });
expect(container.querySelectorAll('[data-task-id="child"]')).toHaveLength(1);
expect([...container.querySelectorAll('h2')].map((heading) => heading.textContent)).toEqual(["Subtasks"]);
expect(container.textContent).not.toContain("No tasks yet.");
});
it("does not repeat a subtask's root blocker in a project group", () => {
const blocker = task("blocker", { identifier: "PAP-11", projectId: project.id });
const child = task("child", {
status: "blocked",
blockerAttention: {
state: "needs_attention",
reason: "attention_required",
unresolvedBlockerCount: 1,
coveredBlockerCount: 0,
stalledBlockerCount: 0,
attentionBlockerCount: 1,
sampleBlockerIdentifier: blocker.identifier,
sampleStalledBlockerIdentifier: null,
terminalBlocker: blocker,
},
});
render({ subtasks: [child], createdTasks: [blocker], projects: [project] });
expect(container.querySelectorAll('a[href="/issues/PAP-11"]')).toHaveLength(1);
expect(container.querySelector('[data-task-id="blocker"]')).toBeNull();
expect(container.querySelector('section[aria-label="Board UI"]')).toBeNull();
});
it("keeps task and project lookups linear for large overlapping lists", () => {
let lookups = 0;
const readId = (id: string) => {
if (++lookups > 12000) throw new Error("Too many task and project lookups");
return id;
};
const projects = Array.from({ length: 120 }, (_, index) => ({
...project, get id() { return readId(`project-${index}`); }, name: `Project ${index}`,
}));
const tasks = Array.from({ length: 800 }, (_, index) => task(`task-${index}`, {
projectId: `project-${index % projects.length}`,
}));
for (let index = 0; index < tasks.length; index++) {
Object.defineProperty(tasks[index], "id", { get: () => readId(`task-${index}`) });
}
render({ subtasks: tasks.slice(0, 600), createdTasks: tasks, projects });
const rows = [...container.querySelectorAll('[data-task-id]')];
expect(rows).toHaveLength(800);
expect(new Set(rows.map((row) => row.getAttribute("data-task-id"))).size).toBe(800);
expect(lookups).toBeLessThan(12000);
});
it("hides absent subtasks and puts unowned tasks under No project without a link or progress", () => {
@@ -124,4 +184,24 @@ describe("TaskDetailTasksPanel", () => {
expect(container.querySelector('section[aria-label="Created from"]')).toBeNull();
expect(container.textContent).toContain("No tasks yet.");
});
it("does not repeat the creation source or ancestors in project groups", () => {
render({
ancestors,
createdFrom: {
issue: ancestors[0],
run: null,
agent: null,
},
subtasks: [],
createdTasks: [task("parent", { projectId: project.id }), task("root"), task("followup", { projectId: project.id })],
projects: [project],
});
expect(container.querySelectorAll('a[href="/issues/PAP-2"]')).toHaveLength(1);
expect(container.querySelectorAll('a[href="/issues/root"]')).toHaveLength(1);
expect(container.querySelector('[data-task-id="parent"]')).toBeNull();
expect(container.querySelector('[data-task-id="root"]')).toBeNull();
expect(container.querySelector('[data-task-id="followup"]')).not.toBeNull();
expect(container.querySelector('section[aria-label="No project"]')).toBeNull();
});
});
@@ -6,7 +6,7 @@ import { projectRouteRef } from "@/lib/utils";
import { issueStatusOrder } from "@/lib/issue-filters";
import { Button } from "@/components/ui/button";
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@/components/ui/collapsible";
import { RelationNavigationList, TaskDetailSubtasksPanel, TaskDetailTaskList } from "./TaskDetailRelationsPanel";
import { RelationNavigationList, resolveTaskDetailSubtaskState, TaskDetailSubtasksPanel, TaskDetailTaskList } from "./TaskDetailRelationsPanel";
import { IssueCreatedFromNote } from "./IssueCreatedFromNote";
function TaskGroup({ name, projectPath, children }: { name: string; projectPath?: string; children: ReactNode }) {
@@ -49,12 +49,22 @@ export interface TaskDetailTasksPanelProps {
}
export function TaskDetailTasksPanel({ ancestors = [], createdFrom = null, subtasks, createdTasks, projects, isLoading, hasError, onRetry, issueLinkState }: TaskDetailTasksPanelProps) {
const visibleAncestors = ancestors.filter((item) => item.id !== createdFrom?.issue.id);
const sortedSubtasks = sortTasks(subtasks);
const displayedTaskIds = new Set([
...(createdFrom ? [createdFrom.issue.id] : []),
...ancestors.map((item) => item.id),
...sortedSubtasks.map((item) => item.id),
]);
const { rootBlocker } = resolveTaskDetailSubtaskState(sortedSubtasks);
if (rootBlocker) displayedTaskIds.add(rootBlocker.id);
const projectsById = new Map(projects.map((project) => [project.id, project]));
const groups = new Map<string, { name: string; path?: string; tasks: Issue[] }>();
for (const item of sortTasks(createdTasks)) {
if (displayedTaskIds.has(item.id)) continue;
const key = item.projectId ?? "no-project";
const project = item.projectId
? projects.find((candidate) => candidate.id === item.projectId) ?? item.project
? projectsById.get(item.projectId) ?? item.project
: null;
const group = groups.get(key) ?? {
name: project?.name ?? (item.projectId ? "Project" : "No project"),
@@ -71,10 +81,10 @@ export function TaskDetailTasksPanel({ ancestors = [], createdFrom = null, subta
<IssueCreatedFromNote createdFrom={createdFrom} issueLinkState={issueLinkState} className="px-2 text-sm" />
</TaskGroup>
)}
{ancestors.length > 0 && (
{visibleAncestors.length > 0 && (
<TaskGroup name="Ancestors">
<RelationNavigationList
items={[...ancestors].reverse()}
items={[...visibleAncestors].reverse()}
emptyMessage=""
ariaLabel="Ancestor tasks, root to parent"
issueLinkState={issueLinkState}