Skip to content

Specify a region when triggering #2366

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Aug 7, 2025
Merged

Specify a region when triggering #2366

merged 8 commits into from
Aug 7, 2025

Conversation

matt-aitken
Copy link
Member

This PR allows overriding a region when triggering a run:

await yourTask.trigger(payload, { region: “eu-central-1" });

We also now send the worker_queue to ClickHouse which will allow filtering by region in the runs list in future.

Copy link

changeset-bot bot commented Aug 7, 2025

🦋 Changeset detected

Latest commit: a77df5d

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

coderabbitai bot commented Aug 7, 2025

Walkthrough

This change introduces support for a region override when triggering a run in the system. It updates backend services, SDK, API schemas, and types to accept an optional region parameter. Backend logic now validates and propagates this parameter through task triggering, queue selection, and worker group resolution, including enhanced error handling and access control for region-specific worker groups. The database schema and migrations are updated to store the region as worker_queue. The frontend UI is enhanced to display the region for each run, including flag icons. Additionally, internal property names related to allowed queues are renamed for consistency.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~40 minutes

  • Complexity: The change spans multiple domains—API, SDK, backend logic, database schema/migrations, and frontend UI—with several cross-cutting updates and non-trivial error handling and validation logic.
  • Scope: Numerous files are affected, including type/interface updates, method signature changes, and new/updated error handling.
  • Estimated review time: Approximately 40 minutes, accounting for the need to verify type safety, backward compatibility, error handling, and correct propagation of the new region parameter throughout the stack.

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 22bc5eb and a77df5d.

📒 Files selected for processing (2)
  • apps/webapp/app/routes/admin.api.v1.runs-replication.backfill.ts (1 hunks)
  • apps/webapp/app/services/runsBackfiller.server.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx}

📄 CodeRabbit Inference Engine (.github/copilot-instructions.md)

**/*.{ts,tsx}: Always prefer using isomorphic code like fetch, ReadableStream, etc. instead of Node.js specific code
For TypeScript, we usually use types over interfaces
Avoid enums
No default exports, use function declarations

Files:

  • apps/webapp/app/services/runsBackfiller.server.ts
  • apps/webapp/app/routes/admin.api.v1.runs-replication.backfill.ts
{packages/core,apps/webapp}/**/*.{ts,tsx}

📄 CodeRabbit Inference Engine (.github/copilot-instructions.md)

We use zod a lot in packages/core and in the webapp

Files:

  • apps/webapp/app/services/runsBackfiller.server.ts
  • apps/webapp/app/routes/admin.api.v1.runs-replication.backfill.ts
apps/webapp/**/*.{ts,tsx}

📄 CodeRabbit Inference Engine (.cursor/rules/webapp.mdc)

apps/webapp/**/*.{ts,tsx}: In the webapp, all environment variables must be accessed through the env export of env.server.ts, instead of directly accessing process.env.
When importing from @trigger.dev/core in the webapp, never import from the root @trigger.dev/core path; always use one of the subpath exports as defined in the package's package.json.

Files:

  • apps/webapp/app/services/runsBackfiller.server.ts
  • apps/webapp/app/routes/admin.api.v1.runs-replication.backfill.ts
apps/webapp/app/services/**/*.server.ts

📄 CodeRabbit Inference Engine (.cursor/rules/webapp.mdc)

For testable services, separate service logic and configuration, as exemplified by realtimeClient.server.ts (service) and realtimeClientGlobal.server.ts (configuration).

Files:

  • apps/webapp/app/services/runsBackfiller.server.ts
🧠 Learnings (2)
📓 Common learnings
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:25.014Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : When using retry, queue, machine, or maxDuration options, configure them as shown in the examples for Trigger.dev tasks.
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:25.014Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : When triggering a task from backend code, use `tasks.trigger`, `tasks.batchTrigger`, or `tasks.triggerAndPoll` as shown in the examples.
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:25.014Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : The `run` function contains your task logic in Trigger.dev tasks.
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:25.014Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : When using Realtime features, use the `runs.subscribeToRun`, `runs.subscribeToRunsWithTag`, and `runs.subscribeToBatch` APIs as shown.
📚 Learning: in apps/webapp/app/services/runsrepository.server.ts, the in-memory status filtering after fetching ...
Learnt from: matt-aitken
PR: triggerdotdev/trigger.dev#2264
File: apps/webapp/app/services/runsRepository.server.ts:172-174
Timestamp: 2025-07-12T18:06:04.133Z
Learning: In apps/webapp/app/services/runsRepository.server.ts, the in-memory status filtering after fetching runs from Prisma is intentionally used as a workaround for ClickHouse data delays. This approach is acceptable because the result set is limited to a maximum of 100 runs due to pagination, making the performance impact negligible.

Applied to files:

  • apps/webapp/app/services/runsBackfiller.server.ts
  • apps/webapp/app/routes/admin.api.v1.runs-replication.backfill.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (23)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (7, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (5, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (4, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (8, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (6, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (3, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (2, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (2, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (8, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (1, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (7, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (1, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (6, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (3, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (4, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (5, 8)
  • GitHub Check: units / packages / 🧪 Unit Tests: Packages (1, 1)
  • GitHub Check: e2e / 🧪 CLI v3 tests (ubuntu-latest - pnpm)
  • GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - pnpm)
  • GitHub Check: e2e / 🧪 CLI v3 tests (ubuntu-latest - npm)
  • GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - npm)
  • GitHub Check: typecheck / typecheck
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (2)
apps/webapp/app/services/runsBackfiller.server.ts (1)

76-81: LGTM! Data transformation aligns with interface updates.

The transformation correctly adds the masterQueue property to each run object, matching the updated RunsReplicationService interface that now expects PostgresTaskRun objects with this property.

apps/webapp/app/routes/admin.api.v1.runs-replication.backfill.ts (1)

62-67: LGTM! Consistent data transformation pattern.

The transformation matches the pattern used in the service layer, ensuring consistency across the codebase. The mapping correctly adds the required masterQueue property for the updated replication interface.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch region-triggering

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
internal-packages/database/prisma/schema.prisma (1)

338-339: Update the comment to reflect the new terminology.

The field has been renamed to allowedWorkerQueues, but the comment still refers to "master queues".

- /// The master queues they are allowed to use (impacts what they can set as default and trigger runs with)
+ /// The worker queues they are allowed to use (impacts what they can set as default and trigger runs with)
  allowedWorkerQueues String[] @default([]) @map("allowedMasterQueues")
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e46e9bd and ff81dc1.

⛔ Files ignored due to path filters (1)
  • references/hello-world/src/trigger/regions.ts is excluded by !references/**
📒 Files selected for processing (16)
  • .changeset/thick-poets-yawn.md (1 hunks)
  • apps/webapp/app/presenters/v3/RegionsPresenter.server.ts (2 hunks)
  • apps/webapp/app/presenters/v3/SpanPresenter.server.ts (3 hunks)
  • apps/webapp/app/routes/resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam.runs.$runParam.spans.$spanParam/route.tsx (2 hunks)
  • apps/webapp/app/runEngine/concerns/queues.server.ts (3 hunks)
  • apps/webapp/app/runEngine/services/triggerTask.server.ts (1 hunks)
  • apps/webapp/app/runEngine/types.ts (1 hunks)
  • apps/webapp/app/services/runsReplicationService.server.ts (6 hunks)
  • apps/webapp/app/v3/services/setDefaultRegion.server.ts (1 hunks)
  • apps/webapp/app/v3/services/worker/workerGroupService.server.ts (2 hunks)
  • internal-packages/clickhouse/schema/006_add_task_runs_v2_workerqueue.sql (1 hunks)
  • internal-packages/clickhouse/src/taskRuns.ts (1 hunks)
  • internal-packages/database/prisma/schema.prisma (1 hunks)
  • packages/core/src/v3/schemas/api.ts (2 hunks)
  • packages/core/src/v3/types/tasks.ts (1 hunks)
  • packages/trigger-sdk/src/v3/shared.ts (8 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx}

📄 CodeRabbit Inference Engine (.github/copilot-instructions.md)

**/*.{ts,tsx}: Always prefer using isomorphic code like fetch, ReadableStream, etc. instead of Node.js specific code
For TypeScript, we usually use types over interfaces
Avoid enums
No default exports, use function declarations

Files:

  • packages/core/src/v3/schemas/api.ts
  • apps/webapp/app/v3/services/setDefaultRegion.server.ts
  • apps/webapp/app/runEngine/types.ts
  • apps/webapp/app/routes/resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam.runs.$runParam.spans.$spanParam/route.tsx
  • internal-packages/clickhouse/src/taskRuns.ts
  • apps/webapp/app/runEngine/services/triggerTask.server.ts
  • apps/webapp/app/presenters/v3/RegionsPresenter.server.ts
  • packages/trigger-sdk/src/v3/shared.ts
  • apps/webapp/app/runEngine/concerns/queues.server.ts
  • apps/webapp/app/v3/services/worker/workerGroupService.server.ts
  • packages/core/src/v3/types/tasks.ts
  • apps/webapp/app/presenters/v3/SpanPresenter.server.ts
  • apps/webapp/app/services/runsReplicationService.server.ts
{packages/core,apps/webapp}/**/*.{ts,tsx}

📄 CodeRabbit Inference Engine (.github/copilot-instructions.md)

We use zod a lot in packages/core and in the webapp

Files:

  • packages/core/src/v3/schemas/api.ts
  • apps/webapp/app/v3/services/setDefaultRegion.server.ts
  • apps/webapp/app/runEngine/types.ts
  • apps/webapp/app/routes/resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam.runs.$runParam.spans.$spanParam/route.tsx
  • apps/webapp/app/runEngine/services/triggerTask.server.ts
  • apps/webapp/app/presenters/v3/RegionsPresenter.server.ts
  • apps/webapp/app/runEngine/concerns/queues.server.ts
  • apps/webapp/app/v3/services/worker/workerGroupService.server.ts
  • packages/core/src/v3/types/tasks.ts
  • apps/webapp/app/presenters/v3/SpanPresenter.server.ts
  • apps/webapp/app/services/runsReplicationService.server.ts
apps/webapp/**/*.{ts,tsx}

📄 CodeRabbit Inference Engine (.cursor/rules/webapp.mdc)

apps/webapp/**/*.{ts,tsx}: In the webapp, all environment variables must be accessed through the env export of env.server.ts, instead of directly accessing process.env.
When importing from @trigger.dev/core in the webapp, never import from the root @trigger.dev/core path; always use one of the subpath exports as defined in the package's package.json.

Files:

  • apps/webapp/app/v3/services/setDefaultRegion.server.ts
  • apps/webapp/app/runEngine/types.ts
  • apps/webapp/app/routes/resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam.runs.$runParam.spans.$spanParam/route.tsx
  • apps/webapp/app/runEngine/services/triggerTask.server.ts
  • apps/webapp/app/presenters/v3/RegionsPresenter.server.ts
  • apps/webapp/app/runEngine/concerns/queues.server.ts
  • apps/webapp/app/v3/services/worker/workerGroupService.server.ts
  • apps/webapp/app/presenters/v3/SpanPresenter.server.ts
  • apps/webapp/app/services/runsReplicationService.server.ts
apps/webapp/app/services/**/*.server.ts

📄 CodeRabbit Inference Engine (.cursor/rules/webapp.mdc)

For testable services, separate service logic and configuration, as exemplified by realtimeClient.server.ts (service) and realtimeClientGlobal.server.ts (configuration).

Files:

  • apps/webapp/app/services/runsReplicationService.server.ts
🧠 Learnings (27)
📓 Common learnings
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:25.014Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : When using retry, queue, machine, or maxDuration options, configure them as shown in the examples for Trigger.dev tasks.
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:25.014Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : When triggering a task from backend code, use `tasks.trigger`, `tasks.batchTrigger`, or `tasks.triggerAndPoll` as shown in the examples.
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:25.014Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : The `run` function contains your task logic in Trigger.dev tasks.
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:25.014Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : When using Realtime features, use the `runs.subscribeToRun`, `runs.subscribeToRunsWithTag`, and `runs.subscribeToBatch` APIs as shown.
📚 Learning: applies to **/trigger/**/*.{ts,tsx,js,jsx} : when implementing schema tasks, use `schematask` from `...
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:25.014Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : When implementing schema tasks, use `schemaTask` from `trigger.dev/sdk/v3` and validate payloads as shown.

Applied to files:

  • packages/core/src/v3/schemas/api.ts
  • apps/webapp/app/runEngine/types.ts
  • internal-packages/clickhouse/src/taskRuns.ts
  • apps/webapp/app/runEngine/services/triggerTask.server.ts
  • packages/trigger-sdk/src/v3/shared.ts
  • .changeset/thick-poets-yawn.md
  • packages/core/src/v3/types/tasks.ts
  • apps/webapp/app/presenters/v3/SpanPresenter.server.ts
📚 Learning: applies to **/trigger/**/*.{ts,tsx,js,jsx} : always generate trigger.dev tasks using the `task` func...
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:25.014Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : ALWAYS generate Trigger.dev tasks using the `task` function from `trigger.dev/sdk/v3` and export them as shown in the correct pattern.

Applied to files:

  • packages/core/src/v3/schemas/api.ts
  • apps/webapp/app/runEngine/services/triggerTask.server.ts
  • packages/trigger-sdk/src/v3/shared.ts
  • .changeset/thick-poets-yawn.md
  • packages/core/src/v3/types/tasks.ts
  • apps/webapp/app/presenters/v3/SpanPresenter.server.ts
📚 Learning: applies to **/trigger/**/*.{ts,tsx,js,jsx} : you must use `@trigger.dev/sdk/v3` when writing trigger...
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:25.014Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : You MUST use `trigger.dev/sdk/v3` when writing Trigger.dev tasks.

Applied to files:

  • packages/core/src/v3/schemas/api.ts
  • apps/webapp/app/runEngine/services/triggerTask.server.ts
  • packages/trigger-sdk/src/v3/shared.ts
  • .changeset/thick-poets-yawn.md
  • packages/core/src/v3/types/tasks.ts
  • apps/webapp/app/presenters/v3/SpanPresenter.server.ts
📚 Learning: applies to **/trigger/**/*.{ts,tsx,js,jsx} : when triggering a task from backend code, use `tasks.tr...
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:25.014Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : When triggering a task from backend code, use `tasks.trigger`, `tasks.batchTrigger`, or `tasks.triggerAndPoll` as shown in the examples.

Applied to files:

  • packages/core/src/v3/schemas/api.ts
  • apps/webapp/app/runEngine/types.ts
  • apps/webapp/app/runEngine/services/triggerTask.server.ts
  • packages/trigger-sdk/src/v3/shared.ts
  • packages/core/src/v3/types/tasks.ts
  • apps/webapp/app/services/runsReplicationService.server.ts
📚 Learning: applies to **/trigger/**/*.{ts,tsx,js,jsx} : when implementing scheduled (cron) tasks, use `schedule...
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:25.014Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : When implementing scheduled (cron) tasks, use `schedules.task` from `trigger.dev/sdk/v3` and follow the shown patterns.

Applied to files:

  • packages/core/src/v3/schemas/api.ts
  • apps/webapp/app/runEngine/services/triggerTask.server.ts
  • packages/trigger-sdk/src/v3/shared.ts
  • packages/core/src/v3/types/tasks.ts
  • apps/webapp/app/presenters/v3/SpanPresenter.server.ts
📚 Learning: applies to **/trigger/**/*.{ts,tsx,js,jsx} : when triggering a task from inside another task, use `y...
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:25.014Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : When triggering a task from inside another task, use `yourTask.trigger`, `yourTask.batchTrigger`, `yourTask.triggerAndWait`, `yourTask.batchTriggerAndWait`, `batch.triggerAndWait`, `batch.triggerByTask`, or `batch.triggerByTaskAndWait` as shown.

Applied to files:

  • packages/core/src/v3/schemas/api.ts
  • apps/webapp/app/runEngine/types.ts
  • apps/webapp/app/runEngine/services/triggerTask.server.ts
  • packages/trigger-sdk/src/v3/shared.ts
  • packages/core/src/v3/types/tasks.ts
📚 Learning: applies to **/trigger/**/*.{ts,tsx,js,jsx} : when using retry, queue, machine, or maxduration option...
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:25.014Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : When using retry, queue, machine, or maxDuration options, configure them as shown in the examples for Trigger.dev tasks.

Applied to files:

  • packages/core/src/v3/schemas/api.ts
  • apps/webapp/app/runEngine/types.ts
  • apps/webapp/app/runEngine/services/triggerTask.server.ts
  • packages/trigger-sdk/src/v3/shared.ts
  • apps/webapp/app/runEngine/concerns/queues.server.ts
  • .changeset/thick-poets-yawn.md
  • packages/core/src/v3/types/tasks.ts
  • apps/webapp/app/presenters/v3/SpanPresenter.server.ts
📚 Learning: applies to **/trigger/**/*.{ts,tsx,js,jsx} : tasks must be exported, even subtasks in the same file....
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:25.014Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : Tasks must be exported, even subtasks in the same file.

Applied to files:

  • packages/core/src/v3/schemas/api.ts
  • apps/webapp/app/runEngine/services/triggerTask.server.ts
  • packages/core/src/v3/types/tasks.ts
📚 Learning: applies to trigger.config.ts : build extensions such as `additionalfiles`, `additionalpackages`, `ap...
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:25.014Z
Learning: Applies to trigger.config.ts : Build extensions such as `additionalFiles`, `additionalPackages`, `aptGet`, `emitDecoratorMetadata`, `prismaExtension`, `syncEnvVars`, `puppeteer`, `ffmpeg`, and `esbuildPlugin` must be configured in `trigger.config.ts` as shown.

Applied to files:

  • packages/core/src/v3/schemas/api.ts
  • packages/trigger-sdk/src/v3/shared.ts
  • .changeset/thick-poets-yawn.md
  • packages/core/src/v3/types/tasks.ts
📚 Learning: applies to **/trigger/**/*.{ts,tsx,js,jsx} : you must `export` every task, including subtasks, in tr...
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:25.014Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : You MUST `export` every task, including subtasks, in Trigger.dev task files.

Applied to files:

  • packages/core/src/v3/schemas/api.ts
  • packages/core/src/v3/types/tasks.ts
  • apps/webapp/app/presenters/v3/SpanPresenter.server.ts
📚 Learning: in regionspresenter.server.ts, the final sort by name that removes the "default first" ordering is i...
Learnt from: matt-aitken
PR: triggerdotdev/trigger.dev#2354
File: apps/webapp/app/presenters/v3/RegionsPresenter.server.ts:117-131
Timestamp: 2025-08-06T14:25:20.438Z
Learning: In RegionsPresenter.server.ts, the final sort by name that removes the "default first" ordering is intentional behavior as a way to prefer the default, as clarified by matt-aitken.

Applied to files:

  • apps/webapp/app/v3/services/setDefaultRegion.server.ts
  • apps/webapp/app/presenters/v3/RegionsPresenter.server.ts
  • apps/webapp/app/presenters/v3/SpanPresenter.server.ts
📚 Learning: applies to **/trigger/**/*.{ts,tsx,js,jsx} : if you are able to generate an example payload for a ta...
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:25.014Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : If you are able to generate an example payload for a task, do so.

Applied to files:

  • apps/webapp/app/runEngine/types.ts
  • packages/trigger-sdk/src/v3/shared.ts
📚 Learning: applies to **/trigger/**/*.{ts,tsx,js,jsx} : the `run` function contains your task logic in trigger....
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:25.014Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : The `run` function contains your task logic in Trigger.dev tasks.

Applied to files:

  • apps/webapp/app/runEngine/services/triggerTask.server.ts
  • packages/trigger-sdk/src/v3/shared.ts
  • apps/webapp/app/runEngine/concerns/queues.server.ts
  • .changeset/thick-poets-yawn.md
  • packages/core/src/v3/types/tasks.ts
  • apps/webapp/app/presenters/v3/SpanPresenter.server.ts
  • apps/webapp/app/services/runsReplicationService.server.ts
📚 Learning: applies to **/trigger/**/*.{ts,tsx,js,jsx} : when using metadata in tasks, use the `metadata` api as...
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:25.014Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : When using metadata in tasks, use the `metadata` API as shown, and only inside run functions or task lifecycle hooks.

Applied to files:

  • apps/webapp/app/runEngine/services/triggerTask.server.ts
  • packages/core/src/v3/types/tasks.ts
  • apps/webapp/app/presenters/v3/SpanPresenter.server.ts
📚 Learning: applies to **/trigger/**/*.{ts,tsx,js,jsx} : when using realtime features, use the `runs.subscribeto...
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:25.014Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : When using Realtime features, use the `runs.subscribeToRun`, `runs.subscribeToRunsWithTag`, and `runs.subscribeToBatch` APIs as shown.

Applied to files:

  • apps/webapp/app/runEngine/services/triggerTask.server.ts
  • .changeset/thick-poets-yawn.md
  • apps/webapp/app/services/runsReplicationService.server.ts
📚 Learning: applies to apps/webapp/app/v3/presenters/**/*.server.ts : favor the use of 'presenters' to move comp...
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/webapp.mdc:0-0
Timestamp: 2025-07-18T17:49:47.180Z
Learning: Applies to apps/webapp/app/v3/presenters/**/*.server.ts : Favor the use of 'presenters' to move complex loader code into a class, as seen in `app/v3/presenters/**/*.server.ts`.

Applied to files:

  • apps/webapp/app/presenters/v3/RegionsPresenter.server.ts
  • apps/webapp/app/presenters/v3/SpanPresenter.server.ts
📚 Learning: applies to **/trigger/**/*.{ts,tsx,js,jsx} : never generate deprecated code patterns using `client.d...
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:25.014Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : NEVER generate deprecated code patterns using `client.defineJob` and related deprecated APIs, as shown in the prohibited code block.

Applied to files:

  • apps/webapp/app/presenters/v3/RegionsPresenter.server.ts
📚 Learning: applies to internal-packages/database/**/*.{ts,tsx} : we use prisma in internal-packages/database fo...
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-18T17:49:24.468Z
Learning: Applies to internal-packages/database/**/*.{ts,tsx} : We use prisma in internal-packages/database for our database interactions using PostgreSQL

Applied to files:

  • internal-packages/database/prisma/schema.prisma
  • apps/webapp/app/services/runsReplicationService.server.ts
📚 Learning: prisma ignores undefined values in update operations. when a field is set to undefined in a prisma u...
Learnt from: matt-aitken
PR: triggerdotdev/trigger.dev#2035
File: apps/webapp/app/v3/services/finalizeTaskRun.server.ts:99-103
Timestamp: 2025-05-12T17:23:05.574Z
Learning: Prisma ignores undefined values in update operations. When a field is set to undefined in a Prisma update operation's data object, Prisma will omit that field from the update rather than trying to set it to null or another value. This means there's no need to conditionally build update objects to exclude undefined values.

Applied to files:

  • internal-packages/database/prisma/schema.prisma
📚 Learning: prisma ignores undefined values in update operations. when a field has the value `undefined` in a pr...
Learnt from: matt-aitken
PR: triggerdotdev/trigger.dev#2035
File: apps/webapp/app/v3/services/finalizeTaskRun.server.ts:99-103
Timestamp: 2025-05-12T17:23:05.574Z
Learning: Prisma ignores undefined values in update operations. When a field has the value `undefined` in a Prisma update operation's data object, Prisma will automatically exclude that field from the update query rather than trying to set it to null. This means there's no need to manually build update objects to filter out undefined values.

Applied to files:

  • internal-packages/database/prisma/schema.prisma
📚 Learning: applies to **/trigger/**/*.{ts,tsx,js,jsx} : when using idempotency, use the `idempotencykeys` api a...
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:25.014Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : When using idempotency, use the `idempotencyKeys` API and `idempotencyKey`/`idempotencyKeyTTL` options as shown.

Applied to files:

  • packages/trigger-sdk/src/v3/shared.ts
📚 Learning: applies to trigger.config.ts : global lifecycle hooks, telemetry, runtime, machine settings, log lev...
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:25.014Z
Learning: Applies to trigger.config.ts : Global lifecycle hooks, telemetry, runtime, machine settings, log level, max duration, and build configuration must be set in `trigger.config.ts` as shown.

Applied to files:

  • packages/trigger-sdk/src/v3/shared.ts
  • .changeset/thick-poets-yawn.md
  • apps/webapp/app/presenters/v3/SpanPresenter.server.ts
📚 Learning: do not use or add new code to the legacy run engine; focus on using and migrating to run engine 2.0 ...
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/webapp.mdc:0-0
Timestamp: 2025-07-18T17:49:47.180Z
Learning: Do not use or add new code to the legacy run engine; focus on using and migrating to Run Engine 2.0 in `internal/run-engine`.

Applied to files:

  • apps/webapp/app/runEngine/concerns/queues.server.ts
  • apps/webapp/app/presenters/v3/SpanPresenter.server.ts
📚 Learning: applies to trigger.config.ts : the `trigger.config.ts` file must use `defineconfig` from `@trigger.d...
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:25.014Z
Learning: Applies to trigger.config.ts : The `trigger.config.ts` file must use `defineConfig` from `trigger.dev/sdk/v3` and follow the configuration structure shown.

Applied to files:

  • .changeset/thick-poets-yawn.md
📚 Learning: in apps/webapp/app/services/runsrepository.server.ts, the in-memory status filtering after fetching ...
Learnt from: matt-aitken
PR: triggerdotdev/trigger.dev#2264
File: apps/webapp/app/services/runsRepository.server.ts:172-174
Timestamp: 2025-07-12T18:06:04.133Z
Learning: In apps/webapp/app/services/runsRepository.server.ts, the in-memory status filtering after fetching runs from Prisma is intentionally used as a workaround for ClickHouse data delays. This approach is acceptable because the result set is limited to a maximum of 100 runs due to pagination, making the performance impact negligible.

Applied to files:

  • apps/webapp/app/presenters/v3/SpanPresenter.server.ts
  • apps/webapp/app/services/runsReplicationService.server.ts
📚 Learning: the `machinepresetname` schema is used to validate machine preset values in the trigger.dev codebase...
Learnt from: nicktrn
PR: triggerdotdev/trigger.dev#1608
File: apps/webapp/app/v3/services/triggerTask.server.ts:418-418
Timestamp: 2025-01-13T18:31:48.160Z
Learning: The `MachinePresetName` schema is used to validate machine preset values in the trigger.dev codebase, ensuring type safety and validation of machine preset options.

Applied to files:

  • apps/webapp/app/presenters/v3/SpanPresenter.server.ts
🧬 Code Graph Analysis (2)
apps/webapp/app/runEngine/types.ts (2)
internal-packages/run-engine/src/engine/tests/setup.ts (1)
  • AuthenticatedEnvironment (17-19)
internal-packages/run-engine/src/shared/index.ts (1)
  • AuthenticatedEnvironment (4-6)
apps/webapp/app/runEngine/concerns/queues.server.ts (2)
internal-packages/run-engine/src/engine/tests/setup.ts (1)
  • AuthenticatedEnvironment (17-19)
apps/webapp/app/runEngine/concerns/errors.ts (1)
  • EngineServiceValidationError (1-6)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (23)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (7, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (4, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (8, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (7, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (8, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (6, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (5, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (2, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (5, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (3, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (4, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (3, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (1, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (6, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (2, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (1, 8)
  • GitHub Check: units / packages / 🧪 Unit Tests: Packages (1, 1)
  • GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - npm)
  • GitHub Check: e2e / 🧪 CLI v3 tests (ubuntu-latest - pnpm)
  • GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - pnpm)
  • GitHub Check: e2e / 🧪 CLI v3 tests (ubuntu-latest - npm)
  • GitHub Check: typecheck / typecheck
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (33)
.changeset/thick-poets-yawn.md (1)

1-6: LGTM!

The changeset correctly documents the new region override feature as a patch release for the SDK.

internal-packages/clickhouse/src/taskRuns.ts (1)

47-47: LGTM!

The addition of the worker_queue field with a default empty string is consistent with the region override functionality and maintains backward compatibility.

apps/webapp/app/runEngine/services/triggerTask.server.ts (1)

237-237: LGTM!

The addition of the optional region parameter to getWorkerQueue correctly enables region override functionality when triggering tasks. The optional chaining handles the optional nature of the parameter appropriately.

packages/core/src/v3/types/tasks.ts (1)

858-872: LGTM! Well-documented region override feature.

The addition of the optional region property to TriggerOptions is well-implemented with comprehensive JSDoc documentation that clearly explains its purpose, usage, and limitations. The documentation includes helpful examples and important notes about development environment behavior.

apps/webapp/app/v3/services/setDefaultRegion.server.ts (1)

35-36: LGTM! Consistent property renaming.

The change from allowedMasterQueues to allowedWorkerQueues aligns with the broader refactoring to use consistent terminology for worker queues. The logic remains unchanged - properly validating that the worker group's master queue is in the project's allowed queues list.

internal-packages/clickhouse/schema/006_add_task_runs_v2_workerqueue.sql (1)

1-10: LGTM! Well-structured database migration.

The ClickHouse migration properly adds the worker_queue column with:

  • Appropriate data type (String) and default value (empty string)
  • Both up and down migration sections for rollback capability
  • Clear comments explaining the purpose

This supports the broader feature to track worker queue information in task runs.

packages/core/src/v3/schemas/api.ts (2)

137-137: LGTM! Consistent API schema extension.

The addition of the optional region field to TriggerTaskRequestBody.options follows the existing schema patterns and aligns with the TriggerOptions type definition.


185-185: LGTM! Consistent batch task schema extension.

The addition of the optional region field to BatchTriggerTaskItem.options is consistent with the TriggerTaskRequestBody schema and properly supports region override for batch operations.

apps/webapp/app/presenters/v3/RegionsPresenter.server.ts (1)

33-33: LGTM! Consistent property renaming throughout.

The changes from allowedMasterQueues to allowedWorkerQueues are consistent across the project query selection, conditional logic, and filtering operations. This aligns with the broader refactoring to use consistent worker queue terminology while preserving all existing functionality.

Also applies to: 73-73, 75-75

apps/webapp/app/routes/resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam.runs.$runParam.spans.$spanParam/route.tsx (2)

79-79: LGTM!

The import statement for FlagIcon from the region icons is correctly added and follows the established import pattern in the file.


705-717: LGTM!

The region display implementation is well-structured:

  • Proper conditional rendering prevents errors when run.region is undefined
  • Consistent with other property items in the table
  • Appropriate positioning between Machine and Run invocation cost
  • Clean flag icon integration with proper size classes
apps/webapp/app/runEngine/types.ts (1)

70-73: LGTM!

The interface update correctly adds the optional regionOverride parameter to support region-specific worker queue resolution. The parameter is properly typed and maintains backward compatibility.

apps/webapp/app/presenters/v3/SpanPresenter.server.ts (3)

2-2: LGTM!

The conversion to type-only imports is a good practice that improves build performance by avoiding unnecessary runtime imports when only types are needed.

Also applies to: 5-5, 8-8


179-193: LGTM!

The region querying logic is well-implemented:

  • Proper initialization and conditional execution
  • Sensible conditions to skip for development environments and V1 engine
  • Efficient database query selecting only necessary fields
  • Appropriate use of replica connection for read operations
  • Graceful handling of missing worker groups

252-252: LGTM!

The region property is correctly added to the return object, providing the UI layer with the necessary region information for display.

apps/webapp/app/runEngine/concerns/queues.server.ts (3)

17-17: LGTM!

The import of the tryCatch utility is appropriate for implementing explicit error handling in the getWorkerQueue method.


200-203: LGTM!

The method signature correctly implements the interface update, adding the optional regionOverride parameter while maintaining backward compatibility.


213-222: LGTM!

The error handling improvement is well-implemented:

  • Explicit error handling using tryCatch provides better control flow
  • Wrapping in EngineServiceValidationError maintains consistent error types
  • Preserves the original error message for debugging
  • Properly passes the regionOverride parameter to the service call
packages/trigger-sdk/src/v3/shared.ts (8)

630-630: LGTM! Region option properly added to batch trigger.

The change correctly propagates the optional region from item options to the API call, maintaining type safety with optional chaining.


800-800: LGTM! Consistent region support added.

The region option is properly propagated from item options to the API call, following the same pattern as other functions.


960-960: LGTM! Region option consistently implemented.

The change maintains the established pattern for region propagation in batch task triggering.


1132-1132: LGTM! Region support properly integrated.

The region option is correctly added to the batch trigger and wait tasks functionality.


1205-1205: LGTM! Region option added to internal trigger function.

The region is properly propagated from the options parameter to the API client call.


1278-1278: LGTM! Internal batch trigger supports region override.

The region option is correctly extracted from item options and passed to the API call.


1363-1363: LGTM! Region support added to trigger and wait.

The region option is properly propagated from options to the API client call in the internal trigger and wait function.


1454-1454: LGTM! Complete region support implementation.

The region option is properly added to the internal batch trigger and wait function, completing the consistent region support across all triggering mechanisms.

apps/webapp/app/v3/services/worker/workerGroupService.server.ts (3)

196-202: LGTM! Method signature properly extended.

The addition of the optional regionOverride parameter maintains backward compatibility while enabling region-specific worker group selection.


217-246: LGTM! Comprehensive region validation with excellent error handling.

The region override validation logic is well-structured and provides clear error messages:

  • Validates worker group existence
  • Enforces access control via allowedWorkerQueues
  • Handles hidden worker groups appropriately
  • Provides helpful error messages with available alternatives

203-214: Project lookup change is consistent and safe

The swap from findUnique to findFirst for fetching a project by its unique id aligns with how most services in this codebase handle project lookups (e.g., checkSchedule, setDefaultRegion, and many others use findFirst for id). Since id is inherently unique, the behavior remains correct and the added manual “Project not found” check maintains clear error handling.

No action required.

apps/webapp/app/services/runsReplicationService.server.ts (4)

62-68: LGTM! Clean type extension for region support.

The PostgresTaskRun type properly extends TaskRun with the masterQueue property, and the TaskRunInsert type is correctly updated to use the extended type.


252-252: LGTM! Method signature updated for consistency.

The backfill method parameter type is correctly updated to use PostgresTaskRun[], maintaining type consistency with the new requirements.


361-361: LGTM! Transaction handling updated for extended type.

The type cast and method signature updates properly handle the transition to PostgresTaskRun, ensuring the transaction processing can access the masterQueue property.

Also applies to: 379-379


773-773: LGTM! Worker queue field properly added to replication data.

The method signature is updated to use PostgresTaskRun and the worker_queue field is correctly populated from run.masterQueue. This enables region-specific task run tracking and filtering in ClickHouse.

Also applies to: 823-823

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
docs/triggering.mdx (2)

993-994: Fix grammatical hiccup in the closing sentence.

The phrase “or are any other data is stored” is grammatically incorrect and may confuse readers.

-The region is where your runs are executed, it does not change where the run payload, output, tags, logs, or are any other data is stored.
+The region is where your runs are executed; it does not change where the run payload, output, tags, logs, or any other data are stored.

983-989: Consider linking / enumerating valid region identifiers.

Since region accepts only specific string values (e.g. us-east-1, eu-central-1, etc.), adding either:

  1. A short inline list of currently-supported regions, or
  2. A link to the “Regions” dashboard page / reference table,

would prevent invalid inputs and reduce support questions.

Example:

You can override the default region when you trigger a run by passing one of the supported region codes (e.g. `us-east-1`, `eu-central-1`):

This keeps the docs self-contained and developer-friendly.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ff81dc1 and 7c5209b.

📒 Files selected for processing (1)
  • docs/triggering.mdx (1 hunks)
🧰 Additional context used
🧠 Learnings (13)
📓 Common learnings
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:25.014Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : When using retry, queue, machine, or maxDuration options, configure them as shown in the examples for Trigger.dev tasks.
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:25.014Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : When triggering a task from backend code, use `tasks.trigger`, `tasks.batchTrigger`, or `tasks.triggerAndPoll` as shown in the examples.
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:25.014Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : The `run` function contains your task logic in Trigger.dev tasks.
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:25.014Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : When using Realtime features, use the `runs.subscribeToRun`, `runs.subscribeToRunsWithTag`, and `runs.subscribeToBatch` APIs as shown.
📚 Learning: applies to **/trigger/**/*.{ts,tsx,js,jsx} : when triggering a task from backend code, use `tasks.tr...
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:25.014Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : When triggering a task from backend code, use `tasks.trigger`, `tasks.batchTrigger`, or `tasks.triggerAndPoll` as shown in the examples.

Applied to files:

  • docs/triggering.mdx
📚 Learning: applies to **/trigger/**/*.{ts,tsx,js,jsx} : the `run` function contains your task logic in trigger....
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:25.014Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : The `run` function contains your task logic in Trigger.dev tasks.

Applied to files:

  • docs/triggering.mdx
📚 Learning: applies to **/trigger/**/*.{ts,tsx,js,jsx} : when triggering a task from inside another task, use `y...
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:25.014Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : When triggering a task from inside another task, use `yourTask.trigger`, `yourTask.batchTrigger`, `yourTask.triggerAndWait`, `yourTask.batchTriggerAndWait`, `batch.triggerAndWait`, `batch.triggerByTask`, or `batch.triggerByTaskAndWait` as shown.

Applied to files:

  • docs/triggering.mdx
📚 Learning: applies to **/trigger/**/*.{ts,tsx,js,jsx} : when using retry, queue, machine, or maxduration option...
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:25.014Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : When using retry, queue, machine, or maxDuration options, configure them as shown in the examples for Trigger.dev tasks.

Applied to files:

  • docs/triggering.mdx
📚 Learning: applies to **/trigger/**/*.{ts,tsx,js,jsx} : when implementing scheduled (cron) tasks, use `schedule...
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:25.014Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : When implementing scheduled (cron) tasks, use `schedules.task` from `trigger.dev/sdk/v3` and follow the shown patterns.

Applied to files:

  • docs/triggering.mdx
📚 Learning: applies to **/trigger/**/*.{ts,tsx,js,jsx} : always generate trigger.dev tasks using the `task` func...
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:25.014Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : ALWAYS generate Trigger.dev tasks using the `task` function from `trigger.dev/sdk/v3` and export them as shown in the correct pattern.

Applied to files:

  • docs/triggering.mdx
📚 Learning: applies to **/trigger/**/*.{ts,tsx,js,jsx} : you must use `@trigger.dev/sdk/v3` when writing trigger...
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:25.014Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : You MUST use `trigger.dev/sdk/v3` when writing Trigger.dev tasks.

Applied to files:

  • docs/triggering.mdx
📚 Learning: applies to **/trigger/**/*.{ts,tsx,js,jsx} : when using metadata in tasks, use the `metadata` api as...
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:25.014Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : When using metadata in tasks, use the `metadata` API as shown, and only inside run functions or task lifecycle hooks.

Applied to files:

  • docs/triggering.mdx
📚 Learning: applies to **/trigger/**/*.{ts,tsx,js,jsx} : when implementing schema tasks, use `schematask` from `...
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:25.014Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : When implementing schema tasks, use `schemaTask` from `trigger.dev/sdk/v3` and validate payloads as shown.

Applied to files:

  • docs/triggering.mdx
📚 Learning: applies to trigger.config.ts : build extensions such as `additionalfiles`, `additionalpackages`, `ap...
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:25.014Z
Learning: Applies to trigger.config.ts : Build extensions such as `additionalFiles`, `additionalPackages`, `aptGet`, `emitDecoratorMetadata`, `prismaExtension`, `syncEnvVars`, `puppeteer`, `ffmpeg`, and `esbuildPlugin` must be configured in `trigger.config.ts` as shown.

Applied to files:

  • docs/triggering.mdx
📚 Learning: applies to **/trigger/**/*.{ts,tsx,js,jsx} : if you are able to generate an example payload for a ta...
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:25.014Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : If you are able to generate an example payload for a task, do so.

Applied to files:

  • docs/triggering.mdx
📚 Learning: applies to **/trigger/**/*.{ts,tsx,js,jsx} : when using realtime features, use the `runs.subscribeto...
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:25.014Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : When using Realtime features, use the `runs.subscribeToRun`, `runs.subscribeToRunsWithTag`, and `runs.subscribeToBatch` APIs as shown.

Applied to files:

  • docs/triggering.mdx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (23)
  • GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - pnpm)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (4, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (5, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (6, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (7, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (2, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (8, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (1, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (3, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (4, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (6, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (8, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (7, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (3, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (2, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (5, 8)
  • GitHub Check: e2e / 🧪 CLI v3 tests (ubuntu-latest - npm)
  • GitHub Check: e2e / 🧪 CLI v3 tests (ubuntu-latest - pnpm)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (1, 8)
  • GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - npm)
  • GitHub Check: units / packages / 🧪 Unit Tests: Packages (1, 1)
  • GitHub Check: typecheck / typecheck
  • GitHub Check: Analyze (javascript-typescript)

@matt-aitken matt-aitken merged commit af14621 into main Aug 7, 2025
32 checks passed
@matt-aitken matt-aitken deleted the region-triggering branch August 7, 2025 11:41
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.

2 participants