feat(scheduled-tasks): calendar views + persisted, runnable tasks#4979
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
|
@greptile run |
PR SummaryMedium Risk Overview Runnable prompts — Shared prompt editing — Chat input logic moves into Product language — Constitution, README, landing, SEO/FAQ, and in-app labels shift from Mothership/Copilot to Chat (module) and Sim (the agent). User-facing upload/execute errors say “Chat” where appropriate; internal UI components & workspace chrome — EMCN gains Reviewed by Cursor Bugbot for commit d38a99d. Configure here. |
Greptile SummaryThis PR adds a full calendar UI (month/week/day views) for scheduling persistent Sim agent tasks, backed by the existing
Confidence Score: 5/5The change is safe to merge — the new columns are additive nullables, all schema-breaking paths are guarded, and the known regressions called out in prior rounds have been addressed. The backend execution paths (computeNextRunAt, performExcludeOccurrence, failure-path status transitions) are correct and well-tested (194 passing tests). The previously reported issues — stale today, smooth-scroll mis-application, and edit stripping @-mention contexts — are all addressed in the follow-up commits. No correctness issues were found in the latest revision. No files require special attention. The migration is purely additive, and the core execution logic changes in schedule-execution.ts and orchestration.ts are well-guarded. Important Files Changed
Sequence DiagramsequenceDiagram
participant User as User (Browser)
participant TaskModal as TaskModal
participant Hook as useScheduledTasks
participant API as /api/schedules
participant Orch as Orchestration
participant Exec as schedule-execution
participant DB as workflow_schedule
User->>TaskModal: "Fill prompt + @mentions + recurrence"
TaskModal->>Hook: createTask(draft)
Hook->>API: POST /api/schedules (cronExpression/time, contexts, endsAt)
API->>Orch: performCreateJob(...)
Orch->>Orch: computeNextRunAt(cron, endsAt)
Orch->>DB: INSERT (contexts, excludedDates, endsAt, nextRunAt)
DB-->>API: schedule row
API-->>Hook: id, nextRunAt, status
Hook->>Hook: invalidate scheduleKeys.list(workspaceId)
Note over Exec,DB: At nextRunAt...
Exec->>DB: "SELECT job WHERE nextRunAt <= now AND status=active"
Exec->>API: POST /api/mothership/execute (contexts resolved server-side)
API-->>Exec: streamed response
Exec->>Exec: "computeNextRunAt(cron, from=now, excludedDates, endsAt)"
Exec->>DB: UPDATE nextRunAt / status
Note over User,DB: User deletes one occurrence
User->>Hook: deleteOccurrence(scheduleId, runAt)
Hook->>API: "PUT /api/schedules/:id action=exclude_occurrence"
API->>Orch: performExcludeOccurrence(occurrence)
Orch->>DB: "UPDATE excludedDates += occurrence"
Orch->>Orch: "if occurrence==nextRunAt then computeNextRunAt(from=occurrence, excludedDates)"
Orch->>DB: UPDATE nextRunAt (advance past excluded instant)
Reviews (6): Last reviewed commit: "simplify(scheduled-tasks): reuse date-fn..." | Re-trigger Greptile |
Greptile SummaryThis PR replaces the scheduled-tasks table with a three-scope calendar (month/week/day), adds a
Confidence Score: 4/5Safe to merge for the calendar UI and modal-dropdown fix; the The apps/sim/app/workspace/[workspaceId]/scheduled-tasks/hooks/use-calendar.ts (stale Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant ScheduledTasks
participant useCalendar
participant ScheduleCalendar
participant CreateTaskModal
User->>ScheduledTasks: mount
ScheduledTasks->>useCalendar: "init (scope=week, anchor=now, today=now frozen)"
useCalendar-->>ScheduledTasks: state
ScheduledTasks->>ScheduleCalendar: render(scope, anchor, today)
User->>ScheduleCalendar: click time slot
ScheduleCalendar->>ScheduledTasks: onSelectSlot(date, time)
ScheduledTasks->>useCalendar: selectSlot(date, time)
useCalendar-->>ScheduledTasks: "selectedSlot set, isCreateOpen=true"
ScheduledTasks->>CreateTaskModal: "open=true, slot"
User->>CreateTaskModal: fill prompt, click Schedule
CreateTaskModal->>CreateTaskModal: logger.info stub, no persistence
CreateTaskModal-->>ScheduledTasks: onOpenChange(false)
ScheduledTasks->>useCalendar: closeCreate()
User->>ScheduleCalendar: click Today
ScheduleCalendar->>ScheduledTasks: onToday()
ScheduledTasks->>useCalendar: "goToday sets anchor=new Date()"
ScheduleCalendar->>ScheduleCalendar: scrollSignal++ scrollTo(timeToOffset(now))
|
|
@greptile run |
cd2d467 to
cb9fb71
Compare
…dcrumbs - Resource.Table: remove internal sorting (defaultSort/sortValues) and the emptyMessage state — rows render in the order given, chrome always paints - Resource: root is now the positioning context for overlays; consumers (files, tables, knowledge, document) wrap detail views in <Resource> instead of hand-rolled divs - ResourceHeader: root titles no longer truncate during initial layout; LocationFocusVeil gates the portal on mount to fix a hydration mismatch - Toasts: drop the StackDismiss ring and stack countdown — each toast runs its own timer; remove the Mod+E clear-notifications command; align toast typography and icons with chip chrome - Breadcrumbs: use the canonical '…' placeholder while names load - incident.io: fix display name and catalog slug (with redirect) - Add dev:capped / dev:full:capped scripts with a 4GB heap cap
Add month/time calendar views for scheduled tasks with toolbar, event chips, and a create-task modal, backed by calendar-grid and schedule-events utils (with tests) and a use-calendar hook. Replace the old schedule-modal/context-menu flow. Rename the "Mothership" agent to "Sim" and the chat surface to "Chat" across landing copy, constitution, block metadata, API error messages, and copilot/data-drain internals. Drop unused workspace route layouts.
A non-modal DropdownMenu portals outside an open dialog's react-remove-scroll subtree, so its content cannot be wheel-scrolled (e.g. the time picker in the scheduled-task create modal). ModalContent now marks its subtree via an InsideModal context, and the emcn DropdownMenu root upgrades itself to modal inside dialogs so it mounts its own scroll lock and focus scope; page-level menus keep their consumer-chosen modality. Also stretch the create-task modal's date/time chip controls to full width and drop the dead EDGE_GUTTER constant left behind by the equal-tracks calendar layout.
…ck, smooth Today scroll - useCalendar: today was frozen at mount, so after midnight the isToday column highlight and the current-time indicator stayed on the previous day. today is now state refreshed by a sleep-resilient minute poll that only re-renders when the calendar day actually changes - CreateTaskModal: the stub submit closed silently, reading as false success; it now shows an info toast that the task was not created - ScheduleCalendar: Today presses scroll smoothly as an orientation cue; mount and scope switches keep instant positioning
- ChipCopyInput (canonical view-only copy field), ChipTimePicker, ChipModalField type='copy', ChipTextarea viewOnly; new border chip variant and shared chipPrimaryFillTokens - migrate ~40 consumers off disabled inputs and the deleted CopyableValueField; ChipConfirmModal description->text and secondaryActions[] API sweep - scheduled-tasks: rename create-task-modal to task-modal, add task-details-modal + task-context-menu, useScheduledTasks hook - home: extract prompt-editor (usePromptEditor) out of user-input
Wire the calendar UI to the existing sourceType='job' workflow_schedule backend instead of local component state, so tasks persist and actually run as Sim agent invocations. - schema: add contexts (@-mentions resolved into the run), excludedDates (per-occurrence deletes), and endsAt (recurrence end) to workflow_schedule (migration 0235) - contracts/schedules: expose one-time `time`, contexts, endsAt on create; add the exclude_occurrence action; nullable cron in the create response - orchestration: persist the new fields, honor exclusions + end boundary via a shared computeNextRunAt, add performExcludeOccurrence - execution: forward contexts to /api/mothership/execute and recompute the next run through computeNextRunAt - mothership/execute: accept + resolve contexts like the interactive chat path - frontend: replace the local hook with React Query (create/update/delete + exclude-occurrence), expand recurrences into calendar occurrences, add the recurrence control (frequency + end) and the recurring this/all delete dialog
cb9fb71 to
4469909
Compare
|
@greptile |
|
@cursor review |
…r valueRef on input
- chip-modal: footer secondary cluster now wraps (min-w-0 flex-wrap) with a non-shrinking action cluster, so scheduling controls can never clip Cancel/ primary; recurrence labels compacted so the common case stays one row - schedule-execution: failure path now completes a recurring job when maxRuns/ endsAt/exclusions are exhausted (and a one-time/maxRuns job), mirroring the success path instead of leaving it active with a stale nextRunAt - prompt-editor: commitValue keeps valueRef in lockstep with state on the mention-hook setter paths, completing the stale-ref fix - task-modal: preserve @-mention contexts on edit (seed editor.setContexts); single emptiness source of truth - recurrence-control: preserve prior count when toggling end type; drop a needless useMemo - contracts: reuse scheduleContextSchema for the execute contexts shape
|
@greptile re-review the latest commits |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 6db24c8. Configure here.
…ead 'running' status + single-use helper
|
@greptile re-review the latest commits |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit d38a99d. Configure here.
Summary
A scheduled-tasks calendar (month / week / day views) where you create, edit, and delete tasks that persist and actually run as Sim agent invocations.
Calendar UI
@-mention resources,/-invoke skills like talking to Sim), a recurrence control, and chip date/time pickers.Wired to the backend (binds to the existing
workflow_schedulesourceType='job'rows — no new table)/api/schedulesand fire the prompt as a real Sim agent run (/api/mothership/execute), with the captured@-mention contexts resolved into the run.Schema (migration 0235) — adds
contexts,excludedDates, andendsAttoworkflow_schedule.Type of Change
Testing
bun run type-check,bun run check:api-validation,bun run check:react-queryall passrecurrence.test.ts(cron mapping, exclusions, end boundary, range bounds) plus existing schedules route/orchestration/execute suites — 194 tests greenChecklist