improvement(execution): cut the time between a workflow trigger and its first block - #8434
Conversation
…ts first block - Trigger.dev getJob only retrieves real run ids; caller-chosen ids (schedule_…, workflow-execution:…) go straight to the tag lookup instead of a ~10 s 404 - Execution-log start resolves the snapshot id (cached once referenced) and inserts with ON CONFLICT instead of select + full-state upsert RETURNING * + insert - Preprocessing starts payer attribution and the ban/usage/subscription gate reads as soon as their inputs are known; subscription is only read when needed - Execution core prefetches env + PII policy alongside custom blocks and reuses the webhook job's already-loaded environment - Webhook lookups answer trigger-block deployment from the join they already do; versioned deployment loads serve the materialized cache first - getHighestPrioritySubscription, custom-block rows, and env suspension lookups drop sequential round trips
|
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 29 files
Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.
Fix all with cubic | Re-trigger cubic
|
…y's access read out of the run, tidy tests
|
@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.
No issues found across 29 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.
Re-trigger cubic
…shot identity, explicit suspension paths
|
@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 29 files
Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.
Fix all with cubic | Re-trigger cubic
…holding a suspended identity
|
@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.
No issues found across 29 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.
Re-trigger cubic
Summary
TriggerDevJobQueue.getJobcalledruns.retrievewith caller-chosen ids (schedule_…,workflow-execution:…), which Trigger.dev takes ~10 s to 404 (vs <1 s for a real run id). Every schedule tick stalled ~9.6 s on this before enqueueing anything. Onlyrun_ids are retrieved directly now; others go straight to thejobId:tag lookupON CONFLICT (execution_id) DO NOTHING— replaces select-existing-log + full-state upsertRETURNING *+ insert. Orphan-cleanup race handled by re-resolving on FK violation. Child workflow snapshots use the same id-only resolutiongetHighestPrioritySubscription(3 → 1 stage), custom-block rows (rows first, entitlement only when rows exist), env suspension check runs alongside access/env readsResults
Opt-in harness driving the real webhook route in-process (inline backend, real Postgres/Redis, 1 ms injected DB latency, ~390 KB workflow, billing on), baseline and branch alternated:
Type of Change
Testing
start-execution(dedup, idempotent start, cleanup-deleted snapshot recovery, concurrent starts),execution-environment(owner/actor identities, suspension, lapsed access),trigger-block-deployment(lookup flag vs standalone check, cache bound to workflow),workspace-rows(entitlement),plan(tier priority, org-over-personal tie-break); key guards shown red by mutationtrigger-dev.test.tsregression for caller-chosen job ids (fails on old code); preprocessing precedence tests for the early gate readsapps/simunit suite (34,580 passed), fullbun run test:integration(1,113 + 106 passed),bun run type-check,bun run lint,bun run check:audits(52),docs-manifest:checkChecklist
test-auditauthoring gate)