Fix stalled runners and unreliable scheduled execution - #405
Merged
Merged
Conversation
Detect lost runner registrations and exit for a clean host restart instead of reporting healthy while queue claims return no work. Serialize queue polling, refill execution slots promptly, and bound database requests. Preserve unfinished work ownership on shutdown, retry recovery of already dead runners, evaluate cron schedules in UTC, and allow deployments to choose one scheduling source. Add readiness checks, actionable team plan errors, deployment configuration corrections, and an operations runbook. Add 16 regression tests covering registry loss, recovery, queue draining, HTTP readiness/error handling, and schedule evaluation. All 41 runner tests, 3 frontend tests, TypeScript builds, and lint pass (one existing lint warning).
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
A runner whose database registration disappeared could remain online, return a successful health response, and continue enqueueing scheduled jobs while claiming no work. This change detects a missing or retired registration and exits so the host can restart the worker with a new registration. Readiness now requires a recent confirmed heartbeat.
TRIGGER_SCHEDULER_ENABLEDso operators can select one scheduler, and report unsuccessful Edge Function wake-up requests.docs/runner-operations.md.Related Issue
No linked issue; follows the runner and scheduling reliability investigation.
Type of Change
How Has This Been Tested?
npm run lint: zero errors; one existing Fast Refresh warning inDateRangePicker.tsx.git diff --checkpassed.Docker image execution and the Deno Edge Function were not tested locally. No live model execution or output delivery was performed during validation.
Rollout and limitations
Historical queued jobs were cancelled separately with private snapshots and retained audit history; unassigned pending tasks were preserved. Both execution queues were verified empty, recurring triggers are paused, and the database scheduler is disabled before this push. Private snapshots and local Supabase metadata are excluded from the PR.
Keep schedules paused until the deployed worker has a registered, advancing heartbeat and a selected execution has been verified. Use one replica and one scheduling source; with the always-on runner, leave the database scheduler disabled. Resolve invalid team plan/configuration requirements before restoring affected schedules. Review the 48-hour catch-up window when reenabling triggers so missed maintenance occurrences are handled deliberately.
This does not add an atomic shared scheduler claim or exactly-once execution. Recovery can retry interrupted work, and external writes still need idempotency. Railway's health check gates deployment readiness; it is not continuous automatic recovery. The Edge Function source change requires a separate Supabase deployment if that scheduler is used.
Checklist
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.