Skip to content

fix: ensureWorkflowCrons creates missing crons instead of skipping all#323

Open
funsaized wants to merge 1 commit intosnarktank:mainfrom
funsaized:fix/ensure-crons-partial-missing
Open

fix: ensureWorkflowCrons creates missing crons instead of skipping all#323
funsaized wants to merge 1 commit intosnarktank:mainfrom
funsaized:fix/ensure-crons-partial-missing

Conversation

@funsaized
Copy link

Summary

Fixes #322ensureWorkflowCrons now creates only missing agent crons instead of skipping all creation when any cron exists.

Problem

workflowCronsExist() used .some() to check if any cron existed for a workflow. If some crons were deleted during troubleshooting but others survived, the function returned true and ensureWorkflowCrons() skipped creating all crons. Missing agent crons were never recreated, causing workflow steps to get stuck at "pending" forever.

This was observed on a competitive-intel-scanner workflow (8 agents) where the landscaper cron was missing but product-scanner still existed.

Changes

  • Replace workflowCronsExist() with getExistingCronAgentIds() that returns the set of agent IDs that already have crons
  • ensureWorkflowCrons() now compares expected agent IDs (from the workflow spec) against existing cron agent IDs and creates only the missing ones
  • setupAgentCrons() accepts an optional onlyAgentIds filter set so it can skip agents that already have crons while preserving the original index-based stagger timing

Testing

  • Verified the project compiles cleanly with npm run build
  • The fix is minimal and backward-compatible: when no crons exist, all are created as before; when all exist, none are created; when some are missing, only those are created

When some agent crons were deleted (e.g. during troubleshooting) but others
survived, workflowCronsExist() returned true and ensureWorkflowCrons()
skipped creating ALL crons. This caused missing agent crons to never get
recreated, leaving workflow steps stuck at 'pending' forever.

Changes:
- Replace workflowCronsExist() with getExistingCronAgentIds() that returns
  the set of agent IDs with existing crons
- ensureWorkflowCrons() now compares expected vs existing agent crons and
  creates only the missing ones
- setupAgentCrons() accepts an optional onlyAgentIds filter set, preserving
  the original stagger timing for all agents

Fixes snarktank#322
@vercel
Copy link

vercel bot commented Mar 18, 2026

@funsaized is attempting to deploy a commit to the Ryan Team on Vercel.

A member of the Team first needs to authorize it.

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.

ensureWorkflowCrons skips creation when partial crons exist

1 participant