Repository navigation
improvement(cron): only start outbox and file-search passes when work is due, via a shared scheduled-pass helper - #8713
Conversation
…ntenance is scheduled
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
There was a problem hiding this comment.
All reported issues were addressed across 9 files
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Turn on auto-fix | Re-trigger cubic
|
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
…search, and knowledge projection
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
All reported issues were addressed across 17 files
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Turn on auto-fix | Re-trigger cubic
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
All reported issues were addressed across 17 files
Requires human review: Auto-approval blocked because this review re-detected 1 unresolved issue already reported by Cubic.
Turn on auto-fix | Re-trigger cubic
…igger fake; plan test on production indexes
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
All reported issues were addressed across 18 files
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Turn on auto-fix | Re-trigger cubic
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
Summary
The per-minute outbox and workspace-file-search crons started a Trigger.dev run every tick even with nothing to do. Both now check first, and all three gated scheduled passes share one helper.
Shared helper —
lib/core/async-jobs/scheduled-pass.tstriggerScheduledPass: the windowedtasks.trigger(idempotency key${keyPrefix ?? taskId}:${window},idempotencyKeyTTL: '5m', region) that outbox, file search, and knowledge projection each hand-rolled. Keys and options are byte-identical to before, so in-flight dedupe is unaffected across the deploystartScheduledPass: due → inline or Trigger.dev → sharedScheduledPassResult({ triggered, backend, jobId }), replacingKnowledgeProjectionSweepResult/ the file-search result typedueitself: outbox maintenance window + fail-open, file search fail-open, knowledge projection fail-closed (unchanged). Outbox keeps its synchronous self-hosted branch local because the route reports its output.cleanup-stale-executionsuses the job-queue path and is left as isOutbox gate — starts a run only when:
readyEventTypesQuery, so gate and claimer share one predicateprocessinglease is stale — the reaper's predicate, now shared viaisStuckProcessing/STUCK_PROCESSING_THRESHOLD_MSFile-search dispatch gate — starts a run only when one of the dispatcher's own phases would act, each sharing its predicate with that phase: backfill page due (
isBackfillPageDue), expired build (fileSearchBuildExpired), stale claim (staleClaim), or a queued workspace. Reconcile interval unchanged (hourly) sincedb:pushenvironments rely on that walk.enqueue-dispatch.tsnow usesimport typefor the task instead of a runtime importBoth gates fail open (a check error starts the run as before — billing, seat sync, invitations, and KB/file indexing ride these crons) and cover both the Trigger.dev and inline backends. Cron routes return 200
triggered: falseon an idle tick; response bodies otherwise unchanged. Latency for due work stays ≤ 1 tick.Supersedes #8714 (folded in so both gates can share the helper).
Type of Change
Testing
now→ work; lease exactly at the stale threshold → work; plan has no Seq Scan and stays under 100 buffers on a 100k-row backlogprepareWorkspaceFileSearchDispatchdoes nothing on the same data; no Seq Scantasks.triggercall pinned for all three passes (keys, TTLs, maxDuration, region)due)bun run lint,bun run type-check,bun run check:audits,check:test-patterns— green; 26 files / 309 unit tests; 2 integration suites / 40 testsChecklist
test-auditauthoring gate)