Skip to content

feat(webapp): add region override to the bulk replay action#4022

Draft
matt-aitken wants to merge 1 commit into
mainfrom
feature/bulk-replay-region
Draft

feat(webapp): add region override to the bulk replay action#4022
matt-aitken wants to merge 1 commit into
mainfrom
feature/bulk-replay-region

Conversation

@matt-aitken

Copy link
Copy Markdown
Member

Summary

When replaying runs in bulk from a deployed environment, you can now choose which region the replayed runs run in. The bulk action inspector shows an "Override region" dropdown that defaults to "Don't override", which keeps each run in its original region, so replaying a selection that spans multiple regions doesn't silently re-route anything. Pick a region and every matched run is replayed there instead.

The dropdown only appears for the replay action in a deployed environment with more than one region available; cancel actions and development environments don't show it.

Design

The selected region is carried through the bulk action as a dedicated replayRegion param, kept separate from the run-list selection filters so it can't be confused with a region selection filter. When the action runs, each replay passes it through to the existing region override on the replay service, which already falls back to each run's original region when no override is set. "Don't override" is a sentinel value that the action normalizes away so the service only ever sees a real region or nothing.

@changeset-bot

changeset-bot Bot commented Jun 22, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: a8fb134

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

This PR includes changesets to release 27 packages
Name Type
@trigger.dev/core Patch
trigger.dev Patch
@trigger.dev/build Patch
@trigger.dev/plugins Patch
@trigger.dev/python Patch
@trigger.dev/redis-worker Patch
@trigger.dev/schema-to-json Patch
@trigger.dev/sdk Patch
@internal/cache Patch
@internal/clickhouse Patch
@internal/llm-model-catalog Patch
@trigger.dev/rbac Patch
@internal/redis Patch
@internal/replication Patch
@internal/run-engine Patch
@internal/run-store Patch
@internal/schedule-engine Patch
@trigger.dev/sso Patch
@internal/testcontainers Patch
@internal/tracing Patch
@internal/tsql Patch
@internal/zod-worker Patch
@internal/sdk-compat-tests Patch
@trigger.dev/react-hooks Patch
@trigger.dev/rsc Patch
@trigger.dev/database Patch
@trigger.dev/otlp-importer Patch

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

@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 3615178c-af51-4d34-a9ed-cca3143c250d

📥 Commits

Reviewing files that changed from the base of the PR and between d74adf4 and a8fb134.

📒 Files selected for processing (3)
  • .server-changes/bulk-replay-region-override.md
  • apps/webapp/app/routes/resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam.runs.bulkaction.tsx
  • apps/webapp/app/v3/services/bulk/BulkActionV2.server.ts
✅ Files skipped from review due to trivial changes (1)
  • .server-changes/bulk-replay-region-override.md
🚧 Files skipped from review as they are similar to previous changes (2)
  • apps/webapp/app/routes/resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam.runs.bulkaction.tsx
  • apps/webapp/app/v3/services/bulk/BulkActionV2.server.ts
📜 Recent review details
⏰ Context from checks skipped due to timeout. (3)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (8, 10)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (4, 10)
  • GitHub Check: typecheck / typecheck

Walkthrough

The pull request adds an optional "Override region" feature to bulk replay actions. BulkActionService.create now computes a replayRegion from the incoming payload and persists it within the params object stored in the database. BulkActionService.process reads this value back and passes it as the region argument to ReplayTaskRunService. On the route side, the loader fetches available regions via RegionsPresenter in parallel with the existing presenter, the CreateBulkActionPayload schema gains an optional region field, and the action normalizes the replay sentinel to undefined before calling the service. The UI conditionally renders a region dropdown when the selected action is replay, the environment is not DEVELOPMENT, and more than one region exists.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers summary and design, but it omits the required issue, checklist, testing, changelog, and screenshots sections. Add the template sections with an issue reference, checklist items, testing steps, a short changelog, and screenshots or note why they are unavailable.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding region override support to bulk replay actions.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/bulk-replay-region

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed: private package registry requires authentication. Disable ESLint in CodeRabbit settings or use public packages.


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

Comment @coderabbitai help to get the list of available commands.

