Skip to content

Consider manual runs when determining next run input#4585

Merged
theroinaochieng merged 1 commit intomainfrom
consider-manual-runs-in-last_run_final_dataclip
Mar 31, 2026
Merged

Consider manual runs when determining next run input#4585
theroinaochieng merged 1 commit intomainfrom
consider-manual-runs-in-last_run_final_dataclip

Conversation

@taylordowns2000
Copy link
Copy Markdown
Member

@taylordowns2000 taylordowns2000 commented Mar 30, 2026

Description

This PR closes #4584 .

Cron-triggered workflow runs were ignoring manual run outputs when determining the next input state.

last_run_final_dataclip/1 filtered by wo.trigger_id, which excluded manual runs (whose work orders have trigger_id = nil).

Changed the filter to scope by wo.workflow_id instead, so the most recent successful run is used regardless of how it was triggered. While you could argue that we shouldn't consider manual runs when calculating the next input state for a scheduled run, this isn't how we do it when using the "single step" option, so we should keep it the same for "Final run state" option.

image

Validation steps

  1. Create a workflow with a cron trigger and at least one job
  2. Run the workflow via the cron trigger (or wait for it to fire) — confirm it succeeds
  3. Manually run the same workflow using "Empty input" — confirm it succeeds
  4. Wait for (or trigger) the next cron execution
  5. Verify the new cron run's input dataclip is the final_dataclip from the manual run (step 3), not the older cron run (step 2)

Additional notes for the reviewer

  1. The cron_cursor_job_id path (last_successful_step_dataclip/1) was already unscoped by trigger and did not have this bug — only the cron_cursor_job_id = nil path was affected.
  2. Two new test cases added in invocation_test.exs: one for manual runs being picked up, one for recency ordering across trigger types.

AI Usage

Please disclose whether you've used AI anywhere in this PR (it's cool, we just
want to know!):

  • I have used Claude Code
  • I have used another model
  • I have not used AI

You can read more details in our
Responsible AI Policy

Pre-submission checklist

  • I have performed an AI review of my code (we recommend using /review
    with Claude Code)
  • I have implemented and tested all related authorization policies.
    (e.g., :owner, :admin, :editor, :viewer)
  • I have updated the changelog.
  • I have ticked a box in "AI usage" in this PR

@github-project-automation github-project-automation Bot moved this to New Issues in Core Mar 30, 2026
@taylordowns2000 taylordowns2000 marked this pull request as ready for review March 30, 2026 14:02
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 30, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.52%. Comparing base (ddd3d00) to head (1105029).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4585   +/-   ##
=======================================
  Coverage   89.52%   89.52%           
=======================================
  Files         441      441           
  Lines       21207    21207           
=======================================
  Hits        18986    18986           
  Misses       2221     2221           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@theroinaochieng theroinaochieng requested review from midigofrank and theroinaochieng and removed request for elias-ba and mtuchi March 31, 2026 06:36
Copy link
Copy Markdown
Collaborator

@midigofrank midigofrank left a comment

Choose a reason for hiding this comment

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

Nicely done

@theroinaochieng theroinaochieng merged commit 3fe81d8 into main Mar 31, 2026
9 checks passed
@theroinaochieng theroinaochieng deleted the consider-manual-runs-in-last_run_final_dataclip branch March 31, 2026 07:09
@github-project-automation github-project-automation Bot moved this from New Issues to Done in Core Mar 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Cron Trigger with "Final Run State" Uses Prior Input After Successful Manual "Run with Empty"

3 participants