Uh oh!
There was an error while loading. Please reload this page.
feat(async-jobs): async execution with job queue backends - #3134
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile OverviewGreptile SummaryThis PR implements a robust async job queue system with three backend options (Trigger.dev, Redis, Database) using an automatic fallback chain. The implementation follows a clean adapter pattern with a unified Key Changes:
Architecture: Database Changes: Confidence Score: 4.5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Client
participant API as API Route<br/>/api/workflows/[id]/execute
participant Config as Job Queue Config
participant Backend as Job Backend<br/>(Redis/DB/Trigger.dev)
participant Worker as Background Worker<br/>(executeWorkflowJob)
participant Executor as Workflow Executor
Client->>API: POST with X-Execution-Mode: async
API->>Config: getJobQueue()
Config->>Config: Determine backend type<br/>(trigger.dev → redis → database)
Config-->>API: Return backend instance
API->>Backend: enqueue('workflow-execution', payload)
Backend->>Backend: Generate jobId (run_xxxx)
Backend->>Backend: Store job with status=pending
alt Redis Backend
Backend->>Backend: Set TTL=48h (max lifetime)
end
Backend-->>API: Return jobId
API->>Client: 202 Accepted<br/>{jobId, statusUrl, async: true}
alt shouldExecuteInline() == true (Redis/DB)
API->>Worker: Fire-and-forget execution
Worker->>Backend: startJob(jobId)
Backend->>Backend: Set status=processing<br/>Increment attempts
Worker->>Executor: executeWorkflowCore()
Executor-->>Worker: Execution result
alt Success
Worker->>Backend: completeJob(jobId, output)
Backend->>Backend: Set status=completed<br/>Store output
alt Redis Backend
Backend->>Backend: Set TTL=24h (retention)
end
else Failure
Worker->>Backend: markJobFailed(jobId, error)
Backend->>Backend: Set status=failed<br/>Store error
alt Redis Backend
Backend->>Backend: Set TTL=24h (retention)
end
end
else Trigger.dev Backend
Note over Backend: Trigger.dev handles execution<br/>via its own worker system
end
Client->>API: GET /api/jobs/{jobId}
API->>Backend: getJob(jobId)
Backend-->>API: Job with status & output
API-->>Client: Job status response
|
Uh oh!
There was an error while loading. Please reload this page.
waleedlatif1
commented
Feb 4, 2026
@cursor review |
waleedlatif1
commented
Feb 4, 2026
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Resolve conflict in env.ts - keep staging's sync timeout values (3000) while adding async timeout variants (5400) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
waleedlatif1
commented
Feb 4, 2026
@cursor review |
waleedlatif1
commented
Feb 4, 2026
Uh oh!
There was an error while loading. Please reload this page.
waleedlatif1
commented
Feb 4, 2026
@cursor review |
Uh oh!
There was an error while loading. Please reload this page.
waleedlatif1
commented
Feb 4, 2026
waleedlatif1
commented
Feb 4, 2026
@cursor review |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
…i#3134) * feat(async-jobs): async execution with job queue backends * added migration * remove unused envvar, remove extraneous comments * ack comment * same for db * added dedicated async envvars for timeouts, updated helm * updated comment * ack comment * migrated routes to be more restful * ack comments --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Summary
createMockRedis()to@sim/testingType of Change
Testing
Checklist
- Code follows project style guidelines
- Self-reviewed my changes
- Tests added/updated and passing
- No new warnings introduced
- I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)
Cursor Bugbot found 2 potential issues for commit fe401f2