Skip to content

fix(outbox): process cron batches outside HTTP requests - #7911

Merged
icecrasher321 merged 2 commits into
stagingfrom
codex/fix-outbox-cron-timeout
Sep 17, 2026
Merged

icecrasher321 merged 2 commits into
stagingfrom
codex/fix-outbox-cron-timeout

Conversation

@icecrasher321

@icecrasher321 icecrasher321 commented Sep 17, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Return 202 after Trigger.dev accepts outbox processing so slow handlers can finish outside the cron caller's HTTP deadline.
  • Keep the existing handler registry, processing budgets, recovery, and per-event retries in a shared processor; retain synchronous processing when Trigger.dev is disabled.
  • Use a medium-2x worker and allow 15 concurrent runs to cover the overlap of a one-minute cadence and a 15-minute execution limit. Deduplicate ticks without imposing a short queue expiry.

Type of Change

  • Bug fix

Testing

48 focused tests passed across the route, enqueue path, worker, processor recovery, and outbox service. App type-check, worker bundling, lint, API validation, repository audits, and generated-artifact checks passed.

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)

@vercel

vercel Bot commented Sep 17, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Sep 17, 2026 2:39am UTC

Request Review

@greptile-apps

greptile-apps Bot commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

The outbox changes appear safe to merge, with no outstanding correctness, security, or repository-rule issues identified.

Summary

The PR moves hosted outbox processing from the cron HTTP request into a Trigger.dev task while preserving synchronous processing for deployments without Trigger.dev.

  • Authenticates the cron request before enqueueing and returns 202 after durable task acceptance.
  • Centralizes the existing handlers, processing budgets, document recovery, and stale-work cleanup in a shared processor.
  • Configures one-minute tick deduplication and up to 15 overlapping workers to accommodate the 15-minute execution window.
  • Adds focused coverage for route behavior, enqueueing, worker configuration, processor recovery, and failure propagation.
Diagram
sequenceDiagram
    participant Cron
    participant Route as Outbox cron route
    participant Trigger as Trigger.dev
    participant Worker as Process-outbox worker
    participant DB as Durable outbox

    Cron->>Route: GET with cron credentials
    Route->>Route: Verify authorization
    alt Trigger.dev enabled
        Route->>Trigger: Enqueue process-outbox with minute key
        Trigger-->>Route: Durable run accepted
        Route-->>Cron: 202 Accepted
        Trigger->>Worker: Start bounded task
        Worker->>DB: Claim and process outbox events
        Worker->>DB: Recover documents and reap stale work
    else Trigger.dev disabled
        Route->>DB: Run processor synchronously
        DB-->>Route: Processing result
        Route-->>Cron: 200 OK
    end
Loading

Reviews (2) · Last reviewed commit: "fix(outbox): preserve polling capacity w..."

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 9 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

@icecrasher321

Copy link
Copy Markdown
Collaborator Author

@greptile

@icecrasher321

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@icecrasher321 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 9 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

@icecrasher321
icecrasher321 merged commit 2a5b22c into staging Sep 17, 2026
35 checks passed
@icecrasher321
icecrasher321 deleted the codex/fix-outbox-cron-timeout branch September 17, 2026 02:47

This branch was previously deployed

1 inactive deployment
Preview 8ed9294b Deployed Sep 17, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant