Skip to content

agent: Scheduled actions have been reported to be crashing the page for some ac#1568

Open
sweetmantech wants to merge 1 commit intotestfrom
agent/scheduled-actions-have-been-re-1773067991343
Open

agent: Scheduled actions have been reported to be crashing the page for some ac#1568
sweetmantech wants to merge 1 commit intotestfrom
agent/scheduled-actions-have-been-re-1773067991343

Conversation

@sweetmantech
Copy link
Copy Markdown
Collaborator

@sweetmantech sweetmantech commented Mar 9, 2026

Automated PR from coding agent.

Prompt: Scheduled actions have been reported to be crashing the page for some accounts. Can you debug why and open a pr fixing any bugs on the /tasks page in Chat. make sure to push your changes and open a pr.

Summary by CodeRabbit

  • Bug Fixes
    • Enhanced task schedule handling. Tasks without defined schedules now display "No schedule" instead of undefined values. Recurring indicators are properly hidden when schedule data is missing or empty.

@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Mar 9, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
recoup-chat Ready Ready Preview Mar 9, 2026 2:58pm

Request Review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 9, 2026

📝 Walkthrough

Walkthrough

Four files updated to add null/undefined safety checks for task schedule handling. Guard clauses and fallback values prevent errors when schedule values are empty or undefined.

Changes

Cohort / File(s) Summary
UI Components
components/VercelChat/dialogs/tasks/TaskDetailsDialogContent.tsx, components/VercelChat/tools/tasks/TaskCard.tsx
Added schedule fallback to empty string and "No schedule" text display. Added guard requiring non-empty schedule before rendering Repeat icon.
Utility Functions
lib/tasks/isRecurring.ts, lib/tasks/parseCronToHuman.ts
Added early-return guards for falsy cron expressions in recurrence detection and human-readable schedule parsing.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Poem

A schedule once lost in the void,
Now safely caught before deployed,
With guards in place and fallbacks true,
Each empty string knows what to do. 📋✨

🚥 Pre-merge checks | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Solid & Clean Code ⚠️ Warning DRY principle violated: task.schedule normalization (.trim()) is applied inconsistently across TaskCard.tsx and TaskDetailsDialogContent.tsx, causing potential disagreement between icon display and text rendering. Extract schedule normalization into a single utility function and apply it consistently across all components that use task.schedule values.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch agent/scheduled-actions-have-been-re-1773067991343

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@components/VercelChat/tools/tasks/TaskCard.tsx`:
- Around line 81-85: Normalize task.schedule once into a single variable (e.g.,
const normalizedSchedule = task.schedule?.trim()) and use that
normalizedSchedule for both the isRecurring check and the label rendering: call
isRecurring(normalizedSchedule) for the Repeat icon and pass normalizedSchedule
to parseCronToHuman (or show "No schedule" if falsy). Update references to
task.schedule in this block so both the icon and text operate on the same
trimmed value.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 520631ab-d4c4-4245-aa90-d4d9b8d09d9f

📥 Commits

Reviewing files that changed from the base of the PR and between eaeb579 and c0c5148.

📒 Files selected for processing (4)
  • components/VercelChat/dialogs/tasks/TaskDetailsDialogContent.tsx
  • components/VercelChat/tools/tasks/TaskCard.tsx
  • lib/tasks/isRecurring.ts
  • lib/tasks/parseCronToHuman.ts

Comment on lines +81 to +85
{task.schedule && isRecurring(task.schedule) && (
<Repeat className="h-4 w-4 text-muted-foreground dark:text-muted-foreground flex-shrink-0" />
)}
<span className="text-base text-muted-foreground dark:text-muted-foreground">
{parseCronToHuman(task.schedule.trim())}
{task.schedule ? parseCronToHuman(task.schedule.trim()) : "No schedule"}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Normalize the schedule once before both checks.

The label uses task.schedule.trim(), but the Repeat icon still reads the raw value. If a saved cron has extra whitespace, the text and icon can disagree. Reuse one normalized value for both branches.

♻️ Proposed fix
 const TaskCard: React.FC<TaskCardProps> = ({ task, isDeleted, ownerEmail }) => {
   const [isDropdownOpen, setIsDropdownOpen] = useState(false);
   const { updateAction, isLoading: isUpdating } = useUpdateScheduledAction();
   const { deleteAction, isLoading: isDeleting } = useDeleteScheduledAction();
   const isActive = task.enabled && !isDeleted;
   const isPaused = !task.enabled && !isDeleted;
+  const normalizedSchedule = task.schedule?.trim() || "";
 
   const handlePause = async (e: React.MouseEvent) => {
@@
-          {task.schedule && isRecurring(task.schedule) && (
+          {normalizedSchedule && isRecurring(normalizedSchedule) && (
             <Repeat className="h-4 w-4 text-muted-foreground dark:text-muted-foreground flex-shrink-0" />
           )}
           <span className="text-base text-muted-foreground dark:text-muted-foreground">
-            {task.schedule ? parseCronToHuman(task.schedule.trim()) : "No schedule"}
+            {normalizedSchedule ? parseCronToHuman(normalizedSchedule) : "No schedule"}
           </span>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@components/VercelChat/tools/tasks/TaskCard.tsx` around lines 81 - 85,
Normalize task.schedule once into a single variable (e.g., const
normalizedSchedule = task.schedule?.trim()) and use that normalizedSchedule for
both the isRecurring check and the label rendering: call
isRecurring(normalizedSchedule) for the Repeat icon and pass normalizedSchedule
to parseCronToHuman (or show "No schedule" if falsy). Update references to
task.schedule in this block so both the icon and text operate on the same
trimmed value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant