Skip to content

fix(scheduling): keep a flow's recurring schedule when adding a delayed run - #3894

Merged
chubes4 merged 2 commits into
mainfrom
fix/issue-3884-data-machine
Nov 2, 2026
Merged

chubes4 merged 2 commits into
mainfrom
fix/issue-3884-data-machine

Conversation

@chubes4

@chubes4 chubes4 commented Nov 2, 2026

Copy link
Copy Markdown
Member

Fixes #3884

Problem

wp datamachine flows run <id> --timestamp=<T>, and datamachine/schedule-flow with a numeric timestamp, replaced the flow's scheduling_config with one_time. After the run, JobCompleteHandler reverted it to manual, so any recurring or cron schedule was silently lost. On production, flow 4 (EC Agent Progress Ping, every_3_days) sat on manual for 10 days after an operator ran one delayed verification run.

Fix

  • ScheduleFlowAbility::scheduleOneTime(): if the flow already has a recurring or cron interval, it enqueues one extra datamachine_run_flow_once action at T through the new FlowRoutines::enqueue_one_time(). It does not call sync(), so scheduling_config, the flow routine, and its pending wake are untouched. A log line records that the schedule was preserved. action_id is now returned for real instead of null.
  • Manual or unscheduled flows keep the existing behavior: one_time, then manual after the run.
  • FlowRoutines::enqueue_one_time() returns a WP_Error if Action Scheduler is missing or the enqueue fails, so a failed enqueue is never reported as success. schedule_one_time() now uses this method too.
  • Updated the --timestamp CLI docblock.

Design note: if someone edits the schedule later (sync() on a recurring interval), any pending extra one-off for that flow is still cancelled by cancel_one_time(). A schedule edit resets the flow's queued runs; nothing else touches the extra run.

Tests

plugins/data-machine/tests/delayed-flow-preserves-schedule-smoke.php, run with php against the real ability, scheduling adapter, and completion handler:

  • every_3_days and cron flows: the delayed run keeps the config identical, the action is queued at T on the engine bridge hook, and after completion the config and routine action are still unchanged.
  • manual and empty-config flows: one_time, then manual after the run (existing behavior).
  • A failed enqueue returns schedule_failed and leaves the recurring config alone.

Provenance

Written by a Homeboy Cook (agent-task-d48af8b6-d1aa-4251-9f7b-ed775b160274, Lab, Pi). The scoped task gate (diff scope, php -l, regression smoke) passed on Lab and again locally. The default component gate (gate-2) failed in exactly the same way on the unmodified baseline. Homeboy classified that as accepted_inherited_failure, and promotion went ahead on the task gate with operator authorization. Homeboy could not publish the PR because of homeboy#17190 (monorepo matches multiple component configurations), so the verified candidate was committed and this PR opened by hand outside Homeboy.

🤖 AI-generated (Extra Chill Bot via Homeboy Cook); reviewed against the code before opening.

…ed run

flows run --timestamp and datamachine/schedule-flow with a numeric
timestamp rewrote scheduling_config to one_time, and JobCompleteHandler
then reverted it to manual, silently dropping every_N/cron schedules.

For flows with a recurring or cron schedule, enqueue an extra
datamachine_run_flow_once action at T without touching scheduling_config
or the flow routine. Manual flows keep the one_time -> manual behavior.

Fixes #3884
@homeboy-ci

homeboy-ci Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Homeboy Results — data-machine-business

Review lint

✅ review lint — passed

Deep dive: homeboy review lint data-machine-business --changed-since 4ad392a

Artifacts and drill-down
  • CI results artifact: homeboy-ci-results-data-machine-business-review-lint-homeboy-__Extra-Chill_homeboy-action-Linux-php8.2-node24 contains immediate command JSON for this action invocation.
  • Observation artifact: homeboy-observations-data-machine-business-review-lint-homeboy-__Extra-Chill_homeboy-action-Linux-php8.2-node24 contains exported Homeboy run history for deeper queries.
  • Drill-down: download the observation artifact, then run homeboy runs import <dir>, homeboy runs list, and homeboy runs findings <run-id>.
  • Artifacts are attached to the workflow run: https://github.com/Extra-Chill/data-machine/actions/runs/41491785129
Tooling versions
  • Homeboy CLI: homeboy 0.444.10+be8dec9ff18ad29db97aa05162735beefb0486d7
  • Extension: wordpress from https://github.com/Extra-Chill/homeboy
  • Extension revision: 4605e8a
  • Action: Extra-Chill/homeboy-action@v2

@homeboy-ci

homeboy-ci Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Homeboy Results — data-machine-events

Review lint

✅ review lint — passed

Deep dive: homeboy review lint data-machine-events --changed-since 4ad392a

