Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(scheduler): keep save failure guidance visible in long forms
Chrisd38049c57e2a
diff --git a/apps/desktop/src/renderer/features/scheduler/components/ScheduleFormDialog.tsx b/apps/desktop/src/renderer/features/scheduler/components/ScheduleFormDialog.tsxindex 6deb249d91..fd1a4dede2 100644--- a/apps/desktop/src/renderer/features/scheduler/components/ScheduleFormDialog.tsx+++ b/apps/desktop/src/renderer/features/scheduler/components/ScheduleFormDialog.tsx@@ -165,8 +165,12 @@ export function ScheduleFormDialog({const showSubmitError = (error: unknown) => {const message = error instanceof Error ? error.message : String(error);const code = parseAgentErrorCode(message)?.code;- if (code && i18n.exists(`chat.remoteError.${code}`)) setSubmitError(message);- else toast.error(message);+ if (code && i18n.exists(`chat.remoteError.${code}`)) {+ setSubmitError(message);+ // Save may be below the notice in a scrolled form. The shared alert toast+ // stays visible above the dialog and announces the localized failure.+ toast.error(t(`chat.remoteError.${code}`));+ } else toast.error(message);};const [mode, setMode] = useState<'gallery' | 'form'>('form');// 前置检查「测试运行」状态:结果只在弹窗内展示,不落任何记录。diff --git a/apps/desktop/src/renderer/features/scheduler/components/__tests__/ScheduleFormDialog.test.tsx b/apps/desktop/src/renderer/features/scheduler/components/__tests__/ScheduleFormDialog.test.tsxindex bf424b74c6..754e0de720 100644--- a/apps/desktop/src/renderer/features/scheduler/components/__tests__/ScheduleFormDialog.test.tsx+++ b/apps/desktop/src/renderer/features/scheduler/components/__tests__/ScheduleFormDialog.test.tsx@@ -11,6 +11,7 @@ import type { Schedule } from '@cindy/maker-scheduler';// Standalone Windows run: 3.14s Vitest / 4.21s process wall time (5 cases).const state = vi.hoisted(() => ({warning: vi.fn(),+ error: vi.fn(),references: new Map<string, unknown>(),loading: false,localModels: [{ id: 'shared', efforts: ['low'], supportsFastMode: false }],@@ -21,7 +22,7 @@ const state = vi.hoisted(() => ({}));vi.mock('react-router-dom', () => ({ useNavigate: () => vi.fn() }));vi.mock('react-i18next', () => ({ useTranslation: () => ({ t: (key: string) => key, i18n: { exists: () => true } }) }));-vi.mock('@/lib/toast', () => ({ toast: { warning: state.warning, success: vi.fn(), error: vi.fn() } }));+vi.mock('@/lib/toast', () => ({ toast: { warning: state.warning, success: vi.fn(), error: state.error } }));vi.mock('@/hooks/useAgentCapabilities', () => ({getCachedCapabilities: () => null,useAgentCapabilities: (_agent: string, device?: string) => ({@@ -82,6 +83,9 @@ it('keeps localized switch guidance and redacted diagnostics after a rejected sah.onSubmit.mockRejectedValueOnce(new Error('[SSH_HARNESS_SWITCH_UNSUPPORTED] technical diagnostic api_key=private-value'));h.save();await waitFor(() => expect(screen.getByText('chat.remoteError.SSH_HARNESS_SWITCH_UNSUPPORTED')).toBeTruthy());+ // The notice can be above the viewport when saving a long form. Keep the+ // shared alert toast, with curated copy rather than the diagnostic/secret.+ expect(state.error).toHaveBeenCalledExactlyOnceWith('chat.remoteError.SSH_HARNESS_SWITCH_UNSUPPORTED');expect(screen.queryByText(/technical diagnostic/)).toBeNull();fireEvent.click(screen.getByText('chat.errorBanner.networkShowRaw'));expect(screen.getByText(/technical diagnostic/).textContent).toContain('[REDACTED]');