From 95c1ddf92b18d2a1a0e91b3e6247493dea29e275 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A6=E4=B9=A0=E7=88=B1=E6=88=91?= <2381622265@qq.com> Date: Thu, 22 Oct 2026 10:25:30 +0800 Subject: [PATCH] fix(tasks): keep owned task labels consistent with the board --- src/client/tasks-shared.tsx | 4 ++-- tests/tasks-page.spec.tsx | 27 ++++++++++++++++++++++++++- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/src/client/tasks-shared.tsx b/src/client/tasks-shared.tsx index 9111e2e8..44934f17 100644 --- a/src/client/tasks-shared.tsx +++ b/src/client/tasks-shared.tsx @@ -269,7 +269,7 @@ export function TaskLine(props: { role="button" tabIndex={0} className={css.taskLine} - title={tasks.map(task => `${task.subject}(${t(taskStatusKey(task.status))})`).join('\n')} + title={tasks.map(task => `${task.subject}(${taskStatusLabel(task)})`).join('\n')} onClick={(event) => { event.stopPropagation() props.onOpenTask(primary.id, event.currentTarget) @@ -283,7 +283,7 @@ export function TaskLine(props: { > {primary.subject} - {t(taskStatusKey(primary.status))} + {taskStatusLabel(primary)} {tasks.length > 1 && {`+${tasks.length - 1}`}} ) diff --git a/tests/tasks-page.spec.tsx b/tests/tasks-page.spec.tsx index 5b68d15d..87177892 100644 --- a/tests/tasks-page.spec.tsx +++ b/tests/tasks-page.spec.tsx @@ -2,7 +2,8 @@ * Tasks page interaction tests (jsdom): the jobs drawer's auto-collapse at * the agent-count threshold, the graph/tree view toggle visible in BOTH * modes, node click → transcript jump, ⓘ → anchored popover, and the - * settled-leaf fold aggregate expanding on click. + * settled-leaf fold aggregate expanding on click. Owned task lines and + * tooltips must use the same blocked-status rule as the team board. */ // @vitest-environment jsdom import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' @@ -576,6 +577,28 @@ describe('Tasks page graph interactions and team board', () => { }) describe('Tasks page: owned tasks, host-primitive controls, draggable output', () => { + it.each([ + ['pending', false, '阻塞'], + ['pending', true, '待办'], + ['in_progress', false, '进行中'], + ['completed', false, '已完成'], + ] as const)('keeps the board, task line and tooltip consistent for %s (ready: %s)', async (status, ready, label) => { + withTeam({ tasks: [teamTask({ status, ready, ownerName: 'writer' })] }) + const store = makeStore(snapshotWithChildren(1)) + const { container, unmount } = renderRoot( + createElement(SubagentView, { sessionId: 'root', active: true, ctx: makeCtx(store) }), + ) + try { + await act(async () => { await Promise.resolve() }) + expect(container.querySelector('[data-team-board]')?.textContent).toContain(label) + const taskLine = container.querySelector('[data-graph-node="child-0"] [role="button"]') + expect(taskLine?.textContent).toContain(label) + expect(taskLine?.getAttribute('title')).toBe(`收窄卡片(${label})`) + } finally { + unmount() + } + }) + /** A board whose two tasks are both owned by the child agent. */ function teamWithOwnedTask(): void { withTeam({ @@ -602,6 +625,8 @@ describe('Tasks page: owned tasks, host-primitive controls, draggable output', ( expect(node.textContent).toContain('收窄卡片与图标化') expect(node.textContent).toContain('进行中') expect(node.textContent).toContain('+1') + expect(node.querySelector('[role="button"]')?.getAttribute('title')) + .toBe('收窄卡片与图标化(进行中)\n补点击回归(阻塞)') unmount() })