Artifacts and drill-down
  • CI results artifact: homeboy-ci-results-data-machine-events-review-lint-homeboy-__Extra-Chill_homeboy-action-Linux-php8.2-node24 contains immediate command JSON for this action invocation.
  • Observation artifact: homeboy-observations-data-machine-events-review-lint-homeboy-__Extra-Chill_homeboy-action-Linux-php8.2-node24 contains exported Homeboy run history for deeper queries.
  • Drill-down: download the observation artifact, then run homeboy runs import <dir>, homeboy runs list, and homeboy runs findings <run-id>.
  • Artifacts are attached to the workflow run: https://github.com/Extra-Chill/data-machine/actions/runs/41491785109

Review test

⏳ review test — timed out

  • 10 passed

ℹ️ To run specific tests: homeboy review test data-machine-events -- --filter=TestName
ℹ️ Auto-fix lint issues: homeboy review lint data-machine-events --fix
ℹ️ Collect coverage: homeboy review test data-machine-events --coverage
ℹ️ Save test baseline: homeboy review test data-machine-events --baseline
ℹ️ Analyze failures: homeboy review test data-machine-events --analyze
ℹ️ Pass args to test runner: homeboy review test -- [args]
ℹ️ Full options: homeboy self docs commands/test

Timeout triage

  • Phase: test; elapsed/budget: 1566s / 1500s
  • Selected: unknown; counts: complete: 10 passed, 0 failed, 0 skipped of 10

npm warn install-scripts 4 packages have install scripts not yet covered by allowScripts: npm warn install-scripts @parcel/watcher@2.5.1 (install: node scripts/build-from-source.js) npm warn install-scripts core-js@3.47.0 (postinstall: node -e "try{require('./postinstall')}catch(e){}") npm warn install-scripts core-js-pure@3.47.0 (postinstall: node -e "try{require('./postinstall')}catch(e){}") npm warn install-scripts unrs-resolver@1.11.1 (postinstall: napi-postinstall unrs-r

Deep dive: homeboy review test data-machine-events

Artifacts and drill-down
  • CI results artifact: homeboy-ci-results-data-machine-events-review-test-homeboy-__Extra-Chill_homeboy-action-Linux-php8.2-node24 contains immediate command JSON for this action invocation.
  • Observation artifact: homeboy-observations-data-machine-events-review-test-homeboy-__Extra-Chill_homeboy-action-Linux-php8.2-node24 contains exported Homeboy run history for deeper queries.
  • Drill-down: download the observation artifact, then run homeboy runs import <dir>, homeboy runs list, and homeboy runs findings <run-id>.
  • Artifacts are attached to the workflow run: https://github.com/Extra-Chill/data-machine/actions/runs/41491785109
Tooling versions
  • Homeboy CLI: homeboy 0.444.10+be8dec9ff18ad29db97aa05162735beefb0486d7
  • Extension: wordpress from https://github.com/Extra-Chill/homeboy
  • Extension revision: 4605e8a
  • Action: Extra-Chill/homeboy-action@v2

@homeboy-ci

homeboy-ci Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Homeboy Results — data-machine-socials

Homeboy

No files changed since 4ad392a
⚡ Scope: changed files only (since 4ad392a788df2329d7ccb95adae05ae71abbb184)

0 finding(s) across 2 stage(s)

✅ lint

Deep dive: homeboy review lint data-machine-socials --changed-since=4ad392a788df2329d7ccb95adae05ae71abbb184

✅ test

Deep dive: homeboy review test data-machine-socials --changed-since=4ad392a788df2329d7ccb95adae05ae71abbb184

Artifacts and drill-down
  • CI results artifact: homeboy-ci-results-data-machine-socials-review-lint-review-test-homeboy-__Extra-Chill_homeboy-action-Linux-php8.2-node24 contains immediate command JSON for this action invocation.
  • Observation artifact: homeboy-observations-data-machine-socials-review-lint-review-test-homeboy-__Extra-Chill_homeboy-action-Linux-php8.2-node24 contains exported Homeboy run history for deeper queries.
  • Drill-down: download the observation artifact, then run homeboy runs import <dir>, homeboy runs list, and homeboy runs findings <run-id>.
  • Artifacts are attached to the workflow run: https://github.com/Extra-Chill/data-machine/actions/runs/41491785356
Tooling versions
  • Homeboy CLI: homeboy 0.444.10+be8dec9ff18ad29db97aa05162735beefb0486d7
  • Extension: wordpress from https://github.com/Extra-Chill/homeboy
  • Extension revision: 4605e8a
  • Action: Extra-Chill/homeboy-action@v2

@chubes4
chubes4 merged commit e2e2002 into main Nov 2, 2026
37 of 38 checks passed
@chubes4
chubes4 deleted the fix/issue-3884-data-machine branch November 2, 2026 18:09
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.

flows run --timestamp silently replaces a flow's recurring schedule (reverts to manual after the run)

1 participant