From 9b0e1f94ad2700388ccb3e916a5ccd724a54bc21 Mon Sep 17 00:00:00 2001 From: Saumya Date: Wed, 1 Oct 2025 12:19:03 +0530 Subject: [PATCH 1/2] fix: scheduled trigger ui fix --- backend/core/triggers/execution_service.py | 4 +- .../providers/simplified-schedule-config.tsx | 59 ++++++++++++++++--- 2 files changed, 52 insertions(+), 11 deletions(-) diff --git a/backend/core/triggers/execution_service.py b/backend/core/triggers/execution_service.py index f6307861..f84f6d5b 100644 --- a/backend/core/triggers/execution_service.py +++ b/backend/core/triggers/execution_service.py @@ -601,8 +601,8 @@ class WorkflowExecutor: return available_tools async def _validate_workflow_execution(self, account_id: str) -> None: - from core.billing import is_model_allowed, get_user_subscription_tier - from billing.billing_integration import billing_integration + from core.billing import is_model_allowed + from core.billing.billing_integration import billing_integration client = await self._db.client from core.ai_models import model_manager diff --git a/frontend/src/components/agents/triggers/providers/simplified-schedule-config.tsx b/frontend/src/components/agents/triggers/providers/simplified-schedule-config.tsx index 9cc68bc1..2eb1da8d 100644 --- a/frontend/src/components/agents/triggers/providers/simplified-schedule-config.tsx +++ b/frontend/src/components/agents/triggers/providers/simplified-schedule-config.tsx @@ -357,6 +357,13 @@ export const SimplifiedScheduleConfig: React.FC = } }, [oneTimeDate, oneTimeHour, oneTimeMinute]); + // Initialize recurring schedule on component mount if no preset is selected + useEffect(() => { + if (!selectedPreset && !config.cron_expression) { + handleRecurringScheduleChange(); + } + }, []); + const handlePresetSelect = (presetId: string) => { const allPresets = [...QUICK_PRESETS, ...RECURRING_PRESETS]; const preset = allPresets.find(p => p.id === presetId); @@ -384,17 +391,17 @@ export const SimplifiedScheduleConfig: React.FC = }; const generateCronFromRecurring = () => { - const minute = selectedMinute; - const hour = selectedHour; + const minute = selectedMinute || '0'; + const hour = selectedHour || '9'; switch (scheduleType) { case 'daily': return `${minute} ${hour} * * *`; case 'weekly': - const weekdays = selectedWeekdays.join(','); + const weekdays = selectedWeekdays.length > 0 ? selectedWeekdays.join(',') : '1'; return `${minute} ${hour} * * ${weekdays}`; case 'monthly': - const monthDays = selectedMonthDays.join(','); + const monthDays = selectedMonthDays.length > 0 ? selectedMonthDays.join(',') : '1'; return `${minute} ${hour} ${monthDays} * *`; default: return `${minute} ${hour} * * *`; @@ -403,6 +410,13 @@ export const SimplifiedScheduleConfig: React.FC = const handleRecurringScheduleChange = () => { const cronExpression = generateCronFromRecurring(); + console.log('Generated cron expression:', cronExpression, { + scheduleType, + selectedHour, + selectedMinute, + selectedWeekdays, + selectedMonthDays + }); onChange({ ...config, cron_expression: cronExpression, @@ -418,14 +432,24 @@ export const SimplifiedScheduleConfig: React.FC = const newWeekdays = selectedWeekdays.includes(weekday) ? selectedWeekdays.filter(w => w !== weekday) : [...selectedWeekdays, weekday].sort(); - setSelectedWeekdays(newWeekdays); + + // Prevent deselecting all weekdays (must have at least one) + if (newWeekdays.length > 0) { + setSelectedWeekdays(newWeekdays); + setTimeout(() => handleRecurringScheduleChange(), 0); + } }; const handleMonthDayToggle = (day: string) => { const newDays = selectedMonthDays.includes(day) ? selectedMonthDays.filter(d => d !== day) : [...selectedMonthDays, day].sort((a, b) => parseInt(a) - parseInt(b)); - setSelectedMonthDays(newDays); + + // Prevent deselecting all month days (must have at least one) + if (newDays.length > 0) { + setSelectedMonthDays(newDays); + setTimeout(() => handleRecurringScheduleChange(), 0); + } }; const generateCronFromOneTime = () => { @@ -658,7 +682,18 @@ export const SimplifiedScheduleConfig: React.FC = {/* Schedule Type */}
- { + setScheduleType(value); + // Set appropriate defaults for the schedule type + if (value === 'weekly' && selectedWeekdays.length === 5) { + // If switching to weekly and currently have weekdays selected, set to just Monday + setSelectedWeekdays(['1']); + } else if (value === 'monthly' && selectedMonthDays.length !== 1) { + // If switching to monthly, set to first day of month + setSelectedMonthDays(['1']); + } + setTimeout(() => handleRecurringScheduleChange(), 0); + }}> @@ -674,7 +709,10 @@ export const SimplifiedScheduleConfig: React.FC =
- { + setSelectedHour(value); + setTimeout(() => handleRecurringScheduleChange(), 0); + }}> @@ -687,7 +725,10 @@ export const SimplifiedScheduleConfig: React.FC = : - { + setSelectedMinute(value); + setTimeout(() => handleRecurringScheduleChange(), 0); + }}> From 07ebffe91e9ca760ac6801d95f9b087c083b6d89 Mon Sep 17 00:00:00 2001 From: Saumya Date: Wed, 1 Oct 2025 22:56:43 +0530 Subject: [PATCH 2/2] chore: show all agents in dashboard --- frontend/src/components/dashboard/custom-agents-section.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/components/dashboard/custom-agents-section.tsx b/frontend/src/components/dashboard/custom-agents-section.tsx index 075b8a93..11e9364c 100644 --- a/frontend/src/components/dashboard/custom-agents-section.tsx +++ b/frontend/src/components/dashboard/custom-agents-section.tsx @@ -204,7 +204,7 @@ export function CustomAgentsSection({ onAgentSelect }: CustomAgentsSectionProps)
- {templates.templates.slice(0, 4).map((template) => ( + {templates.templates.map((template) => (