🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
💄 style(tasks): fix tasks-list composer, scheduled group & row noise (#16711)
Arvin Xub5022baffb3c
diff --git a/.agents/skills/agent-testing/SKILL.md b/.agents/skills/agent-testing/SKILL.mdindex 90b1a05d09b..7a150a74da6 100644--- a/.agents/skills/agent-testing/SKILL.md+++ b/.agents/skills/agent-testing/SKILL.md@@ -446,21 +446,17 @@ Two hard rules worth front-loading:embed images/GIFs in `report.md` (no ``) — they would justdouble up with the per-case evidence the page already shows. `report.md` staysprose-only (follow-ups / notes / reproduction).-- **Final replies: lead with the published `/verify/<id>` link; NEVER paste a- list of plain local-file links.** A `[Image #1 …](<report-dir>/assets/foo.png)`- markdown link renders as blue text that the user cannot click open in the chat- UI — it's a dead link. The published verify report already renders every- screenshot inline, so the primary deliverable in the reply is the- `https://app.lobehub.com/verify/<id>` URL (plus the local report dir for- reference). Then EITHER:- - **omit the evidence block entirely** (default — the report page already shows- it), OR- - if a visual genuinely helps inline, **embed it as an image, not a link** —- use `` (leading `!`) so it renders as a- picture, with the caption describing the observed UI outcome. Use- repo-relative paths, not absolute paths. Do not emit a bare- `[label](local/path)` link list — it's the one thing that looks like evidence- but can't be opened.+- **Final replies: the ONLY visual deliverable is the published `/verify/<id>`+ link — put NO images and NO local-file links in the chat reply at all.** The+ chat UI cannot load a local-path image: a ``+ embed renders as a broken-image placeholder (empty grey box), and a+ `[Image #1 …](<report-dir>/assets/foo.png)` link renders as blue text that+ can't be opened — both are dead. Local report paths only resolve on the+ machine, not in the message. So the primary (and only) evidence pointer in the+ reply is the `https://app.lobehub.com/verify/<id>` URL, where every screenshot+ is already rendered inline; you may also mention the local report dir as a+ plain string for reference (not a markdown link). Describe key visual outcomes+ in prose if useful, but never attempt to show a screenshot inline in chat.- **Time-based behavior needs a GIF, not a screenshot.** If a case assertschange over time (streaming output, a ticking timer, loading states,animations), record it with `scripts/record-gif.sh` and attach the GIF as thatdiff --git a/.agents/skills/agent-testing/references/common-mistakes.md b/.agents/skills/agent-testing/references/common-mistakes.mdindex 0c1ce00f05c..8d2c46d5c33 100644--- a/.agents/skills/agent-testing/references/common-mistakes.md+++ b/.agents/skills/agent-testing/references/common-mistakes.md@@ -157,12 +157,25 @@ user's resident 9222 app — use a pool id. Also: `agent-browser open` mangles`app://` → `https://app//…` (ERR\_CONNECTION\_CLOSED); navigate inside the SPA byclicking its own `<a href>` links, not `open`.-## Case 7 — (placeholder) append the user's next negative feedback below--<!-- New case template:-## Case N — one-line summary of the mistake-**Wrong approach**: …-**Why it's wrong**: …-**What it breaks**: …-**Correct approach**: …--->+## Case 7 — Embedding a local-path screenshot in the chat reply (broken-image placeholder)++**Wrong approach**: ending the final reply with an inline image embed pointing at+the report dir — `` —+believing a leading `!` makes it render as a picture in chat.++**Why it's wrong**: the chat UI can't load a local filesystem path. The embed+renders as an empty grey broken-image box (the user sees a placeholder + " 完全+看不了图内容 "), and the plain-link form `[Image](…local…png)` is an un-openable+dead link. Local report paths only resolve on the machine, never inside the+message. The earlier guidance that said "if a visual helps, embed it as an image,+not a link" was itself wrong and has been removed.++**What it breaks**: the reply looks like it has evidence but shows nothing —+the user gets a broken box instead of the screenshot, and has to go find the+verify link anyway.++**Correct approach**: put NO images and NO local-file links in the chat reply.+The published `https://app.lobehub.com/verify/<id>` page already renders every+screenshot inline — that URL is the only visual deliverable. Describe key visual+outcomes in prose; mention the local report dir as a plain string (not a+markdown link) if a reference is useful.diff --git a/locales/en-US/chat.json b/locales/en-US/chat.jsonindex 00d915c3ca4..5c39c1173e4 100644--- a/locales/en-US/chat.json+++ b/locales/en-US/chat.json@@ -155,6 +155,7 @@"createModal.title": "What should this Agent do?","createTask.assignee": "Assignee","createTask.collapse": "Hide input",+ "createTask.createFailed": "Failed to create task","createTask.expandToInline": "Dock to page","createTask.instructionPlaceholder": "Add task instruction...","createTask.submit": "Create task",diff --git a/locales/zh-CN/chat.json b/locales/zh-CN/chat.jsonindex f808ef67309..613c13b53ca 100644--- a/locales/zh-CN/chat.json+++ b/locales/zh-CN/chat.json@@ -155,6 +155,7 @@"createModal.title": "这个助理要做什么?","createTask.assignee": "负责人","createTask.collapse": "隐藏输入",+ "createTask.createFailed": "创建任务失败","createTask.expandToInline": "固定到页面","createTask.instructionPlaceholder": "添加描述…","createTask.submit": "创建任务",diff --git a/packages/locales/src/default/chat.ts b/packages/locales/src/default/chat.tsindex 3e08f3726a9..1b61126f783 100644--- a/packages/locales/src/default/chat.ts+++ b/packages/locales/src/default/chat.ts@@ -1023,6 +1023,7 @@ export default {'createTask.assignee': 'Assignee','createTask.collapse': 'Hide input',+ 'createTask.createFailed': 'Failed to create task','createTask.expandToInline': 'Dock to page','createTask.instructionPlaceholder': 'Add task instruction...','createTask.submit': 'Create task',diff --git a/src/features/AgentTasks/AgentTaskList/CreateTaskInlineEntry.tsx b/src/features/AgentTasks/AgentTaskList/CreateTaskInlineEntry.tsxindex a3fe630c614..ee9fb968e13 100644--- a/src/features/AgentTasks/AgentTaskList/CreateTaskInlineEntry.tsx+++ b/src/features/AgentTasks/AgentTaskList/CreateTaskInlineEntry.tsx@@ -6,10 +6,11 @@ import { Button } from 'antd';import { cssVar } from 'antd-style';import { $getRoot } from 'lexical';import { ChevronUp, Paperclip, UserCircle2 } from 'lucide-react';-import { type KeyboardEvent, memo, useCallback, useEffect, useRef, useState } from 'react';+import { type KeyboardEvent, memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';import { useTranslation } from 'react-i18next';import { useActiveWorkspaceId } from '@/business/client/hooks/useActiveWorkspaceId';+import { message } from '@/components/AntdStaticMethods';import { EditorCanvas } from '@/features/EditorCanvas';import {getAttachmentFileIdsFromEditor,@@ -84,6 +85,17 @@ const CreateTaskInlineEntry = memo<CreateTaskInlineEntryProps>((props) => {const editor = useEditor();+ // Persist the in-progress draft per scope so a reload / accidental close+ // doesn't eat a long prompt. Skipped for the transient subtask composer.+ const draftStorageKey = useMemo(+ () => (parentTaskId ? null : `lobehub:task-create-draft:${agentId ?? 'all'}`),+ [agentId, parentTaskId],+ );+ // Tracks which scope key the editor is currently hydrated for. The component+ // is reused across /agent/A/tasks -> /agent/B/tasks -> /tasks without+ // unmounting, so a boolean would strand the new scope on the old draft.+ const draftRestoredKeyRef = useRef<string | null>(null);+const assigneeMeta = useAgentDisplayMeta(assigneeAgentId);// When the assignee is locked to a scoped agent, keep it in sync with the@@ -104,6 +116,67 @@ const CreateTaskInlineEntry = memo<CreateTaskInlineEntryProps>((props) => {if (autoFocus || isHero) editor?.focus?.();}, [autoFocus, canCreateTask, editor, isHero]);+ // Hydrate the editor with the current scope's saved draft. Re-runs whenever+ // the scope key changes (not just on mount): it first resets to this scope's+ // baseline so a previous scope's draft can't leak across a switch, then loads+ // the new key's draft. The editor's onContentChange syncs `instruction`.+ useEffect(() => {+ if (!draftStorageKey || !editor) return;+ if (draftRestoredKeyRef.current === draftStorageKey) return;+ draftRestoredKeyRef.current = draftStorageKey;++ // Reset to baseline for the new scope before hydrating.+ editor.cleanDocument?.();+ setPriority(0);+ setVisibility('private');+ if (!lockAssignee) setAssigneeAgentId(agentId);++ let raw: string | null;+ try {+ raw = localStorage.getItem(draftStorageKey);+ } catch {+ raw = null;+ }+ if (!raw) return;+ try {+ const draft = JSON.parse(raw) as {+ assigneeAgentId?: string;+ markdown?: string;+ priority?: number;+ visibility?: 'private' | 'public';+ };+ if (draft.markdown) editor.setDocument?.('markdown', draft.markdown);+ if (typeof draft.priority === 'number') setPriority(draft.priority);+ if (!lockAssignee && draft.assigneeAgentId) setAssigneeAgentId(draft.assigneeAgentId);+ if (draft.visibility) setVisibility(draft.visibility);+ } catch {+ /* ignore a malformed draft */+ }+ }, [agentId, draftStorageKey, editor, lockAssignee]);++ // Back the draft to storage on every change. Gated behind the restore pass so+ // the initial render can't clobber a just-read draft. Write-only on non-empty:+ // the key is cleared only on a successful submit (below), never here — so a+ // `setDocument`-timing gap right after restore can't wipe a valid draft.+ useEffect(() => {+ if (!draftStorageKey || draftRestoredKeyRef.current !== draftStorageKey || !editor) return;+ const markdown = String(editor.getDocument?.('markdown') ?? '').trim();+ if (!markdown) return;+ try {+ localStorage.setItem(+ draftStorageKey,+ JSON.stringify({+ assigneeAgentId: lockAssignee ? undefined : assigneeAgentId,+ markdown,+ priority,+ visibility,+ }),+ );+ } catch {+ /* storage unavailable / quota — persistence is best-effort */+ }+ }, [assigneeAgentId, draftStorageKey, editor, instruction, lockAssignee, priority, visibility]);+const handleCollapse = useCallback(() => {if (onCollapse) {onCollapse();@@ -145,34 +218,50 @@ const CreateTaskInlineEntry = memo<CreateTaskInlineEntryProps>((props) => {const editorJson = editor?.getDocument?.('json') as unknown;- const result = await createTask({- assigneeAgentId,- editorData: editorJson,- instruction: markdown || trimmedText || name || '',- name,- parentTaskId,- priority: priority || undefined,- // Only send visibility in workspace mode; personal mode lets the server- // fall through to the schema default ('public', inert in personal mode).- visibility: activeWorkspaceId ? visibility : undefined,- });-- if (result) {- setPriority(0);- setAssigneeAgentId(agentId);- setInstruction('');- setVisibility('private');- editor?.cleanDocument?.();- onCreated?.({- agentId: result.assigneeAgentId ?? undefined,- identifier: result.identifier,+ // `createTask` keeps its rejecting contract (other callers rely on `catch`);+ // handle the composer's own failure here so it isn't silent, keeping the+ // draft intact (the reset only runs on success).+ try {+ const result = await createTask({+ assigneeAgentId,+ editorData: editorJson,+ instruction: markdown || trimmedText || name || '',+ name,+ parentTaskId,+ priority: priority || undefined,+ // Only send visibility in workspace mode; personal mode lets the server+ // fall through to the schema default ('public', inert in personal mode).+ visibility: activeWorkspaceId ? visibility : undefined,});++ if (result) {+ setPriority(0);+ setAssigneeAgentId(agentId);+ setInstruction('');+ setVisibility('private');+ editor?.cleanDocument?.();+ if (draftStorageKey) {+ try {+ localStorage.removeItem(draftStorageKey);+ } catch {+ /* ignore */+ }+ }+ onCreated?.({+ agentId: result.assigneeAgentId ?? undefined,+ identifier: result.identifier,+ });+ }+ } catch {+ message.error(t('createTask.createFailed'));}}, [+ t,activeWorkspaceId,agentId,assigneeAgentId,createTask,+ draftStorageKey,editor,instruction,onCreated,@@ -213,6 +302,10 @@ const CreateTaskInlineEntry = memo<CreateTaskInlineEntryProps>((props) => {<Flexboxstyle={{fontSize: isHero ? 16 : 14,+ // Cap the editor so a long draft scrolls inside the box instead of+ // growing the composer until it pushes the task list below the fold.+ maxHeight: isHero ? 360 : 200,+ overflowY: 'auto',padding: isHero ? '20px 24px 4px' : '12px 40px 0 16px',}}>diff --git a/src/features/AgentTasks/AgentTaskList/listViewOptions.ts b/src/features/AgentTasks/AgentTaskList/listViewOptions.tsindex 575464b32f5..b1d6cabcf27 100644--- a/src/features/AgentTasks/AgentTaskList/listViewOptions.ts+++ b/src/features/AgentTasks/AgentTaskList/listViewOptions.ts@@ -26,7 +26,7 @@ export interface TaskGroupMeta {key: string;label: string;priority?: number;- status?: 'backlog' | 'canceled' | 'completed' | 'failed' | 'paused' | 'running';+ status?: 'backlog' | 'canceled' | 'completed' | 'failed' | 'paused' | 'running' | 'scheduled';}export const DEFAULT_TASK_LIST_VIEW_OPTIONS: TaskListViewOptions = {@@ -92,9 +92,10 @@ const STATUS_GROUP_RANK_MAP: Record<NonNullable<TaskGroupMeta['status']>, numberpaused: 0,failed: 1,running: 2,- backlog: 3,- completed: 4,- canceled: 5,+ scheduled: 3,+ backlog: 4,+ completed: 5,+ canceled: 6,};const TASK_STATUS_TO_GROUP_MAP: Record<string, NonNullable<TaskGroupMeta['status']>> = {@@ -104,7 +105,10 @@ const TASK_STATUS_TO_GROUP_MAP: Record<string, NonNullable<TaskGroupMeta['statusfailed: 'failed',paused: 'paused',running: 'running',- scheduled: 'running',+ // Scheduled tasks are idle-until-next-run, not executing — keep them in their+ // own group instead of folding into "running" ("In progress"), whose label+ // would otherwise assert a state the task isn't in.+ scheduled: 'scheduled',};const getPriorityValue = (task: TaskListItem) => task.priority ?? 0;@@ -230,6 +234,7 @@ export const getTaskGroupMeta = (task: TaskListItem, groupBy: TaskGroupBy): Taskfailed: 'taskDetail.status.failed',paused: 'taskDetail.status.paused',running: 'taskDetail.status.running',+ scheduled: 'taskDetail.status.scheduled',};return {groupBy: 'status',diff --git a/src/features/AgentTasks/CreateTaskModal/CreateTaskContent.tsx b/src/features/AgentTasks/CreateTaskModal/CreateTaskContent.tsxindex 89048394a78..f41d4d7f05a 100644--- a/src/features/AgentTasks/CreateTaskModal/CreateTaskContent.tsx+++ b/src/features/AgentTasks/CreateTaskModal/CreateTaskContent.tsx@@ -10,6 +10,7 @@ import { type KeyboardEvent, memo, useCallback, useEffect, useRef, useState } frimport { useTranslation } from 'react-i18next';import { useActiveWorkspaceId } from '@/business/client/hooks/useActiveWorkspaceId';+import { message } from '@/components/AntdStaticMethods';import { EditorCanvas } from '@/features/EditorCanvas';import {getAttachmentFileIdsFromEditor,@@ -98,22 +99,28 @@ const CreateTaskContent = memo<CreateTaskContentProps>(const editorJson = editor?.getDocument?.('json') as unknown;- const result = await createTask({- assigneeAgentId,- editorData: editorJson,- instruction: instruction || title.trim(),- name: title.trim() || undefined,- priority: priority || undefined,- // Only send visibility in workspace mode; personal mode ignores it.- visibility: activeWorkspaceId ? visibility : undefined,- });-- if (result) {- close();- onCreated?.({- agentId: result.assigneeAgentId ?? undefined,- identifier: result.identifier,+ // `createTask` keeps its rejecting contract; surface the failure here so a+ // failed create isn't silent and the modal stays open with its content.+ try {+ const result = await createTask({+ assigneeAgentId,+ editorData: editorJson,+ instruction: instruction || title.trim(),+ name: title.trim() || undefined,+ priority: priority || undefined,+ // Only send visibility in workspace mode; personal mode ignores it.+ visibility: activeWorkspaceId ? visibility : undefined,});++ if (result) {+ close();+ onCreated?.({+ agentId: result.assigneeAgentId ?? undefined,+ identifier: result.identifier,+ });+ }+ } catch {+ message.error(t('createTask.createFailed'));}}, [activeWorkspaceId,@@ -124,6 +131,7 @@ const CreateTaskContent = memo<CreateTaskContentProps>(editor,onCreated,priority,+ t,title,visibility,]);diff --git a/src/features/AgentTasks/features/AgentTaskItem.test.tsx b/src/features/AgentTasks/features/AgentTaskItem.test.tsxindex 03b84bce839..e017c8f8217 100644--- a/src/features/AgentTasks/features/AgentTaskItem.test.tsx+++ b/src/features/AgentTasks/features/AgentTaskItem.test.tsx@@ -66,10 +66,6 @@ vi.mock('./formatTaskItemDate', () => ({formatTaskItemDate: () => 'today',}));-vi.mock('./TaskLatestActivity', () => ({- default: () => null,-}));-vi.mock('./TaskPriorityTag', () => ({default: () => <span>priority</span>,}));diff --git a/src/features/AgentTasks/features/AgentTaskItem.tsx b/src/features/AgentTasks/features/AgentTaskItem.tsxindex a0f4cadcd88..d8f9f6ce972 100644--- a/src/features/AgentTasks/features/AgentTaskItem.tsx+++ b/src/features/AgentTasks/features/AgentTaskItem.tsx@@ -13,7 +13,6 @@ import { taskDetailPath } from '../shared/taskDetailPath';import AssigneeAgentSelector from './AssigneeAgentSelector';import AssigneeAvatar from './AssigneeAvatar';import { formatTaskItemDate } from './formatTaskItemDate';-import TaskLatestActivity from './TaskLatestActivity';import TaskPriorityTag from './TaskPriorityTag';import TaskStatusTag from './TaskStatusTag';import TaskSubtaskProgressTag from './TaskSubtaskProgressTag';@@ -184,7 +183,6 @@ const AgentTaskItem = memo<TaskItemProps>(({ task, routeScope = 'agent', variantonSubtaskClick={handleSubtaskClick}/></Flexbox>- <TaskLatestActivity activities={taskDetail?.activities} /><Flexbox horizontal align={'center'} gap={8} style={FLEX_MIN_WIDTH_0}><TaskPriorityTag priority={task.priority} taskIdentifier={task.identifier} />{scheduleNode}@@ -206,7 +204,6 @@ const AgentTaskItem = memo<TaskItemProps>(({ task, routeScope = 'agent', variant{timeNode}</Flexbox></Flexbox>- <TaskLatestActivity activities={taskDetail?.activities} /></Block></ContextMenuTrigger>);diff --git a/src/features/AgentTasks/features/TaskLatestActivity.tsx b/src/features/AgentTasks/features/TaskLatestActivity.tsxdeleted file mode 100644index d310001abac..00000000000--- a/src/features/AgentTasks/features/TaskLatestActivity.tsx+++ /dev/null@@ -1,82 +0,0 @@-import type { TaskDetailActivity } from '@lobechat/types';-import { Flexbox, Icon, Text } from '@lobehub/ui';-import { TreeDownRightIcon } from '@lobehub/ui/icons';-import { cssVar } from 'antd-style';-import type { TFunction } from 'i18next';-import { memo, useMemo } from 'react';-import { useTranslation } from 'react-i18next';--const getActivityText = (activity: TaskDetailActivity | undefined, t: TFunction<'chat'>) => {- if (!activity) return undefined;-- if (activity.type === 'comment') return activity.content || undefined;- if (activity.type === 'topic') {- const title = activity.title || t('taskDetail.latestActivity.untitledTopic');- const topicText = activity.seq- ? t('taskDetail.latestActivity.topicWithSeq', { seq: activity.seq, title })- : t('taskDetail.latestActivity.topic', { title });-- return activity.sourceTaskIdentifier- ? t('taskDetail.latestActivity.topicFromSubtask', {- identifier: activity.sourceTaskIdentifier,- topic: topicText,- })- : topicText;- }-- const briefTitle = activity.title || activity.summary;- if (!briefTitle) {- return activity.briefType- ? t('taskDetail.latestActivity.briefWithTypeOnly', { type: activity.briefType })- : undefined;- }-- if (activity.resolvedAction) {- return t('taskDetail.latestActivity.briefWithAction', {- action: activity.resolvedAction,- title: briefTitle,- });- }- return activity.briefType- ? t('taskDetail.latestActivity.briefWithType', { type: activity.briefType, title: briefTitle })- : t('taskDetail.latestActivity.brief', { title: briefTitle });-};--interface TaskLatestActivityProps {- activities?: TaskDetailActivity[];-}--const TaskLatestActivity = memo<TaskLatestActivityProps>(({ activities }) => {- const { t } = useTranslation('chat');- const latestActivityText = useMemo(() => {- if (!activities || activities.length === 0) return undefined;-- const latest = [...activities].sort((a, b) => {- const timeA = a.time ? new Date(a.time).getTime() : 0;- const timeB = b.time ? new Date(b.time).getTime() : 0;- return timeB - timeA;- })[0];-- return getActivityText(latest, t);- }, [activities, t]);-- if (!latestActivityText) return null;-- return (- <Flexbox horizontal align={'flex-start'} gap={4}>- <Icon- color={cssVar.colorTextQuaternary}- icon={TreeDownRightIcon}- style={{- marginTop: 2,- marginLeft: 6,- }}- />- <Text ellipsis fontSize={12} style={{ color: cssVar.colorTextDescription }}>- {latestActivityText}- </Text>- </Flexbox>- );-});--export default TaskLatestActivity;diff --git a/src/features/AgentTasks/features/index.ts b/src/features/AgentTasks/features/index.tsindex 93ce62faa85..592dc86f091 100644--- a/src/features/AgentTasks/features/index.ts+++ b/src/features/AgentTasks/features/index.ts@@ -6,7 +6,6 @@ export { default as PriorityLowIcon } from './icons/PriorityLowIcon';export { default as PriorityMediumIcon } from './icons/PriorityMediumIcon';export { default as PriorityNoneIcon } from './icons/PriorityNoneIcon';export { default as PriorityUrgentIcon } from './icons/PriorityUrgentIcon';-export { default as TaskLatestActivity } from './TaskLatestActivity';export { default as TaskListHeader } from './TaskListHeader';export { default as TaskPriorityTag } from './TaskPriorityTag';export { default as TaskStatusIcon } from './TaskStatusIcon';diff --git a/src/store/global/selectors/systemStatus.ts b/src/store/global/selectors/systemStatus.tsindex f73fddbf94f..758a3b7eb1c 100644--- a/src/store/global/selectors/systemStatus.ts+++ b/src/store/global/selectors/systemStatus.ts@@ -109,8 +109,11 @@ const taskListViewOptions = (s: GlobalState) =>subGroupBy: 'none',};+// Default the inline composer to collapsed so a populated task list keeps the+// records at the top of the fold; the empty-state hero still shows the full+// composer, and the header "+" expands it inline on demand.const taskCreateInlineCollapsed = (s: GlobalState): boolean =>- s.status.taskCreateInlineCollapsed ?? false;+ s.status.taskCreateInlineCollapsed ?? true;export const DEFAULT_KANBAN_HIDDEN_COLUMNS: string[] = ['done', 'canceled'];diff --git a/src/store/task/slices/detail/action.test.ts b/src/store/task/slices/detail/action.test.tsindex b27f0ea6f7c..7d50d14a67a 100644--- a/src/store/task/slices/detail/action.test.ts+++ b/src/store/task/slices/detail/action.test.ts@@ -94,9 +94,12 @@ describe('TaskDetailSliceAction', () => {expect(useTaskStore.getState().isCreatingTask).toBe(false);});- it('should throw on error and reset isCreatingTask', async () => {+ it('should reject and reset isCreatingTask on error (callers own the error path)', async () => {vi.mocked(taskService.create).mockRejectedValue(new Error('fail'));+ // createTask keeps its rejecting contract so callers that rely on `catch`+ // (e.g. the recommend-template flow) don't fall through to a false success;+ // the composer callers add their own catch + toast (V4).await expect(useTaskStore.getState().createTask({ instruction: 'Test' })).rejects.toThrow('fail',);