| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:2c8609b8-9690-13af-3138-644c29debbd6 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | E0B0:163D8C:737D12:AAD820:6AFAF6AA |
| html-safe-nonce | 26b741b4aae66e1759b0afebfae6b856791438030ac215f281fb198aa10a17e1 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMEIwOjE2M0Q4Qzo3MzdEMTI6QUFEODIwOjZBRkFGNkFBIiwidmlzaXRvcl9pZCI6IjEwMTA3Mzk4MDUyMjgyOTk5NDYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 82bde09940f4dccb9eddcf481886d91759383c61907cea01453db0c7ff47864d |
| hovercard-subject-tag | pull_request:4182888787 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | ///pull_requests/show/files |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/triggerdotdev/trigger.dev/pull/4452/files |
| twitter:image | https://avatars.githubusercontent.com/u/534?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/534?s=400&v=4 |
| og:image:alt | Summary
Resolving "the most recent background worker for this environment" was ordered by id, which Postgres serves by scanning the primary key backwards and betting it finds a row for th... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 0178036d8230524a18422872393ab7e708443ae4c2047f758560a2db870c1913 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/triggerdotdev/trigger.dev git https://github.com/triggerdotdev/trigger.dev.git |
| octolytics-dimension-user_id | 95297378 |
| octolytics-dimension-user_login | triggerdotdev |
| octolytics-dimension-repository_id | 572570113 |
| octolytics-dimension-repository_nwo | triggerdotdev/trigger.dev |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 572570113 |
| octolytics-dimension-repository_network_root_nwo | triggerdotdev/trigger.dev |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | a85e96a83bed7871993e6b1ffda24105928eee17 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| Skip to content | https://github.com/triggerdotdev/trigger.dev/pull/4452/files#start-of-content |
| https://github.com/ |
| Sign in | https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Ftriggerdotdev%2Ftrigger.dev%2Fpull%2F4452%2Ffiles |
| GitHubRepository hosting, code review, and collaboration | https://github.com/platform |
| CopilotAI coding agent for tasks, projects, and automated work | https://github.com/features/copilot |
| ActionsCI/CD and automation | https://github.com/features/actions |
| Code QualityQuality analysis, fixes, and enforcement | https://github.com/features/code-quality |
| CodespacesCloud development environments | https://github.com/features/codespaces |
| Code SecurityVulnerability detection and remediation | https://github.com/security/advanced-security/code-security |
| Secret ProtectionSecret scanning and leak prevention | https://github.com/security/advanced-security/secret-protection |
| All Features | https://github.com/features |
| Documentation | https://docs.github.com/en |
| Training | https://learn.github.com/skills |
| Certifications | https://learn.github.com/credentials |
| Build with Copilot | https://github.com/features/ai |
| Customize Copilot | https://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview |
| Integrations | https://github.com/marketplace |
| Trending repos | https://github.com/trending |
| GitHub Sponsors | https://github.com/open-source/sponsors |
| Developer articles | https://github.com/resources/articles |
| ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place. | https://github.blog/changelog/ |
| Enterprises | https://github.com/enterprise |
| Team | https://github.com/team |
| Startups | https://github.com/enterprise/startups |
| Nonprofits | https://github.com/solutions/industry/nonprofits |
| Healthcare | https://github.com/solutions/industry/healthcare |
| Financial services | https://github.com/solutions/industry/financial-services |
| Manufacturing | https://github.com/solutions/industry/manufacturing |
| Government | https://github.com/solutions/industry/government |
| See all industries | https://github.com/solutions/industry |
| Why GitHub | https://github.com/why-github |
| Customer Stories | https://github.com/customer-stories |
| Business insights | https://github.com/solutions/executive-insights |
| Trust Center | https://github.com/trust-center |
| GitHub Advanced SecurityEnterprise-grade code security | https://github.com/security/advanced-security |
| Copilot for businessEnterprise-grade AI features | https://github.com/features/copilot/copilot-business |
| Premium SupportEnterprise-grade 24/7 support | https://github.com/enterprise/premium-support |
| Documentation | https://docs.github.com/en |
| Resource center | https://github.com/resources |
| Blog | https://github.blog/ |
| Events & webinars | https://github.com/resources/events |
| Community Forum | https://github.com/orgs/community/discussions |
| Customer Stories | https://github.com/customer-stories |
| Integrations | https://github.com/marketplace |
| Customer support | https://help.github.com/ |
| Training | https://learn.github.com/skills |
| GitHub Status | https://www.githubstatus.com/ |
| About | https://github.com/about |
| Partners | https://github.com/partners |
| Changelog | https://github.blog/changelog/ |
| GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub. | https://githubuniverse.com/ |
| Pricing | https://github.com/pricing |
| Sign in | https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Ftriggerdotdev%2Ftrigger.dev%2Fpull%2F4452%2Ffiles |
| Sign up | https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=triggerdotdev%2Ftrigger.dev |
| Reload | https://github.com/triggerdotdev/trigger.dev/pull/4452/files |
| Reload | https://github.com/triggerdotdev/trigger.dev/pull/4452/files |
| Reload | https://github.com/triggerdotdev/trigger.dev/pull/4452/files |
| triggerdotdev | https://github.com/triggerdotdev |
| trigger.dev | https://github.com/triggerdotdev/trigger.dev |
| Code | https://github.com/triggerdotdev/trigger.dev |
| Issues203 (203) | https://github.com/triggerdotdev/trigger.dev/issues |
| Pull requests67 (67) | https://github.com/triggerdotdev/trigger.dev/pulls |
| Discussions | https://github.com/triggerdotdev/trigger.dev/discussions |
| Actions | https://github.com/triggerdotdev/trigger.dev/actions |
| Projects | https://github.com/triggerdotdev/trigger.dev/projects |
| Security and quality39 (39) | https://github.com/triggerdotdev/trigger.dev/security |
| Insights | https://github.com/triggerdotdev/trigger.dev/pulse |
| Sign up for GitHub
| https://github.com/signup?return_to=%2Ftriggerdotdev%2Ftrigger.dev%2Fissues%2Fnew%2Fchoose |
| terms of service | https://docs.github.com/terms |
| privacy statement | https://docs.github.com/privacy |
| Sign in | https://github.com/login?return_to=%2Ftriggerdotdev%2Ftrigger.dev%2Fissues%2Fnew%2Fchoose |
| ericallam | https://github.com/ericallam |
| main | https://github.com/triggerdotdev/trigger.dev/tree/main |
| feature/tri-12808-order-backgroundworker-most-recent-worker-lookup-by | https://github.com/triggerdotdev/trigger.dev/tree/feature/tri-12808-order-backgroundworker-most-recent-worker-lookup-by |
|
Conversation
12
| https://github.com/triggerdotdev/trigger.dev/pull/4452 |
|
Commits
2
| https://github.com/triggerdotdev/trigger.dev/pull/4452/commits |
|
Checks
62
| https://github.com/triggerdotdev/trigger.dev/pull/4452/checks |
|
Files changed
| https://github.com/triggerdotdev/trigger.dev/pull/4452/files |
| Please reload this page | https://github.com/triggerdotdev/trigger.dev/pull/4452/files |
|
perf(webapp,run-engine,database): resolve the newest worker and deployment by createdAt
| https://github.com/triggerdotdev/trigger.dev/pull/4452/files#top |
|
Show all changes
2 commits
| https://github.com/triggerdotdev/trigger.dev/pull/4452/files |
|
dc20f17
perf(webapp,run-engine,database): resolve the newest worker and deplo…
ericallam Aug 1, 2026
| https://github.com/triggerdotdev/trigger.dev/pull/4452/commits/dc20f17ffbd4184da1850d1fab0f61fc9d1c14f1 |
|
e93a16d
fix(webapp): honor the caller's prisma client in the latest-deploymen…
ericallam Aug 1, 2026
| https://github.com/triggerdotdev/trigger.dev/pull/4452/commits/e93a16dd9b11bfe857f1ce7fb3da33a2af044a83 |
|
Clear filters
| https://github.com/triggerdotdev/trigger.dev/pull/4452/files |
| Please reload this page | https://github.com/triggerdotdev/trigger.dev/pull/4452/files |
| Please reload this page | https://github.com/triggerdotdev/trigger.dev/pull/4452/files |
|
worker-deployment-lookup-ordering.md
| https://github.com/triggerdotdev/trigger.dev/pull/4452/files#diff-b62a96e6f9363a53c3f5f3595c99cca798dfe0e1689a1e1ff2f17537538015da |
|
clickhouseRunsRepository.server.ts
| https://github.com/triggerdotdev/trigger.dev/pull/4452/files#diff-b3e045298340b0254d793fedcaba256747de056bcdd523bdc467b2987a394968 |
|
workerDeployment.server.ts
| https://github.com/triggerdotdev/trigger.dev/pull/4452/files#diff-31023221e76274768c3eef882a1853dfcb7e4bf659cac6756de5f1960f833435 |
|
controlPlaneResolver.server.ts
| https://github.com/triggerdotdev/trigger.dev/pull/4452/files#diff-479d8e8c279a248c65282529b06c3110fe74321a2346eb5154e723b54d43d228 |
|
controlPlaneResolver.server.test.ts
| https://github.com/triggerdotdev/trigger.dev/pull/4452/files#diff-af9e4872cff17cd16d747946864296b2389b00ff05c5893522696d4018962ee9 |
|
migration.sql
| https://github.com/triggerdotdev/trigger.dev/pull/4452/files#diff-ae558628118fb6d9260583c5ab8afe92e977afcc598e2e1bc9e968940f5b687b |
|
schema.prisma
| https://github.com/triggerdotdev/trigger.dev/pull/4452/files#diff-6b8eefc1da429865c9493bbac9d2c4d00d1cfe2f2231f6474b9692f13b88e419 |
|
controlPlaneResolver.ts
| https://github.com/triggerdotdev/trigger.dev/pull/4452/files#diff-05ad30041d1f8aba6f497a3b3bd12d9fb4d5b27d64f21ffc5c3b91c4cceeb857 |
|
dequeueSystem.controlPlaneResolver.test.ts
| https://github.com/triggerdotdev/trigger.dev/pull/4452/files#diff-97541d4277ac20f0cd0fb4a10c558ef850b6ee55bc271a4bd8c06c71afa36f75 |
| .server-changes/worker-deployment-lookup-ordering.md | https://github.com/triggerdotdev/trigger.dev/pull/4452/files#diff-b62a96e6f9363a53c3f5f3595c99cca798dfe0e1689a1e1ff2f17537538015da |
|
View file
| https://github.com/triggerdotdev/trigger.dev/blob/e93a16dd9b11bfe857f1ce7fb3da33a2af044a83/.server-changes/worker-deployment-lookup-ordering.md |
|
Open in desktop
| https://desktop.github.com |
| https://github.co/hiddenchars |
| https://github.com/triggerdotdev/trigger.dev/pull/4452/{{ revealButtonHref }} |
| apps/webapp/app/services/runsRepository/clickhouseRunsRepository.server.ts | https://github.com/triggerdotdev/trigger.dev/pull/4452/files#diff-b3e045298340b0254d793fedcaba256747de056bcdd523bdc467b2987a394968 |
|
View file
| https://github.com/triggerdotdev/trigger.dev/blob/e93a16dd9b11bfe857f1ce7fb3da33a2af044a83/apps/webapp/app/services/runsRepository/clickhouseRunsRepository.server.ts |
|
Open in desktop
| https://desktop.github.com |
| https://github.co/hiddenchars |
| https://github.com/triggerdotdev/trigger.dev/pull/4452/{{ revealButtonHref }} |
|
| https://github.com/triggerdotdev/trigger.dev/pull/4452/files#diff-b3e045298340b0254d793fedcaba256747de056bcdd523bdc467b2987a394968 |
|
| https://github.com/triggerdotdev/trigger.dev/pull/4452/files#diff-b3e045298340b0254d793fedcaba256747de056bcdd523bdc467b2987a394968 |
| apps/webapp/app/v3/models/workerDeployment.server.ts | https://github.com/triggerdotdev/trigger.dev/pull/4452/files#diff-31023221e76274768c3eef882a1853dfcb7e4bf659cac6756de5f1960f833435 |
|
View file
| https://github.com/triggerdotdev/trigger.dev/blob/e93a16dd9b11bfe857f1ce7fb3da33a2af044a83/apps/webapp/app/v3/models/workerDeployment.server.ts |
|
Open in desktop
| https://desktop.github.com |
| https://github.co/hiddenchars |
| https://github.com/triggerdotdev/trigger.dev/pull/4452/{{ revealButtonHref }} |
|
| https://github.com/triggerdotdev/trigger.dev/pull/4452/files#diff-31023221e76274768c3eef882a1853dfcb7e4bf659cac6756de5f1960f833435 |
| Please reload this page | https://github.com/triggerdotdev/trigger.dev/pull/4452/files |
| Please reload this page | https://github.com/triggerdotdev/trigger.dev/pull/4452/files |
|
| https://github.com/triggerdotdev/trigger.dev/pull/4452/files#diff-31023221e76274768c3eef882a1853dfcb7e4bf659cac6756de5f1960f833435 |
| apps/webapp/app/v3/runOpsMigration/controlPlaneResolver.server.ts | https://github.com/triggerdotdev/trigger.dev/pull/4452/files#diff-479d8e8c279a248c65282529b06c3110fe74321a2346eb5154e723b54d43d228 |
|
View file
| https://github.com/triggerdotdev/trigger.dev/blob/e93a16dd9b11bfe857f1ce7fb3da33a2af044a83/apps/webapp/app/v3/runOpsMigration/controlPlaneResolver.server.ts |
|
Open in desktop
| https://desktop.github.com |
| https://github.co/hiddenchars |
| https://github.com/triggerdotdev/trigger.dev/pull/4452/{{ revealButtonHref }} |
|
| https://github.com/triggerdotdev/trigger.dev/pull/4452/files#diff-479d8e8c279a248c65282529b06c3110fe74321a2346eb5154e723b54d43d228 |
|
| https://github.com/triggerdotdev/trigger.dev/pull/4452/files#diff-479d8e8c279a248c65282529b06c3110fe74321a2346eb5154e723b54d43d228 |
|
| https://github.com/triggerdotdev/trigger.dev/pull/4452/files#diff-479d8e8c279a248c65282529b06c3110fe74321a2346eb5154e723b54d43d228 |
|
| https://github.com/triggerdotdev/trigger.dev/pull/4452/files#diff-479d8e8c279a248c65282529b06c3110fe74321a2346eb5154e723b54d43d228 |
| apps/webapp/test/v3/runOpsMigration/controlPlaneResolver.server.test.ts | https://github.com/triggerdotdev/trigger.dev/pull/4452/files#diff-af9e4872cff17cd16d747946864296b2389b00ff05c5893522696d4018962ee9 |
|
View file
| https://github.com/triggerdotdev/trigger.dev/blob/e93a16dd9b11bfe857f1ce7fb3da33a2af044a83/apps/webapp/test/v3/runOpsMigration/controlPlaneResolver.server.test.ts |
|
Open in desktop
| https://desktop.github.com |
| https://github.co/hiddenchars |
| https://github.com/triggerdotdev/trigger.dev/pull/4452/{{ revealButtonHref }} |
|
| https://github.com/triggerdotdev/trigger.dev/pull/4452/files#diff-af9e4872cff17cd16d747946864296b2389b00ff05c5893522696d4018962ee9 |
|
| https://github.com/triggerdotdev/trigger.dev/pull/4452/files#diff-af9e4872cff17cd16d747946864296b2389b00ff05c5893522696d4018962ee9 |
|
| https://github.com/triggerdotdev/trigger.dev/pull/4452/files#diff-af9e4872cff17cd16d747946864296b2389b00ff05c5893522696d4018962ee9 |
|
| https://github.com/triggerdotdev/trigger.dev/pull/4452/files#diff-af9e4872cff17cd16d747946864296b2389b00ff05c5893522696d4018962ee9 |
|
| https://github.com/triggerdotdev/trigger.dev/pull/4452/files#diff-af9e4872cff17cd16d747946864296b2389b00ff05c5893522696d4018962ee9 |
|
| https://github.com/triggerdotdev/trigger.dev/pull/4452/files#diff-af9e4872cff17cd16d747946864296b2389b00ff05c5893522696d4018962ee9 |
| ...ations/20260731160000_add_worker_deployment_environment_id_created_at_index/migration.sql | https://github.com/triggerdotdev/trigger.dev/pull/4452/files#diff-ae558628118fb6d9260583c5ab8afe92e977afcc598e2e1bc9e968940f5b687b |
|
View file
| https://github.com/triggerdotdev/trigger.dev/blob/e93a16dd9b11bfe857f1ce7fb3da33a2af044a83/internal-packages/database/prisma/migrations/20260731160000_add_worker_deployment_environment_id_created_at_index/migration.sql |
|
Open in desktop
| https://desktop.github.com |
| https://github.co/hiddenchars |
| https://github.com/triggerdotdev/trigger.dev/pull/4452/{{ revealButtonHref }} |
| internal-packages/database/prisma/schema.prisma | https://github.com/triggerdotdev/trigger.dev/pull/4452/files#diff-6b8eefc1da429865c9493bbac9d2c4d00d1cfe2f2231f6474b9692f13b88e419 |
|
View file
| https://github.com/triggerdotdev/trigger.dev/blob/e93a16dd9b11bfe857f1ce7fb3da33a2af044a83/internal-packages/database/prisma/schema.prisma |
|
Open in desktop
| https://desktop.github.com |
| https://github.co/hiddenchars |
| https://github.com/triggerdotdev/trigger.dev/pull/4452/{{ revealButtonHref }} |
|
| https://github.com/triggerdotdev/trigger.dev/pull/4452/files#diff-6b8eefc1da429865c9493bbac9d2c4d00d1cfe2f2231f6474b9692f13b88e419 |
| Please reload this page | https://github.com/triggerdotdev/trigger.dev/pull/4452/files |
|
| https://github.com/triggerdotdev/trigger.dev/pull/4452/files#diff-6b8eefc1da429865c9493bbac9d2c4d00d1cfe2f2231f6474b9692f13b88e419 |
| internal-packages/run-engine/src/engine/controlPlaneResolver.ts | https://github.com/triggerdotdev/trigger.dev/pull/4452/files#diff-05ad30041d1f8aba6f497a3b3bd12d9fb4d5b27d64f21ffc5c3b91c4cceeb857 |
|
View file
| https://github.com/triggerdotdev/trigger.dev/blob/e93a16dd9b11bfe857f1ce7fb3da33a2af044a83/internal-packages/run-engine/src/engine/controlPlaneResolver.ts |
|
Open in desktop
| https://desktop.github.com |
| https://github.co/hiddenchars |
| https://github.com/triggerdotdev/trigger.dev/pull/4452/{{ revealButtonHref }} |
|
| https://github.com/triggerdotdev/trigger.dev/pull/4452/files#diff-05ad30041d1f8aba6f497a3b3bd12d9fb4d5b27d64f21ffc5c3b91c4cceeb857 |
|
| https://github.com/triggerdotdev/trigger.dev/pull/4452/files#diff-05ad30041d1f8aba6f497a3b3bd12d9fb4d5b27d64f21ffc5c3b91c4cceeb857 |
|
| https://github.com/triggerdotdev/trigger.dev/pull/4452/files#diff-05ad30041d1f8aba6f497a3b3bd12d9fb4d5b27d64f21ffc5c3b91c4cceeb857 |
|
| https://github.com/triggerdotdev/trigger.dev/pull/4452/files#diff-05ad30041d1f8aba6f497a3b3bd12d9fb4d5b27d64f21ffc5c3b91c4cceeb857 |
| Please reload this page | https://github.com/triggerdotdev/trigger.dev/pull/4452/files |
|
| https://github.com/triggerdotdev/trigger.dev/pull/4452/files#diff-05ad30041d1f8aba6f497a3b3bd12d9fb4d5b27d64f21ffc5c3b91c4cceeb857 |
| internal-packages/run-engine/src/engine/tests/dequeueSystem.controlPlaneResolver.test.ts | https://github.com/triggerdotdev/trigger.dev/pull/4452/files#diff-97541d4277ac20f0cd0fb4a10c558ef850b6ee55bc271a4bd8c06c71afa36f75 |
|
View file
| https://github.com/triggerdotdev/trigger.dev/blob/e93a16dd9b11bfe857f1ce7fb3da33a2af044a83/internal-packages/run-engine/src/engine/tests/dequeueSystem.controlPlaneResolver.test.ts |
|
Open in desktop
| https://desktop.github.com |
| https://github.co/hiddenchars |
| https://github.com/triggerdotdev/trigger.dev/pull/4452/{{ revealButtonHref }} |
|
| https://github.com/triggerdotdev/trigger.dev/pull/4452/files#diff-97541d4277ac20f0cd0fb4a10c558ef850b6ee55bc271a4bd8c06c71afa36f75 |
| Please reload this page | https://github.com/triggerdotdev/trigger.dev/pull/4452/files |
|
| https://github.com |
| Terms | https://docs.github.com/site-policy/github-terms/github-terms-of-service |
| Privacy | https://docs.github.com/site-policy/privacy-policies/github-privacy-statement |
| Security | https://github.com/security |
| Status | https://www.githubstatus.com/ |
| Community | https://github.community/ |
| Docs | https://docs.github.com/ |
| Contact | https://support.github.com?tags=dotcom-footer |