Skip to content

🤯 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.

🐛 fix(tasks): scheduler, hotkey, comment & TodoList polish (#14707)

Arvin Xu49c8d17e2ce4
diff --git a/locales/en-US/chat.json b/locales/en-US/chat.json
index 50058289d5b..ea5a00a7d7c 100644
--- a/locales/en-US/chat.json
+++ b/locales/en-US/chat.json
@@ -564,7 +564,7 @@
"taskList.breadcrumb.task": "Task",
"taskList.contextMenu.copyId": "Copy ID",
"taskList.contextMenu.copyIdSuccess": "ID copied",
- "taskList.contextMenu.copyLink": "Copy link",
+ "taskList.contextMenu.copyLink": "Copy Link",
"taskList.contextMenu.copyLinkSuccess": "Link copied",
"taskList.contextMenu.priority": "Priority",
"taskList.contextMenu.status": "Status",
@@ -631,9 +631,11 @@
"taskSchedule.startScheduling": "Start scheduling",
"taskSchedule.summary.daily": "Daily at {{time}}",
"taskSchedule.summary.disabled": "Automation is off",
- "taskSchedule.summary.everyNHours": "Every {{count}} hours{{minute}}",
+ "taskSchedule.summary.everyNHours": "Every {{count}} hours",
+ "taskSchedule.summary.everyNHoursHalfPast": "Every {{count}} hours at half past",
"taskSchedule.summary.heartbeat": "Runs every {{interval}}",
- "taskSchedule.summary.hourly": "Every hour{{minute}}",
+ "taskSchedule.summary.hourly": "Every hour",
+ "taskSchedule.summary.hourlyHalfPast": "Every hour at half past",
"taskSchedule.summary.weekly": "Every {{days}} at {{time}}",
"taskSchedule.tag.add": "Set schedule",
"taskSchedule.tag.every": "Every {{interval}}",
@@ -641,6 +643,8 @@
"taskSchedule.tag.schedule": "Schedule · {{schedule}}{{timezone}}",
"taskSchedule.time": "Time",
"taskSchedule.timezone": "Timezone",
+ "taskSchedule.timezoneSearchEmpty": "No matching timezone",
+ "taskSchedule.timezoneSearchPlaceholder": "Search timezone",
"taskSchedule.title": "Schedule",
"taskSchedule.unit.hour_one": "{{count}} hr",
"taskSchedule.unit.hour_other": "{{count}} hrs",
diff --git a/locales/zh-CN/chat.json b/locales/zh-CN/chat.json
index d949d09525f..c269fb9d996 100644
--- a/locales/zh-CN/chat.json
+++ b/locales/zh-CN/chat.json
@@ -631,9 +631,11 @@
"taskSchedule.startScheduling": "启动定时",
"taskSchedule.summary.daily": "每天 {{time}} 运行",
"taskSchedule.summary.disabled": "自动化未启用",
- "taskSchedule.summary.everyNHours": "每 {{count}} 小时{{minute}}",
+ "taskSchedule.summary.everyNHours": "每 {{count}} 小时",
+ "taskSchedule.summary.everyNHoursHalfPast": "每 {{count}} 小时的 30 分",
"taskSchedule.summary.heartbeat": "每 {{interval}} 运行一次",
- "taskSchedule.summary.hourly": "每小时{{minute}}",
+ "taskSchedule.summary.hourly": "每小时",
+ "taskSchedule.summary.hourlyHalfPast": "每小时的 30 分",
"taskSchedule.summary.weekly": "每周 {{days}} {{time}} 运行",
"taskSchedule.tag.add": "设置计划",
"taskSchedule.tag.every": "每 {{interval}}",
@@ -641,6 +643,8 @@
"taskSchedule.tag.schedule": "计划 · {{schedule}}{{timezone}}",
"taskSchedule.time": "时间",
"taskSchedule.timezone": "时区",
+ "taskSchedule.timezoneSearchEmpty": "无匹配时区",
+ "taskSchedule.timezoneSearchPlaceholder": "搜索时区",
"taskSchedule.title": "计划",
"taskSchedule.unit.hour_one": "{{count}} 小时",
"taskSchedule.unit.hour_other": "{{count}} 小时",
diff --git a/src/features/AgentTasks/AgentTaskDetail/CommentInput.tsx b/src/features/AgentTasks/AgentTaskDetail/CommentInput.tsx
index 5be449b09c8..5df28ccfd95 100644
--- a/src/features/AgentTasks/AgentTaskDetail/CommentInput.tsx
+++ b/src/features/AgentTasks/AgentTaskDetail/CommentInput.tsx
@@ -52,14 +52,14 @@ const CommentInput = memo<{ taskId: string }>(({ taskId }) => {
}}
/>
</div>
- <div
- style={{
- flexShrink: 0,
- opacity: hasContent || submitting ? 1 : 0,
- pointerEvents: hasContent || submitting ? 'auto' : 'none',
- }}
- >
- <SendButton loading={submitting} shape={'round'} type={'text'} onClick={handleSubmit} />
+ <div style={{ flexShrink: 0 }}>
+ <SendButton
+ disabled={!hasContent && !submitting}
+ loading={submitting}
+ shape={'round'}
+ type={'text'}
+ onClick={handleSubmit}
+ />
</div>
</Flexbox>
);
diff --git a/src/features/AgentTasks/AgentTaskDetail/TaskDetailHeaderActions.tsx b/src/features/AgentTasks/AgentTaskDetail/TaskDetailHeaderActions.tsx
index 5fa62967f24..0074d36fbb3 100644
--- a/src/features/AgentTasks/AgentTaskDetail/TaskDetailHeaderActions.tsx
+++ b/src/features/AgentTasks/AgentTaskDetail/TaskDetailHeaderActions.tsx
@@ -1,13 +1,4 @@
-import { KeyEnum } from '@lobechat/const/hotkeys';
-import {
- ActionIcon,
- combineKeys,
- copyToClipboard,
- type DropdownItem,
- DropdownMenu,
- Hotkey,
- Icon,
-} from '@lobehub/ui';
+import { ActionIcon, copyToClipboard, type DropdownItem, DropdownMenu, Icon } from '@lobehub/ui';
import { App } from 'antd';
import { CopyIcon, LinkIcon, MoreHorizontal, Trash } from 'lucide-react';
import { memo, useCallback, useMemo } from 'react';
@@ -69,9 +60,6 @@ const TaskDetailHeaderActions = memo(() => {
{ type: 'divider' },
{
danger: true,
- extra: (
- <Hotkey keys={combineKeys([KeyEnum.Mod, KeyEnum.Backspace])} variant={'borderless'} />
- ),
icon: <Icon icon={Trash} />,
key: 'delete',
label: t('delete', { ns: 'common' }),
diff --git a/src/features/AgentTasks/AgentTaskDetail/TaskScheduleConfig.tsx b/src/features/AgentTasks/AgentTaskDetail/TaskScheduleConfig.tsx
index 5dc928631ab..6502e01aa55 100644
--- a/src/features/AgentTasks/AgentTaskDetail/TaskScheduleConfig.tsx
+++ b/src/features/AgentTasks/AgentTaskDetail/TaskScheduleConfig.tsx
@@ -166,6 +166,7 @@ const SchedulerTab = memo<SchedulerTabProps>(({ taskId }) => {
return (
<SchedulerForm
+ key={taskId}
maxExecutions={maxExecutions}
pattern={pattern}
timezone={timezone}
diff --git a/src/features/AgentTasks/AgentTaskDetail/TopicCard.tsx b/src/features/AgentTasks/AgentTaskDetail/TopicCard.tsx
index aa45c6d1853..abb4339474d 100644
--- a/src/features/AgentTasks/AgentTaskDetail/TopicCard.tsx
+++ b/src/features/AgentTasks/AgentTaskDetail/TopicCard.tsx
@@ -79,11 +79,11 @@ const TopicCard = memo<TopicCardProps>(({ activity }) => {
defaultValue:
'The current run will be canceled. Generated messages are kept and you can re-run the task later.',
}),
- okText: t('taskDetail.topicMenu.stop', { defaultValue: 'Stop run' }),
+ okText: t('taskDetail.topicMenu.stop', { defaultValue: 'Stop Run' }),
onOk: async () => {
await cancelTopic(topicId);
},
- title: t('taskDetail.topicMenu.stopConfirm.title', { defaultValue: 'Stop run?' }),
+ title: t('taskDetail.topicMenu.stopConfirm.title', { defaultValue: 'Stop Run?' }),
});
}, [activity.id, cancelTopic, t]);
@@ -101,7 +101,7 @@ const TopicCard = memo<TopicCardProps>(({ activity }) => {
danger: true,
icon: CircleStop,
key: 'stop',
- label: t('taskDetail.topicMenu.stop', { defaultValue: 'Stop run' }),
+ label: t('taskDetail.topicMenu.stop', { defaultValue: 'Stop Run' }),
onClick: handleStop,
},
{ type: 'divider' as const },
@@ -110,21 +110,21 @@ const TopicCard = memo<TopicCardProps>(({ activity }) => {
{
icon: ExternalLink,
key: 'open',
- label: t('taskDetail.topicMenu.open', { defaultValue: 'Open run' }),
+ label: t('taskDetail.topicMenu.open', { defaultValue: 'Open Run' }),
onClick: handleOpen,
},
{
disabled: !activity.id,
icon: Copy,
key: 'copy',
- label: t('taskDetail.topicMenu.copyId', { defaultValue: 'Copy topic ID' }),
+ label: t('taskDetail.topicMenu.copyId', { defaultValue: 'Copy Topic ID' }),
onClick: handleCopyId,
},
{
disabled: !activity.operationId,
icon: Copy,
key: 'copyOperationId',
- label: t('taskDetail.topicMenu.copyOperationId', { defaultValue: 'Copy operation ID' }),
+ label: t('taskDetail.topicMenu.copyOperationId', { defaultValue: 'Copy Operation ID' }),
onClick: handleCopyOperationId,
},
];
diff --git a/src/features/AgentTasks/AgentTaskDetail/TopicChatDrawer/FeedbackInput.tsx b/src/features/AgentTasks/AgentTaskDetail/TopicChatDrawer/FeedbackInput.tsx
index 764e4856f16..5f83fef6fe9 100644
--- a/src/features/AgentTasks/AgentTaskDetail/TopicChatDrawer/FeedbackInput.tsx
+++ b/src/features/AgentTasks/AgentTaskDetail/TopicChatDrawer/FeedbackInput.tsx
@@ -74,14 +74,9 @@ const FeedbackInput = memo<FeedbackInputProps>(({ taskId, topicId }) => {
}}
/>
</div>
- <div
- style={{
- flexShrink: 0,
- opacity: hasContent || submitting ? 1 : 0,
- pointerEvents: hasContent || submitting ? 'auto' : 'none',
- }}
- >
+ <div style={{ flexShrink: 0 }}>
<SendButton
+ disabled={!hasContent && !submitting}
loading={submitting}
shape={'round'}
title={t('taskDetail.commentSubmitAndRun')}
diff --git a/src/features/AgentTasks/AgentTaskDetail/TopicChatDrawer/index.tsx b/src/features/AgentTasks/AgentTaskDetail/TopicChatDrawer/index.tsx
index d644fc41cb0..bfc18f14812 100644
--- a/src/features/AgentTasks/AgentTaskDetail/TopicChatDrawer/index.tsx
+++ b/src/features/AgentTasks/AgentTaskDetail/TopicChatDrawer/index.tsx
@@ -150,14 +150,14 @@ const TopicChatDrawer = memo(() => {
disabled: !topicId,
icon: Copy,
key: 'copyTopicId',
- label: t('taskDetail.topicMenu.copyId', { defaultValue: 'Copy topic ID' }),
+ label: t('taskDetail.topicMenu.copyId', { defaultValue: 'Copy Topic ID' }),
onClick: handleCopyTopicId,
},
{
disabled: !activity?.operationId,
icon: Copy,
key: 'copyOperationId',
- label: t('taskDetail.topicMenu.copyOperationId', { defaultValue: 'Copy operation ID' }),
+ label: t('taskDetail.topicMenu.copyOperationId', { defaultValue: 'Copy Operation ID' }),
onClick: handleCopyOperationId,
},
],
diff --git a/src/features/AgentTasks/AgentTaskDetail/scheduler/CronConfig.ts b/src/features/AgentTasks/AgentTaskDetail/scheduler/CronConfig.ts
index 0ed02c92f8e..ce5b6df4e0c 100644
--- a/src/features/AgentTasks/AgentTaskDetail/scheduler/CronConfig.ts
+++ b/src/features/AgentTasks/AgentTaskDetail/scheduler/CronConfig.ts
@@ -8,53 +8,62 @@ export const SCHEDULE_TYPE_OPTIONS = [
{ label: 'taskSchedule.scheduleType.weekly', value: 'weekly' },
] as const;
-export const TIMEZONE_OPTIONS = [
- { label: 'UTC', value: 'UTC' },
+export interface TimezoneOption {
+ label: string;
+ offset: string;
+ value: string;
+}
+
+// IANA timezone identifiers are stored in `value` (Drizzle/cron expect the
+// underscored form). `label` is the human-readable display (underscores → spaces),
+// `offset` renders subtly on the right of each dropdown row à la Notion.
+export const TIMEZONE_OPTIONS: TimezoneOption[] = [
+ { label: 'UTC', offset: 'UTC+0', value: 'UTC' },
// Americas
- { label: 'America/New_York (EST/EDT, UTC-5/-4)', value: 'America/New_York' },
- { label: 'America/Chicago (CST/CDT, UTC-6/-5)', value: 'America/Chicago' },
- { label: 'America/Denver (MST/MDT, UTC-7/-6)', value: 'America/Denver' },
- { label: 'America/Los_Angeles (PST/PDT, UTC-8/-7)', value: 'America/Los_Angeles' },
- { label: 'America/Toronto (EST/EDT, UTC-5/-4)', value: 'America/Toronto' },
- { label: 'America/Vancouver (PST/PDT, UTC-8/-7)', value: 'America/Vancouver' },
- { label: 'America/Mexico_City (CST, UTC-6)', value: 'America/Mexico_City' },
- { label: 'America/Sao_Paulo (BRT, UTC-3)', value: 'America/Sao_Paulo' },
- { label: 'America/Buenos_Aires (ART, UTC-3)', value: 'America/Buenos_Aires' },
+ { label: 'America/New York', offset: 'EST/EDT · UTC−5/−4', value: 'America/New_York' },
+ { label: 'America/Chicago', offset: 'CST/CDT · UTC−6/−5', value: 'America/Chicago' },
+ { label: 'America/Denver', offset: 'MST/MDT · UTC−7/−6', value: 'America/Denver' },
+ { label: 'America/Los Angeles', offset: 'PST/PDT · UTC−8/−7', value: 'America/Los_Angeles' },
+ { label: 'America/Toronto', offset: 'EST/EDT · UTC−5/−4', value: 'America/Toronto' },
+ { label: 'America/Vancouver', offset: 'PST/PDT · UTC−8/−7', value: 'America/Vancouver' },
+ { label: 'America/Mexico City', offset: 'CST · UTC−6', value: 'America/Mexico_City' },
+ { label: 'America/Sao Paulo', offset: 'BRT · UTC−3', value: 'America/Sao_Paulo' },
+ { label: 'America/Buenos Aires', offset: 'ART · UTC−3', value: 'America/Buenos_Aires' },
// Europe
- { label: 'Europe/London (GMT/BST, UTC+0/+1)', value: 'Europe/London' },
- { label: 'Europe/Paris (CET/CEST, UTC+1/+2)', value: 'Europe/Paris' },
- { label: 'Europe/Berlin (CET/CEST, UTC+1/+2)', value: 'Europe/Berlin' },
- { label: 'Europe/Madrid (CET/CEST, UTC+1/+2)', value: 'Europe/Madrid' },
- { label: 'Europe/Rome (CET/CEST, UTC+1/+2)', value: 'Europe/Rome' },
- { label: 'Europe/Amsterdam (CET/CEST, UTC+1/+2)', value: 'Europe/Amsterdam' },
- { label: 'Europe/Brussels (CET/CEST, UTC+1/+2)', value: 'Europe/Brussels' },
- { label: 'Europe/Moscow (MSK, UTC+3)', value: 'Europe/Moscow' },
- { label: 'Europe/Istanbul (TRT, UTC+3)', value: 'Europe/Istanbul' },
+ { label: 'Europe/London', offset: 'GMT/BST · UTC+0/+1', value: 'Europe/London' },
+ { label: 'Europe/Paris', offset: 'CET/CEST · UTC+1/+2', value: 'Europe/Paris' },
+ { label: 'Europe/Berlin', offset: 'CET/CEST · UTC+1/+2', value: 'Europe/Berlin' },
+ { label: 'Europe/Madrid', offset: 'CET/CEST · UTC+1/+2', value: 'Europe/Madrid' },
+ { label: 'Europe/Rome', offset: 'CET/CEST · UTC+1/+2', value: 'Europe/Rome' },
+ { label: 'Europe/Amsterdam', offset: 'CET/CEST · UTC+1/+2', value: 'Europe/Amsterdam' },
+ { label: 'Europe/Brussels', offset: 'CET/CEST · UTC+1/+2', value: 'Europe/Brussels' },
+ { label: 'Europe/Moscow', offset: 'MSK · UTC+3', value: 'Europe/Moscow' },
+ { label: 'Europe/Istanbul', offset: 'TRT · UTC+3', value: 'Europe/Istanbul' },
// Asia
- { label: 'Asia/Dubai (GST, UTC+4)', value: 'Asia/Dubai' },
- { label: 'Asia/Kolkata (IST, UTC+5:30)', value: 'Asia/Kolkata' },
- { label: 'Asia/Shanghai (CST, UTC+8)', value: 'Asia/Shanghai' },
- { label: 'Asia/Hong_Kong (HKT, UTC+8)', value: 'Asia/Hong_Kong' },
- { label: 'Asia/Taipei (CST, UTC+8)', value: 'Asia/Taipei' },
- { label: 'Asia/Singapore (SGT, UTC+8)', value: 'Asia/Singapore' },
- { label: 'Asia/Tokyo (JST, UTC+9)', value: 'Asia/Tokyo' },
- { label: 'Asia/Seoul (KST, UTC+9)', value: 'Asia/Seoul' },
- { label: 'Asia/Bangkok (ICT, UTC+7)', value: 'Asia/Bangkok' },
- { label: 'Asia/Jakarta (WIB, UTC+7)', value: 'Asia/Jakarta' },
+ { label: 'Asia/Dubai', offset: 'GST · UTC+4', value: 'Asia/Dubai' },
+ { label: 'Asia/Kolkata', offset: 'IST · UTC+5:30', value: 'Asia/Kolkata' },
+ { label: 'Asia/Shanghai', offset: 'CST · UTC+8', value: 'Asia/Shanghai' },
+ { label: 'Asia/Hong Kong', offset: 'HKT · UTC+8', value: 'Asia/Hong_Kong' },
+ { label: 'Asia/Taipei', offset: 'CST · UTC+8', value: 'Asia/Taipei' },
+ { label: 'Asia/Singapore', offset: 'SGT · UTC+8', value: 'Asia/Singapore' },
+ { label: 'Asia/Tokyo', offset: 'JST · UTC+9', value: 'Asia/Tokyo' },
+ { label: 'Asia/Seoul', offset: 'KST · UTC+9', value: 'Asia/Seoul' },
+ { label: 'Asia/Bangkok', offset: 'ICT · UTC+7', value: 'Asia/Bangkok' },
+ { label: 'Asia/Jakarta', offset: 'WIB · UTC+7', value: 'Asia/Jakarta' },
// Oceania
- { label: 'Australia/Sydney (AEDT/AEST, UTC+11/+10)', value: 'Australia/Sydney' },
- { label: 'Australia/Melbourne (AEDT/AEST, UTC+11/+10)', value: 'Australia/Melbourne' },
- { label: 'Australia/Brisbane (AEST, UTC+10)', value: 'Australia/Brisbane' },
- { label: 'Australia/Perth (AWST, UTC+8)', value: 'Australia/Perth' },
- { label: 'Pacific/Auckland (NZDT/NZST, UTC+13/+12)', value: 'Pacific/Auckland' },
+ { label: 'Australia/Sydney', offset: 'AEDT/AEST · UTC+11/+10', value: 'Australia/Sydney' },
+ { label: 'Australia/Melbourne', offset: 'AEDT/AEST · UTC+11/+10', value: 'Australia/Melbourne' },
+ { label: 'Australia/Brisbane', offset: 'AEST · UTC+10', value: 'Australia/Brisbane' },
+ { label: 'Australia/Perth', offset: 'AWST · UTC+8', value: 'Australia/Perth' },
+ { label: 'Pacific/Auckland', offset: 'NZDT/NZST · UTC+13/+12', value: 'Pacific/Auckland' },
// Africa & Middle East
- { label: 'Africa/Cairo (EET, UTC+2)', value: 'Africa/Cairo' },
- { label: 'Africa/Johannesburg (SAST, UTC+2)', value: 'Africa/Johannesburg' },
+ { label: 'Africa/Cairo', offset: 'EET · UTC+2', value: 'Africa/Cairo' },
+ { label: 'Africa/Johannesburg', offset: 'SAST · UTC+2', value: 'Africa/Johannesburg' },
];
export const WEEKDAYS = [
diff --git a/src/features/AgentTasks/AgentTaskDetail/scheduler/SchedulerForm.tsx b/src/features/AgentTasks/AgentTaskDetail/scheduler/SchedulerForm.tsx
index 9e4d14595b4..ccd63c3f26f 100644
--- a/src/features/AgentTasks/AgentTaskDetail/scheduler/SchedulerForm.tsx
+++ b/src/features/AgentTasks/AgentTaskDetail/scheduler/SchedulerForm.tsx
@@ -5,13 +5,14 @@ import {
Flexbox,
Icon,
InputNumber,
+ SearchBar,
Select,
Text,
} from '@lobehub/ui';
import { createStaticStyles, cssVar, cx } from 'antd-style';
import dayjs, { type Dayjs } from 'dayjs';
import { Globe, Hash, SlidersHorizontal } from 'lucide-react';
-import { memo, useCallback, useEffect, useMemo, useState } from 'react';
+import { memo, useCallback, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
import {
@@ -28,6 +29,33 @@ const styles = createStaticStyles(({ css, cssVar }) => ({
font-size: 12px;
color: ${cssVar.colorTextSecondary};
`,
+ timezoneEmpty: css`
+ padding-block: 12px;
+ padding-inline: 12px;
+
+ font-size: 13px;
+ color: ${cssVar.colorTextDescription};
+ text-align: center;
+ `,
+ timezoneOffset: css`
+ flex-shrink: 0;
+ margin-inline-start: 12px;
+ font-size: 12px;
+ color: ${cssVar.colorTextDescription};
+ `,
+ timezoneOption: css`
+ display: flex;
+ gap: 12px;
+ align-items: center;
+ justify-content: space-between;
+
+ min-width: 0;
+ `,
+ timezoneSearch: css`
+ padding-block: 8px 4px;
+ padding-inline: 8px;
+ border-block-end: 1px solid ${cssVar.colorSplit};
+ `,
weekdayButton: css`
cursor: pointer;
@@ -43,13 +71,13 @@ const styles = createStaticStyles(({ css, cssVar }) => ({
font-weight: 500;
color: ${cssVar.colorTextSecondary};
- background: ${cssVar.colorFillTertiary};
+ background: transparent;
transition: all 0.15s ease;
&:hover {
color: ${cssVar.colorText};
- background: ${cssVar.colorFillSecondary};
+ background: ${cssVar.colorFillTertiary};
}
`,
weekdayButtonActive: css`
@@ -98,13 +126,18 @@ interface SchedulerFormProps {
const SchedulerForm = memo<SchedulerFormProps>(({ maxExecutions, onChange, pattern, timezone }) => {
const { t } = useTranslation('chat');
- const initial = useMemo(() => {
+ // Optimistic local state: seed once from props at mount, then own the values
+ // locally. Don't re-sync from props on every change — otherwise the async
+ // server roundtrip (updateSchedule → refreshTaskDetail) bounces stale prop
+ // values back into the form during rapid edits and clobbers the user input.
+ // Parent should `key={taskId}` this component to remount cleanly across tasks.
+ const [initial] = useState(() => {
const parsed = parseCronPattern(pattern || DEFAULT_PATTERN);
return {
...parsed,
triggerTime: dayjs().hour(parsed.triggerHour).minute(parsed.triggerMinute),
};
- }, [pattern]);
+ });
const [scheduleType, setScheduleType] = useState<ScheduleType>(initial.scheduleType);
const [triggerTime, setTriggerTime] = useState<Dayjs>(initial.triggerTime);
@@ -114,21 +147,21 @@ const SchedulerForm = memo<SchedulerFormProps>(({ maxExecutions, onChange, patte
);
const [tz, setTz] = useState<string>(timezone || DEFAULT_TIMEZONE);
const [maxExec, setMaxExec] = useState<number | null>(maxExecutions ?? null);
-
- useEffect(() => {
- setScheduleType(initial.scheduleType);
- setTriggerTime(initial.triggerTime);
- setHourlyInterval(initial.hourlyInterval ?? 1);
- setWeekdays(initial.weekdays ?? (initial.scheduleType === 'weekly' ? [1, 2, 3, 4, 5] : []));
- }, [initial]);
-
- useEffect(() => {
- setTz(timezone || DEFAULT_TIMEZONE);
- }, [timezone]);
-
- useEffect(() => {
- setMaxExec(maxExecutions ?? null);
- }, [maxExecutions]);
+ const [continuous, setContinuous] = useState<boolean>(
+ maxExecutions === null || maxExecutions === undefined,
+ );
+ const [tzSearch, setTzSearch] = useState('');
+
+ const filteredTimezoneOptions = useMemo(() => {
+ const q = tzSearch.trim().toLowerCase();
+ if (!q) return TIMEZONE_OPTIONS;
+ return TIMEZONE_OPTIONS.filter(
+ (opt) =>
+ opt.label.toLowerCase().includes(q) ||
+ opt.value.toLowerCase().includes(q) ||
+ opt.offset.toLowerCase().includes(q),
+ );
+ }, [tzSearch]);
const emit = useCallback(
(
@@ -141,9 +174,14 @@ const SchedulerForm = memo<SchedulerFormProps>(({ maxExecutions, onChange, patte
weekdays: number[];
}>,
) => {
+ // When the user is mid-editing maxExec (cleared the input but hasn't
+ // typed yet), local maxExec is null but `continuous` is still false.
+ // Falling back to the persisted prop here avoids emitting null for an
+ // unrelated field change — which would otherwise flip Continuous on.
+ const fallbackMaxExec = continuous ? null : (maxExec ?? maxExecutions ?? null);
const next = {
hourlyInterval: overrides.hourlyInterval ?? hourlyInterval,
- maxExec: overrides.maxExec === undefined ? maxExec : overrides.maxExec,
+ maxExec: overrides.maxExec === undefined ? fallbackMaxExec : overrides.maxExec,
scheduleType: overrides.scheduleType ?? scheduleType,
triggerTime: overrides.triggerTime ?? triggerTime,
tz: overrides.tz ?? tz,
@@ -157,7 +195,17 @@ const SchedulerForm = memo<SchedulerFormProps>(({ maxExecutions, onChange, patte
);
onChange({ maxExecutions: next.maxExec, pattern: nextPattern, timezone: next.tz });
},
- [hourlyInterval, maxExec, onChange, scheduleType, triggerTime, tz, weekdays],
+ [
+ continuous,
+ hourlyInterval,
+ maxExec,
+ maxExecutions,
+ onChange,
+ scheduleType,
+ triggerTime,
+ tz,
+ weekdays,
+ ],
);
const handleScheduleTypeChange = (value: ScheduleType) => {
@@ -199,19 +247,27 @@ const SchedulerForm = memo<SchedulerFormProps>(({ maxExecutions, onChange, patte
};
const handleMaxExecChange = (value: number | string | null) => {
- const next = typeof value === 'number' && value > 0 ? value : null;
- setMaxExec(next);
- emit({ maxExec: next });
+ if (typeof value === 'number' && value > 0) {
+ setMaxExec(value);
+ emit({ maxExec: value });
+ return;
+ }
+ // Mid-edit clear (e.g. user is replacing 100 with 5): keep the field
+ // empty locally but don't toggle Continuous or emit a null upstream.
+ setMaxExec(null);
};
const handleContinuousChange = (checked: boolean) => {
- const next = checked ? null : 100;
- setMaxExec(next);
- emit({ maxExec: next });
+ setContinuous(checked);
+ if (checked) {
+ emit({ maxExec: null });
+ } else {
+ const next = maxExec ?? 100;
+ setMaxExec(next);
+ emit({ maxExec: next });
+ }
};
- const isUnlimited = maxExec === null || maxExec === undefined;
-
const showTimeRow = scheduleType !== 'hourly';
return (
@@ -293,7 +349,7 @@ const SchedulerForm = memo<SchedulerFormProps>(({ maxExecutions, onChange, patte
</Flexbox>
)}
- <Accordion gap={0}>
+ <Accordion defaultExpandedKeys={[]} gap={0}>
<AccordionItem
itemKey="advanced"
paddingBlock={6}
@@ -314,13 +370,48 @@ const SchedulerForm = memo<SchedulerFormProps>(({ maxExecutions, onChange, patte
<Text className={styles.fieldLabel}>{t('taskSchedule.timezone')}</Text>
</Flexbox>
<Select
- showSearch
getPopupContainer={getPopupContainer}
- options={TIMEZONE_OPTIONS}
+ options={filteredTimezoneOptions}
popupMatchSelectWidth={false}
value={tz}
variant="filled"
+ dropdownRender={(originNode) => (
+ <Flexbox>
+ <div className={styles.timezoneSearch}>
+ <SearchBar
+ allowClear
+ autoFocus
+ placeholder={t('taskSchedule.timezoneSearchPlaceholder')}
+ size="small"
+ value={tzSearch}
+ variant="filled"
+ onChange={(e) => setTzSearch(e.target.value)}
+ // Keep arrow keys / typing local to the search input;
+ // antd Select otherwise tries to consume them for option nav.
+ onKeyDown={(e) => e.stopPropagation()}
+ />
+ </div>
+ {filteredTimezoneOptions.length === 0 ? (
+ <div className={styles.timezoneEmpty}>
+ {t('taskSchedule.timezoneSearchEmpty')}
+ </div>
+ ) : (
+ originNode
+ )}
+ </Flexbox>
+ )}
+ optionRender={({ data }) => (
+ <div className={styles.timezoneOption}>
+ <span style={{ overflow: 'hidden', textOverflow: 'ellipsis' }}>
+ {data.label}
+ </span>
+ <span className={styles.timezoneOffset}>{data.offset}</span>
+ </div>
+ )}
onChange={handleTimezoneChange}
+ onDropdownVisibleChange={(open) => {
+ if (!open) setTzSearch('');
+ }}
/>
</Flexbox>
@@ -331,7 +422,7 @@ const SchedulerForm = memo<SchedulerFormProps>(({ maxExecutions, onChange, patte
</Flexbox>
<Flexbox horizontal align="center" gap={12}>
<InputNumber
- disabled={isUnlimited}
+ disabled={continuous}
min={1}
placeholder={t('taskSchedule.maxExecutionsPlaceholder')}
style={{ flex: 1 }}
@@ -339,7 +430,7 @@ const SchedulerForm = memo<SchedulerFormProps>(({ maxExecutions, onChange, patte
variant="filled"
onChange={handleMaxExecChange}
/>
- <Checkbox checked={isUnlimited} onChange={handleContinuousChange}>
+ <Checkbox checked={continuous} onChange={handleContinuousChange}>
{t('taskSchedule.continuous')}
</Checkbox>
</Flexbox>
diff --git a/src/features/AgentTasks/AgentTaskDetail/scheduler/helpers.ts b/src/features/AgentTasks/AgentTaskDetail/scheduler/helpers.ts
index ac0555d2f32..8e97869372d 100644
--- a/src/features/AgentTasks/AgentTaskDetail/scheduler/helpers.ts
+++ b/src/features/AgentTasks/AgentTaskDetail/scheduler/helpers.ts
@@ -47,10 +47,18 @@ export const formatScheduleDescription = (pattern: string, t: TFunction<'chat'>)
switch (parsed.scheduleType) {
case 'hourly': {
const interval = parsed.hourlyInterval ?? 1;
- const minute = `:${padTime(parsed.triggerMinute)}`;
- return interval === 1
- ? t('taskSchedule.summary.hourly', { minute })
- : t('taskSchedule.summary.everyNHours', { count: interval, minute });
+ // Cron storage rounds minutes to 0 or 30 (see buildCronPattern). Reading
+ // ':30' literally felt awkward in the summary, so call it out as
+ // "half past" only when it's actually non-zero and stay implicit on :00.
+ const isHalfPast = parsed.triggerMinute === 30;
+ if (interval === 1) {
+ return isHalfPast
+ ? t('taskSchedule.summary.hourlyHalfPast')
+ : t('taskSchedule.summary.hourly');
+ }
+ return isHalfPast
+ ? t('taskSchedule.summary.everyNHoursHalfPast', { count: interval })
+ : t('taskSchedule.summary.everyNHours', { count: interval });
}
case 'daily': {
return t('taskSchedule.summary.daily', {
diff --git a/src/features/AgentTasks/features/TaskPriorityTag.tsx b/src/features/AgentTasks/features/TaskPriorityTag.tsx
index 11109b81bfa..6787ae0d025 100644
--- a/src/features/AgentTasks/features/TaskPriorityTag.tsx
+++ b/src/features/AgentTasks/features/TaskPriorityTag.tsx
@@ -4,7 +4,7 @@ import { Dropdown, type MenuProps } from 'antd';
import { createStaticStyles, cssVar } from 'antd-style';
import { Loader2Icon } from 'lucide-react';
import type { ReactNode } from 'react';
-import { memo, useCallback, useMemo, useState } from 'react';
+import { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useTaskStore } from '@/store/task';
@@ -31,6 +31,8 @@ export const PRIORITY_META: Record<number, PriorityMeta> = {
4: { icon: PriorityLowIcon, label: 'Low', labelKey: 'priority.low', level: 4 },
};
+const PRIORITY_LEVELS = [0, 1, 2, 3, 4];
+
const styles = createStaticStyles(({ css, cssVar }) => ({
trigger: css`
cursor: pointer;
@@ -66,6 +68,7 @@ interface TaskPriorityTagProps {
const TaskPriorityTag = memo<TaskPriorityTagProps>(
({ children, disableDropdown, onChange, size = 16, priority, taskIdentifier }) => {
const [loading, setLoading] = useState(false);
+ const [open, setOpen] = useState(false);
const { t } = useTranslation('chat');
const updateTask = useTaskStore((s) => s.updateTask);
const refreshTaskList = useTaskStore((s) => s.refreshTaskList);
@@ -89,6 +92,25 @@ const TaskPriorityTag = memo<TaskPriorityTagProps>(
[currentLevel, onChange, refreshTaskList, taskIdentifier, updateTask],
);
+ const handlePriorityChangeRef = useRef(handlePriorityChange);
+ handlePriorityChangeRef.current = handlePriorityChange;
+
+ useEffect(() => {
+ if (!open) return;
+ const onKeyDown = (event: KeyboardEvent) => {
+ const num = Number.parseInt(event.key, 10);
+ if (Number.isNaN(num)) return;
+ const idx = num - 1;
+ if (idx < 0 || idx >= PRIORITY_LEVELS.length) return;
+ event.preventDefault();
+ event.stopPropagation();
+ void handlePriorityChangeRef.current(PRIORITY_LEVELS[idx]);
+ setOpen(false);
+ };
+ document.addEventListener('keydown', onKeyDown, true);
+ return () => document.removeEventListener('keydown', onKeyDown, true);
+ }, [open]);
+
const menuItems = useMemo<MenuProps['items']>(
() =>
Object.entries(PRIORITY_META).map(([key, value], index) => {
@@ -137,11 +159,13 @@ const TaskPriorityTag = memo<TaskPriorityTagProps>(
return (
<Dropdown
+ open={open}
trigger={['click']}
menu={{
items: menuItems,
selectedKeys: [String(currentLevel)],
}}
+ onOpenChange={setOpen}
>
{triggerNode}
</Dropdown>
diff --git a/src/features/AgentTasks/features/TaskStatusTag.tsx b/src/features/AgentTasks/features/TaskStatusTag.tsx
index 6b05684b3b1..0a712529938 100644
--- a/src/features/AgentTasks/features/TaskStatusTag.tsx
+++ b/src/features/AgentTasks/features/TaskStatusTag.tsx
@@ -14,7 +14,7 @@ import {
Loader2Icon,
} from 'lucide-react';
import type { ReactNode } from 'react';
-import { memo, useCallback, useMemo, useState } from 'react';
+import { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useTaskStore } from '@/store/task';
@@ -105,6 +105,7 @@ interface TaskStatusTagProps {
const TaskStatusTag = memo<TaskStatusTagProps>(
({ children, disableDropdown, onChange, size = 16, status, taskIdentifier }) => {
const [loading, setLoading] = useState(false);
+ const [open, setOpen] = useState(false);
const { t } = useTranslation('chat');
const updateTaskStatus = useTaskStore((s) => s.updateTaskStatus);
@@ -130,6 +131,25 @@ const TaskStatusTag = memo<TaskStatusTagProps>(
[displayStatus, onChange, taskIdentifier, updateTaskStatus],
);
+ const handleStatusChangeRef = useRef(handleStatusChange);
+ handleStatusChangeRef.current = handleStatusChange;
+
+ useEffect(() => {
+ if (!open) return;
+ const onKeyDown = (event: KeyboardEvent) => {
+ const num = Number.parseInt(event.key, 10);
+ if (Number.isNaN(num)) return;
+ const idx = num - 1;
+ if (idx < 0 || idx >= USER_SELECTABLE_STATUSES.length) return;
+ event.preventDefault();
+ event.stopPropagation();
+ void handleStatusChangeRef.current(USER_SELECTABLE_STATUSES[idx]);
+ setOpen(false);
+ };
+ document.addEventListener('keydown', onKeyDown, true);
+ return () => document.removeEventListener('keydown', onKeyDown, true);
+ }, [open]);
+
const menuItems = useMemo<MenuProps['items']>(
() =>
USER_SELECTABLE_STATUSES.map((key, index) => {
@@ -165,11 +185,13 @@ const TaskStatusTag = memo<TaskStatusTagProps>(
return (
<Dropdown
+ open={open}
trigger={['click']}
menu={{
items: menuItems,
selectedKeys: [displayStatus],
}}
+ onOpenChange={setOpen}
>
{triggerNode}
</Dropdown>
diff --git a/src/features/AgentTasks/features/useTaskItemContextMenu.tsx b/src/features/AgentTasks/features/useTaskItemContextMenu.tsx
index 678dd6a93f5..6cc20863f5f 100644
--- a/src/features/AgentTasks/features/useTaskItemContextMenu.tsx
+++ b/src/features/AgentTasks/features/useTaskItemContextMenu.tsx
@@ -1,13 +1,5 @@
-import { KeyEnum } from '@lobechat/const/hotkeys';
import type { TaskStatus } from '@lobechat/types';
-import {
- closeContextMenu,
- combineKeys,
- copyToClipboard,
- type GenericItemType,
- Hotkey,
- Icon,
-} from '@lobehub/ui';
+import { closeContextMenu, copyToClipboard, type GenericItemType, Icon } from '@lobehub/ui';
import { App } from 'antd';
import { cssVar } from 'antd-style';
import { BarChart3Icon, CircleDashedIcon, CopyIcon, LinkIcon, Trash2Icon } from 'lucide-react';
@@ -22,6 +14,7 @@ import { PRIORITY_META } from './TaskPriorityTag';
import { STATUS_META, USER_SELECTABLE_STATUSES } from './TaskStatusTag';
const PRIORITY_LEVELS = [0, 1, 2, 3, 4];
+const SUBMENU_MARKER = 'data-task-submenu';
interface TaskItemContextMenu {
items: GenericItemType[];
@@ -50,7 +43,6 @@ export const useTaskContextMenuActions = (): TaskContextMenuActions => {
const deleteTask = useTaskStore((s) => s.deleteTask);
const cleanupRef = useRef<(() => void) | null>(null);
- const activeSubmenuRef = useRef<'status' | 'priority'>('status');
useEffect(() => () => cleanupRef.current?.(), []);
@@ -115,21 +107,15 @@ export const useTaskContextMenuActions = (): TaskContextMenuActions => {
return [
{
children: statusChildren,
- icon: <Icon icon={CircleDashedIcon} />,
+ icon: <Icon {...{ [SUBMENU_MARKER]: 'status' }} icon={CircleDashedIcon} />,
key: 'status',
label: t('taskList.contextMenu.status'),
- onTitleMouseEnter: () => {
- activeSubmenuRef.current = 'status';
- },
},
{
children: priorityChildren,
- icon: <Icon icon={BarChart3Icon} />,
+ icon: <Icon {...{ [SUBMENU_MARKER]: 'priority' }} icon={BarChart3Icon} />,
key: 'priority',
label: t('taskList.contextMenu.priority'),
- onTitleMouseEnter: () => {
- activeSubmenuRef.current = 'priority';
- },
},
{ type: 'divider' },
{
@@ -155,9 +141,6 @@ export const useTaskContextMenuActions = (): TaskContextMenuActions => {
{ type: 'divider' },
{
danger: true,
- extra: (
- <Hotkey keys={combineKeys([KeyEnum.Mod, KeyEnum.Backspace])} variant={'borderless'} />
- ),
icon: <Icon icon={Trash2Icon} />,
key: 'delete',
label: t('delete', { ns: 'common' }),
@@ -171,7 +154,6 @@ export const useTaskContextMenuActions = (): TaskContextMenuActions => {
const installKeyboardHandlers = (task: TaskContextMenuTarget) => {
cleanupRef.current?.();
- activeSubmenuRef.current = 'status';
const currentStatus = task.status as TaskStatus;
const currentPriority = task.priority ?? 0;
@@ -189,21 +171,21 @@ export const useTaskContextMenuActions = (): TaskContextMenuActions => {
return;
}
- if ((event.metaKey || event.ctrlKey) && event.key === 'Backspace') {
- event.preventDefault();
- event.stopPropagation();
- closeContextMenu();
- cleanup();
- triggerDelete(task.identifier);
- return;
- }
-
const num = Number.parseInt(event.key, 10);
if (Number.isNaN(num)) return;
const idx = num - 1;
- // Route 1–N to whichever submenu is currently focused (hover defaults to status).
- if (activeSubmenuRef.current === 'priority') {
+ // Route 1–N to whichever submenu is currently open. The base-ui
+ // SubmenuTrigger sets `data-popup-open` on the trigger button while its
+ // submenu is open, and we tag each submenu's icon with `data-task-submenu`
+ // so we can identify which one was opened.
+ const openMarker = document.querySelector<HTMLElement>(
+ `[data-popup-open] [${SUBMENU_MARKER}]`,
+ );
+ const openSubmenu = openMarker?.getAttribute(SUBMENU_MARKER);
+ if (!openSubmenu) return;
+
+ if (openSubmenu === 'priority') {
if (idx < 0 || idx >= PRIORITY_LEVELS.length) return;
event.preventDefault();
event.stopPropagation();
@@ -219,15 +201,17 @@ export const useTaskContextMenuActions = (): TaskContextMenuActions => {
return;
}
- if (idx < 0 || idx >= USER_SELECTABLE_STATUSES.length) return;
- event.preventDefault();
- event.stopPropagation();
- const nextStatus = USER_SELECTABLE_STATUSES[idx];
- if (nextStatus !== currentStatus) {
- void updateTaskStatus(task.identifier, nextStatus);
+ if (openSubmenu === 'status') {
+ if (idx < 0 || idx >= USER_SELECTABLE_STATUSES.length) return;
+ event.preventDefault();
+ event.stopPropagation();
+ const nextStatus = USER_SELECTABLE_STATUSES[idx];
+ if (nextStatus !== currentStatus) {
+ void updateTaskStatus(task.identifier, nextStatus);
+ }
+ closeContextMenu();
+ cleanup();
}
- closeContextMenu();
- cleanup();
};
const pointerHandler = () => {
diff --git a/src/features/Portal/Document/TodoList.tsx b/src/features/Portal/Document/TodoList.tsx
index 7836aaeaa2d..b95c5b39ce7 100644
--- a/src/features/Portal/Document/TodoList.tsx
+++ b/src/features/Portal/Document/TodoList.tsx
@@ -23,6 +23,7 @@ interface TodoState {
const styles = createStaticStyles(({ css, cssVar }) => ({
collapsed: css`
+ overflow-y: hidden;
max-height: 0;
padding-block: 0 !important;
opacity: 0;
@@ -50,6 +51,7 @@ const styles = createStaticStyles(({ css, cssVar }) => ({
color: ${cssVar.colorTextSecondary};
`,
expanded: css`
+ overflow-y: auto;
max-height: 300px;
opacity: 1;
`,
@@ -73,7 +75,7 @@ const styles = createStaticStyles(({ css, cssVar }) => ({
}
`,
listContainer: css`
- overflow: hidden;
+ overflow-x: hidden;
margin-block-start: 8px;
padding-block: 4px;
diff --git a/src/locales/default/chat.ts b/src/locales/default/chat.ts
index 9afad6392d9..eb4e2963a16 100644
--- a/src/locales/default/chat.ts
+++ b/src/locales/default/chat.ts
@@ -538,9 +538,11 @@ export default {
'taskSchedule.startScheduling': 'Start scheduling',
'taskSchedule.summary.daily': 'Daily at {{time}}',
'taskSchedule.summary.disabled': 'Automation is off',
- 'taskSchedule.summary.everyNHours': 'Every {{count}} hours{{minute}}',
+ 'taskSchedule.summary.everyNHours': 'Every {{count}} hours',
+ 'taskSchedule.summary.everyNHoursHalfPast': 'Every {{count}} hours at half past',
'taskSchedule.summary.heartbeat': 'Runs every {{interval}}',
- 'taskSchedule.summary.hourly': 'Every hour{{minute}}',
+ 'taskSchedule.summary.hourly': 'Every hour',
+ 'taskSchedule.summary.hourlyHalfPast': 'Every hour at half past',
'taskSchedule.summary.weekly': 'Every {{days}} at {{time}}',
'taskSchedule.tag.add': 'Set schedule',
'taskSchedule.tag.every': 'Every {{interval}}',
@@ -548,6 +550,8 @@ export default {
'taskSchedule.tag.schedule': 'Schedule · {{schedule}}{{timezone}}',
'taskSchedule.time': 'Time',
'taskSchedule.timezone': 'Timezone',
+ 'taskSchedule.timezoneSearchEmpty': 'No matching timezone',
+ 'taskSchedule.timezoneSearchPlaceholder': 'Search timezone',
'taskSchedule.title': 'Schedule',
'taskSchedule.unit.hour_one': '{{count}} hr',
'taskSchedule.unit.hour_other': '{{count}} hrs',
@@ -693,7 +697,7 @@ export default {
'taskList.assigneeSearch.placeholder': 'Search agent...',
'taskList.contextMenu.copyId': 'Copy ID',
'taskList.contextMenu.copyIdSuccess': 'ID copied',
- 'taskList.contextMenu.copyLink': 'Copy link',
+ 'taskList.contextMenu.copyLink': 'Copy Link',
'taskList.contextMenu.copyLinkSuccess': 'Link copied',
'taskList.contextMenu.priority': 'Priority',
'taskList.contextMenu.status': 'Status',
diff --git a/src/routes/(main)/agent/_layout/Sidebar/Topic/List/Item/index.test.tsx b/src/routes/(main)/agent/_layout/Sidebar/Topic/List/Item/index.test.tsx
index 87872ac719b..7429a881bac 100644
--- a/src/routes/(main)/agent/_layout/Sidebar/Topic/List/Item/index.test.tsx
+++ b/src/routes/(main)/agent/_layout/Sidebar/Topic/List/Item/index.test.tsx
@@ -77,8 +77,11 @@ vi.mock('@/routes/(main)/agent/channel/const', () => ({
getPlatformIcon: () => null,
}));
vi.mock('@/store/agent', () => ({
- useAgentStore: (selector: (state: { activeAgentId: string }) => unknown) =>
- selector({ activeAgentId: 'agt_test' }),
+ // `agentMap` is read by `agentSelectors.isCurrentAgentHeterogeneous` →
+ // `currentAgentConfig`, which would otherwise throw on `undefined.agentMap`.
+ useAgentStore: (
+ selector: (state: { activeAgentId: string; agentMap: Record<string, unknown> }) => unknown,
+ ) => selector({ activeAgentId: 'agt_test', agentMap: {} }),
}));
vi.mock('@/store/chat', () => ({
useChatStore: (
diff --git a/src/routes/(main)/agent/_layout/Sidebar/Topic/List/Item/index.tsx b/src/routes/(main)/agent/_layout/Sidebar/Topic/List/Item/index.tsx
index 656d92f1074..f3eae86c286 100644
--- a/src/routes/(main)/agent/_layout/Sidebar/Topic/List/Item/index.tsx
+++ b/src/routes/(main)/agent/_layout/Sidebar/Topic/List/Item/index.tsx
@@ -13,6 +13,7 @@ import { pluginRegistry } from '@/features/Electron/titlebar/RecentlyViewed/plug
import NavItem from '@/features/NavPanel/components/NavItem';
import { getPlatformIcon } from '@/routes/(main)/agent/channel/const';
import { useAgentStore } from '@/store/agent';
+import { agentSelectors } from '@/store/agent/selectors';
import { useChatStore } from '@/store/chat';
import { operationSelectors } from '@/store/chat/selectors';
import { useElectronStore } from '@/store/electron';
@@ -97,6 +98,9 @@ const TopicItem = memo<TopicItemProps>(({ id, title, fav, active, threadId, meta
const { t } = useTranslation('topic');
const { isDarkMode } = useTheme();
const activeAgentId = useAgentStore((s) => s.activeAgentId);
+ // Heterogeneous agents (Claude Code, Codex, …) don't have the chat-style
+ // topic semantics, so skip the default `#` placeholder icon for their rows.
+ const isHeterogeneousAgent = useAgentStore(agentSelectors.isCurrentAgentHeterogeneous);
const addTab = useElectronStore((s) => s.addTab);
const loadingRingColor = isDarkMode
@@ -255,6 +259,7 @@ const TopicItem = memo<TopicItemProps>(({ id, title, fav, active, threadId, meta
return <ProviderIcon color={cssVar.colorTextDescription} size={16} />;
}
}
+ if (isHeterogeneousAgent) return null;
return (
<Icon icon={HashIcon} size={'small'} style={{ color: cssVar.colorTextDescription }} />
);
diff --git a/src/server/services/agentSignal/services/maintenance/__tests__/serverRuntime.test.ts b/src/server/services/agentSignal/services/maintenance/__tests__/serverRuntime.test.ts
index 1721695301f..20465295efb 100644
--- a/src/server/services/agentSignal/services/maintenance/__tests__/serverRuntime.test.ts
+++ b/src/server/services/agentSignal/services/maintenance/__tests__/serverRuntime.test.ts
@@ -284,6 +284,7 @@ describe('listServerProposalActivity', () => {
baseBrief({ id: 'active', metadata: proposalMetadata() }),
],
},
+ now: '2026-05-09T01:00:00.000Z',
userId: 'user-1',
});
@@ -447,6 +448,7 @@ describe('listServerProposalActivity', () => {
}),
],
},
+ now: '2026-05-09T01:00:00.000Z',
userId: 'user-1',
});
diff --git a/src/store/task/slices/config/action.ts b/src/store/task/slices/config/action.ts
index b7e0172264e..922136f7870 100644
--- a/src/store/task/slices/config/action.ts
+++ b/src/store/task/slices/config/action.ts
@@ -26,6 +26,11 @@ export const createTaskConfigSlice = (set: Setter, get: () => TaskStore, _api?:
export class TaskConfigSliceActionImpl {
readonly #get: () => TaskStore;
readonly #set: Setter;
+ // Counts in-flight writes per task so we can coalesce the post-write
+ // `internal_refreshTaskDetail` into a single fetch after the last response.
+ // Without this, rapid edits trigger overlapping refreshes that surface stale
+ // intermediate server state to readers like TaskTriggerTag / summary text.
+ readonly #pendingWrites = new Map<string, number>();
constructor(set: Setter, get: () => TaskStore, _api?: unknown) {
void _api;
@@ -33,6 +38,24 @@ export class TaskConfigSliceActionImpl {
this.#get = get;
}
+ // Run a write; refresh task detail only after the LAST concurrent write for
+ // this task settles. Optimistic dispatches by the caller should already have
+ // updated the store before invoking this, so the UI stays steady.
+ async #withCoalescedRefresh(id: string, write: () => Promise<void>): Promise<void> {
+ this.#pendingWrites.set(id, (this.#pendingWrites.get(id) ?? 0) + 1);
+ try {
+ await write();
+ } finally {
+ const remaining = (this.#pendingWrites.get(id) ?? 1) - 1;
+ if (remaining <= 0) {
+ this.#pendingWrites.delete(id);
+ await this.#get().internal_refreshTaskDetail(id);
+ } else {
+ this.#pendingWrites.set(id, remaining);
+ }
+ }
+ }
+
markBriefRead = async (briefId: string): Promise<void> => {
await taskService.markBriefRead(briefId);
const { activeTaskId, internal_refreshTaskDetail } = this.#get();
@@ -159,13 +182,13 @@ export class TaskConfigSliceActionImpl {
value: { automationMode: mode },
});
- try {
- await taskService.update(id, update);
- await this.#get().internal_refreshTaskDetail(id);
- } catch (error) {
- console.error('[TaskStore] Failed to update automation mode:', error);
- await this.#get().internal_refreshTaskDetail(id);
- }
+ await this.#withCoalescedRefresh(id, async () => {
+ try {
+ await taskService.update(id, update);
+ } catch (error) {
+ console.error('[TaskStore] Failed to update automation mode:', error);
+ }
+ });
};
// Configure schedule mode: cron pattern + IANA timezone are columns; maxExecutions
@@ -179,21 +202,40 @@ export class TaskConfigSliceActionImpl {
(this.#get().taskDetailMap[id]?.config as Record<string, unknown> | undefined) ?? {};
const existingScheduleConfig =
(existingConfig.schedule as Record<string, unknown> | undefined) ?? {};
-
- try {
- await taskService.update(id, {
- config: {
- ...existingConfig,
- schedule: { ...existingScheduleConfig, maxExecutions: schedule.maxExecutions },
+ const nextConfig = {
+ ...existingConfig,
+ schedule: { ...existingScheduleConfig, maxExecutions: schedule.maxExecutions },
+ };
+
+ // Optimistic dispatch so TaskTriggerTag / summary text reflect the change
+ // immediately, without waiting for the server roundtrip. `taskService.update`
+ // wants the flat DB shape (`schedulePattern` / `scheduleTimezone` columns +
+ // `config.schedule.maxExecutions` JSONB), but the store reads from the
+ // normalized nested `schedule` object — populate both for the in-memory copy.
+ this.#get().internal_dispatchTaskDetail({
+ id,
+ type: 'updateTaskDetail',
+ value: {
+ config: nextConfig,
+ schedule: {
+ maxExecutions: schedule.maxExecutions,
+ pattern: schedule.pattern,
+ timezone: schedule.timezone,
},
- schedulePattern: schedule.pattern,
- scheduleTimezone: schedule.timezone,
- });
- await this.#get().internal_refreshTaskDetail(id);
- } catch (error) {
- console.error('[TaskStore] Failed to update schedule:', error);
- await this.#get().internal_refreshTaskDetail(id);
- }
+ },
+ });
+
+ await this.#withCoalescedRefresh(id, async () => {
+ try {
+ await taskService.update(id, {
+ config: nextConfig,
+ schedulePattern: schedule.pattern,
+ scheduleTimezone: schedule.timezone,
+ });
+ } catch (error) {
+ console.error('[TaskStore] Failed to update schedule:', error);
+ }
+ });
};
}