devin-ai-integration[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

@matt-aitken matt-aitken force-pushed the feature/bulk-replay-region branch from cbfa6fa to d74adf4 Compare June 23, 2026 01:55
@pkg-pr-new

pkg-pr-new Bot commented Jun 23, 2026

Copy link
Copy Markdown

Open in StackBlitz

@trigger.dev/build

npm i https://pkg.pr.new/@trigger.dev/build@a8fb134

trigger.dev

npm i https://pkg.pr.new/trigger.dev@a8fb134

@trigger.dev/core

npm i https://pkg.pr.new/@trigger.dev/core@a8fb134

@trigger.dev/python

npm i https://pkg.pr.new/@trigger.dev/python@a8fb134

@trigger.dev/react-hooks

npm i https://pkg.pr.new/@trigger.dev/react-hooks@a8fb134

@trigger.dev/redis-worker

npm i https://pkg.pr.new/@trigger.dev/redis-worker@a8fb134

@trigger.dev/rsc

npm i https://pkg.pr.new/@trigger.dev/rsc@a8fb134

@trigger.dev/schema-to-json

npm i https://pkg.pr.new/@trigger.dev/schema-to-json@a8fb134

@trigger.dev/sdk

npm i https://pkg.pr.new/@trigger.dev/sdk@a8fb134

commit: a8fb134

devin-ai-integration[bot]

This comment was marked as resolved.

@matt-aitken matt-aitken force-pushed the feature/bulk-replay-region branch from d74adf4 to cbfa6fa Compare June 23, 2026 11:51
@matt-aitken matt-aitken changed the base branch from main to prod June 23, 2026 11:57
@matt-aitken matt-aitken deleted the branch main June 23, 2026 11:59
@matt-aitken matt-aitken reopened this Jun 23, 2026
@matt-aitken matt-aitken changed the base branch from prod to prod-954ee5c June 23, 2026 12:00
devin-ai-integration[bot]

This comment was marked as resolved.

@matt-aitken matt-aitken force-pushed the feature/bulk-replay-region branch from cbfa6fa to 17990e0 Compare June 23, 2026 12:07
When replaying runs in bulk from a deployed environment, you can now choose
which region the replayed runs run in. The inspector shows an "Override
region" dropdown that defaults to "Don't override", which keeps each run in
its original region, so replaying a selection that spans multiple regions
doesn't silently re-route anything. Pick a region and every matched run is
replayed there instead.
@ericallam ericallam force-pushed the feature/bulk-replay-region branch from 17990e0 to a8fb134 Compare June 24, 2026 15:06
@ericallam ericallam changed the base branch from prod-954ee5c to main June 24, 2026 15:06
@ericallam ericallam marked this pull request as draft June 24, 2026 15:06
@github-actions

Copy link
Copy Markdown
Contributor

🧭 Helm Chart Prerelease Published

Version: 4.5.0-rc.7-pr4022.a8fb134

Install:

helm upgrade --install trigger \
  oci://ghcr.io/triggerdotdev/charts/trigger \
  --version "4.5.0-rc.7-pr4022.a8fb134"

⚠️ This is a prerelease for testing. Do not use in production.

@devin-ai-integration devin-ai-integration 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.

Devin Review found 1 new potential issue.

View 1 additional finding in Devin Review.

Open in Devin Review

Comment on lines +87 to +99
const [data, regionsResult] = await Promise.all([
presenter.call({
organizationId: project.organizationId,
projectId: project.id,
environmentId: environment.id,
request,
}),
new RegionsPresenter().call({
userId: user.id,
projectSlug: projectParam,
isAdmin: user.admin || user.isImpersonating,
}),
]);

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.

🟡 RegionsPresenter failure in Promise.all blocks cancel bulk-action flow

The loader now calls RegionsPresenter via Promise.all alongside the existing CreateBulkActionPresenter (bulkaction.tsx:87-99). RegionsPresenter.call() can throw (e.g., RegionsPresenter.server.ts:65-66 when defaultWorkerInstanceGroupId feature flag is not set). Because Promise.all rejects on the first failure, a RegionsPresenter error will prevent the entire bulk-action inspector from loading — including the cancel flow, which has no dependency on regions. Before this PR the loader never depended on regions, so this is a regression: self-hosted instances or environments without the feature flag configured will lose access to both cancel and replay bulk actions.

Prompt for agents
In the loader, the RegionsPresenter.call() is invoked inside Promise.all alongside the existing CreateBulkActionPresenter.call(). If RegionsPresenter throws (e.g. missing defaultWorkerInstanceGroupId feature flag), the entire loader fails, breaking both cancel and replay bulk action flows.

The fix should catch the RegionsPresenter error and fall back to an empty regions array so the bulk action inspector degrades gracefully (region selector hidden, cancel flow unaffected).

One approach: wrap the RegionsPresenter call with tryCatch (already imported in this file from @trigger.dev/core) or a try/catch, and default to { regions: [] } on failure. For example:

const [regionsError, regionsResult] = await tryCatch(new RegionsPresenter().call({...}));
const regions = regionsError ? [] : regionsResult.regions;

Then use `regions` directly in the typedjson return instead of regionsResult.regions.
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

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