fix(workflow): prevent scheduled scan gaps and starvation - #7645
bmurphy201 wants to merge 1 commit into
Conversation
Signed-off-by: Forge <command@colonyspark.com>
🔐 Codex Security Review
|
|
Maintainers: this fixes two production scheduler gaps we reproduced in a hosted Buzz workflow: elapsed scan time can leave cron blind spots, and the enabled-schedule query stops after 1,000 rows. Bill Murphy has authorized merge and deployment for our affected workspace. The exact PR head passed the full local just ci gate, plus the database and workflow regression suites. GitHub reports the PR mergeable, DCO, Semgrep, and zizmor passing. Please review and merge when the repository gates are satisfied; our account cannot merge or enable auto-merge under the base policy. |
Summary
Root cause
The loop previously slept for 60 seconds after completing each scan but looked back only 60 seconds for due cron instants. Any scan or execution work made the real interval longer than the lookup window. The global query also returned only the oldest 1,000 enabled scheduled workflows on every tick, leaving all later rows permanently unvisited.
This was observed as a hosted scheduled workflow failing to fire while manual execution remained healthy. Hosted relay logs were unavailable, so the production incident is consistent with these defects but does not prove that either was the only contributing cause.
Behavior
The durable
(community_id, workflow_id, scheduled_for)claim remains the cross-pod at-most-once boundary. After an extended failed scan, the scheduler claims only the latest due cron instant rather than replaying an unbounded burst of side effects.Validation
env -u BUZZ_ACP_SESSION_POLICY bin/just cibuzz-db122 passed / 253 ignored;buzz-workflow171 passed / 2 ignored028762d6ac33bd52a8fd49b96b31d536b738576eRelated work
AI-assisted implementation, reviewed and tested against current
mainbefore submission.