Repository navigation
[AISAGE-758] feat(gateway): split direct BYOK provider sync into its own cron job - #8498
Merged
Merged
Conversation
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Executive SummaryReviewed all 16 changed files and found no defects: the direct BYOK sync split, per-job sync-state persistence, cron route, admin triggers, and additive migration are internally consistent and preserve existing behavior. Assumptions: Files Reviewed (16 files)
Review Notes
Reviewed by deepseek-flash-latest · Input: 100.7K · Output: 19.9K · Cached: 1.8M Review guidance: REVIEW.md from base branch |
johnnyeric
approved these changes
Oct 22, 2026
This was referenced Oct 23, 2026
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.
Summary
Direct BYOK model list syncing ran inside the
/api/cron/sync-providersjob, after the OpenRouter/Vercel catalog sync. A failure or slowdown in either part blocked or failed the other. This PR moves direct BYOK syncing into its own cron job.syncAndStoreProvidersno longer callssyncDirectByokModels./api/cron/sync-direct-byok-providersruns every 5 minutes (maxDuration120 s) and emits scheduled-job events asweb.sync_direct_byok_providers.providersordirect_byok). Each job has its own copy, its own Sentry and log names, and its own completion and alert-suppression timestamps.0292addsdirect_byok_last_completed_atanddirect_byok_stale_alert_last_posted_attoai_gateway_sync_providers_state. The change only adds columns./admin/sync-providersshows when the last direct BYOK sync completed. It adds a manual "Run direct BYOK sync" button (disabled in production, like the existing one) and a direct BYOK test-alert button.postTestStaleAlertnow takes{ job }.Behavior notes
Verification
tsgo --noEmitforapps/web: passesoxlinton the changed files: passesjestfor the cron route tests (both jobs),sync-providers-stale-alert.test.ts(including new DB-backed per-job persistence tests),sync-direct-byok.test.ts(including new completion-recording tests),sync-providers.test.ts, and the admin-router sync tests: all pass@kilocode/dbjest suite, which includes the schema and migration consistency tests: passes