René's URL Explorer Experiment


Title: perf(run-engine): merge dequeue snapshot creation into taskRun.update transaction [TRI-8450] by devin-ai-integration[bot] · Pull Request #3395 · triggerdotdev/trigger.dev · GitHub

Open Graph Title: perf(run-engine): merge dequeue snapshot creation into taskRun.update transaction [TRI-8450] by devin-ai-integration[bot] · Pull Request #3395 · triggerdotdev/trigger.dev

X Title: perf(run-engine): merge dequeue snapshot creation into taskRun.update transaction [TRI-8450] by devin-ai-integration[bot] · Pull Request #3395 · triggerdotdev/trigger.dev

Description: Summary Nests the TaskRunExecutionSnapshot creation inside the taskRun.update() Prisma call in the dequeue flow, reducing 2 DB commits → 1 per dequeue operation. This is the highest-volume of the five unmerged flows identified in TRI-8450 (~9,200 commits/sec on the engine service). Pattern: Follows the same nested-write approach already used in the completion path (runAttemptSystem.ts:735) and trigger path (engine/index.ts:674). Changes: dequeueSystem.ts: Moved snapshot creation into executionSnapshots: { create: {...} } within the existing taskRun.update(). Pre-generates the snapshot ID via generateInternalId() (plain cuid, matching what Prisma's @default(cuid()) produces) so the event emission, heartbeat enqueue, and return value can all be constructed from data already in scope — no extra DB read needed after the merged write. SnapshotId.toFriendlyId() is used only for the return value's friendlyId field, matching the original createExecutionSnapshot behavior. executionSnapshotSystem.ts: Added public enqueueHeartbeatIfNeeded() method that exposes the heartbeat scheduling logic (previously only available internally via createExecutionSnapshot). This is needed because PENDING_EXECUTING requires a heartbeat, unlike the FINISHED status in the completion reference pattern. This method is reusable by future merge targets (retry-immediate, checkpoint, cancel, requeue). Net DB change per dequeue: eliminates 1 write transaction (the separate TaskRunExecutionSnapshot.create). No extra reads added — the snapshot ID is pre-generated and the executionSnapshotCreated event payload is constructed inline from values already available in the closure. Review & Testing Checklist for Human Verify manually-constructed event payload matches DB state: The executionSnapshotCreated event is now built inline (not read back from DB). Confirm the field values (runStatus: "PENDING", attemptNumber, checkpointId, workerId, runnerId, completedWaitpointIds) match what Prisma actually writes. A mismatch here would be silent — event consumers would get stale/wrong data. Verify attemptNumber source is equivalent: Old code used lockedTaskRun.attemptNumber (post-update result). New code uses result.run.attemptNumber (pre-update). The taskRun.update() data payload does NOT include attemptNumber, so they should be identical — but confirm this assumption holds for all dequeue scenarios (e.g. retried runs). Verify isValid defaults to true in schema: The old createExecutionSnapshot explicitly set isValid: error ? false : true. The nested create omits isValid (no error in the dequeue happy path). Confirm the Prisma schema default for TaskRunExecutionSnapshot.isValid is true. Verify runStatus: "PENDING" hardcoding matches the mapping: The old code passed lockedTaskRun.status ("DEQUEUED") to createExecutionSnapshot, which mapped it to "PENDING" via run.status === "DEQUEUED" ? "PENDING" : run.status. The new code hardcodes "PENDING" directly. This is correct but brittle if status ever changes from "DEQUEUED" to something else upstream. Spot-check completedWaitpoints connect + order logic: The nested create replicates the connect/order logic from createExecutionSnapshot (lines 387-393). Verify the snapshot.completedWaitpoints type provides id and index fields compatible with this usage. Verify checkpoint in return value: The return now uses snapshot.checkpoint (from the previous snapshot) instead of reading the newly-created snapshot's checkpoint relation. Since checkpointId is passed through unchanged, they should be identical — but worth a sanity check. Recommended test plan: deploy to staging, run the sample_pg_activity.py sampler for a 5-minute window, and verify the COMMIT count drop on the engine service + proportional IO:XactSync reduction. Notes This only covers the dequeue flow (flow #1 from TRI-8450). The remaining four flows (retry-immediate, checkpoint, requeue, cancel) are separate follow-ups. The new enqueueHeartbeatIfNeeded method is deliberately designed for reuse by those follow-up PRs. CI note: the priority.test.ts failure in shard 7 is a flaky ordering assertion unrelated to this change (it compares friendlyId values in dequeue order). The audit check is also pre-existing/unrelated. Link to Devin session: https://app.devin.ai/sessions/034fe0e7224f49278a2de260203e1377 Requested by: @ericallam

Open Graph Description: Summary Nests the TaskRunExecutionSnapshot creation inside the taskRun.update() Prisma call in the dequeue flow, reducing 2 DB commits → 1 per dequeue operation. This is the highest-volume of the f...

X Description: Summary Nests the TaskRunExecutionSnapshot creation inside the taskRun.update() Prisma call in the dequeue flow, reducing 2 DB commits → 1 per dequeue operation. This is the highest-volume of the f...

Opengraph URL: https://github.com/triggerdotdev/trigger.dev/pull/3395

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,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-controllerpull_requests
route-actionfiles
fetch-noncev2:d4b02050-57af-408e-f135-e30a3327288f
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idD4C8:A1946:2E9C0:41179:6AFB095A
html-safe-nonce51ec6fd972e675793cfe63c0b94ee99c1d8c8250ea754a004f411d474a27bfd1
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENEM4OkExOTQ2OjJFOUMwOjQxMTc5OjZBRkIwOTVBIiwidmlzaXRvcl9pZCI6Ijg3NDQxNTUzODAzNTY2ODAwMjYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmacdbc8b08fb9fc270172c7fccc8d7a463929a317c74b9405d08e7410527c147c7b
hovercard-subject-tagpull_request:3538859618
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/triggerdotdev/trigger.dev/pull/3395/files
twitter:imagehttps://avatars.githubusercontent.com/in/811515?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/in/811515?s=400&v=4
og:image:altSummary Nests the TaskRunExecutionSnapshot creation inside the taskRun.update() Prisma call in the dequeue flow, reducing 2 DB commits → 1 per dequeue operation. This is the highest-volume of the f...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None76fb13cb43f1834708971f45a9cfcab5df3177a7582086613d7cdc6e98c4bfde
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/triggerdotdev/trigger.dev git https://github.com/triggerdotdev/trigger.dev.git
octolytics-dimension-user_id95297378
octolytics-dimension-user_logintriggerdotdev
octolytics-dimension-repository_id572570113
octolytics-dimension-repository_nwotriggerdotdev/trigger.dev
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id572570113
octolytics-dimension-repository_network_root_nwotriggerdotdev/trigger.dev
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releaseafc998826cdd963c8f91a96ae5372809ab5e296b
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/triggerdotdev/trigger.dev/pull/3395/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Ftriggerdotdev%2Ftrigger.dev%2Fpull%2F3395%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Ftriggerdotdev%2Ftrigger.dev%2Fpull%2F3395%2Ffiles
Sign uphttps://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
Reloadhttps://github.com/triggerdotdev/trigger.dev/pull/3395/files
Reloadhttps://github.com/triggerdotdev/trigger.dev/pull/3395/files
Reloadhttps://github.com/triggerdotdev/trigger.dev/pull/3395/files
triggerdotdevhttps://github.com/triggerdotdev
trigger.devhttps://github.com/triggerdotdev/trigger.dev
Codehttps://github.com/triggerdotdev/trigger.dev
Issues203 (203)https://github.com/triggerdotdev/trigger.dev/issues
Pull requests67 (67)https://github.com/triggerdotdev/trigger.dev/pulls
Discussionshttps://github.com/triggerdotdev/trigger.dev/discussions
Actionshttps://github.com/triggerdotdev/trigger.dev/actions
Projectshttps://github.com/triggerdotdev/trigger.dev/projects
Security and quality39 (39)https://github.com/triggerdotdev/trigger.dev/security
Insightshttps://github.com/triggerdotdev/trigger.dev/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Ftriggerdotdev%2Ftrigger.dev%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Ftriggerdotdev%2Ftrigger.dev%2Fissues%2Fnew%2Fchoose
matt-aitkenhttps://github.com/matt-aitken
mainhttps://github.com/triggerdotdev/trigger.dev/tree/main
devin/TRI-8450-1776335318https://github.com/triggerdotdev/trigger.dev/tree/devin/TRI-8450-1776335318
Conversation 4 https://github.com/triggerdotdev/trigger.dev/pull/3395
Commits 3 https://github.com/triggerdotdev/trigger.dev/pull/3395/commits
Checks 44 https://github.com/triggerdotdev/trigger.dev/pull/3395/checks
Files changed https://github.com/triggerdotdev/trigger.dev/pull/3395/files
Please reload this pagehttps://github.com/triggerdotdev/trigger.dev/pull/3395/files
perf(run-engine): merge dequeue snapshot creation into taskRun.update transaction [TRI-8450] https://github.com/triggerdotdev/trigger.dev/pull/3395/files#top
Show all changes 3 commits https://github.com/triggerdotdev/trigger.dev/pull/3395/files
f00f609 perf(run-engine): merge dequeue snapshot creation into taskRun.update… devin-ai-integration[bot] Apr 16, 2026 https://github.com/triggerdotdev/trigger.dev/pull/3395/commits/f00f609107707f731db0a9417a654726fe37195b
c5134e9 perf: eliminate getLatestExecutionSnapshot read in dequeue flow devin-ai-integration[bot] Apr 16, 2026 https://github.com/triggerdotdev/trigger.dev/pull/3395/commits/c5134e906f3a7b38afb6a1e14d98e0c44f8c8061
2a87406 refactor: use plain cuid via generateInternalId instead of SnapshotId… devin-ai-integration[bot] Apr 16, 2026 https://github.com/triggerdotdev/trigger.dev/pull/3395/commits/2a874065524058afa23c751346332f92f6ab9d53
Clear filters https://github.com/triggerdotdev/trigger.dev/pull/3395/files
Please reload this pagehttps://github.com/triggerdotdev/trigger.dev/pull/3395/files
Please reload this pagehttps://github.com/triggerdotdev/trigger.dev/pull/3395/files
merge-dequeue-snapshot-into-transaction.md https://github.com/triggerdotdev/trigger.dev/pull/3395/files#diff-762c2b676fbaf94f3dd267dc54dcd1c51aa7e454bb8860c979f3fdaabcfd1b86
dequeueSystem.ts https://github.com/triggerdotdev/trigger.dev/pull/3395/files#diff-1459e83217f8c86df98b8cb4aa5fe630961fa6bb500650e52124d5ee2454f846
executionSnapshotSystem.ts https://github.com/triggerdotdev/trigger.dev/pull/3395/files#diff-c595e4a2c7d1b3cb8e137f9c0cbc5af5a7ed38473514eb5e47fd2898a8da57f9
.server-changes/merge-dequeue-snapshot-into-transaction.mdhttps://github.com/triggerdotdev/trigger.dev/pull/3395/files#diff-762c2b676fbaf94f3dd267dc54dcd1c51aa7e454bb8860c979f3fdaabcfd1b86
View file https://github.com/triggerdotdev/trigger.dev/blob/2a874065524058afa23c751346332f92f6ab9d53/.server-changes/merge-dequeue-snapshot-into-transaction.md
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/triggerdotdev/trigger.dev/pull/3395/{{ revealButtonHref }}
internal-packages/run-engine/src/engine/systems/dequeueSystem.tshttps://github.com/triggerdotdev/trigger.dev/pull/3395/files#diff-1459e83217f8c86df98b8cb4aa5fe630961fa6bb500650e52124d5ee2454f846
View file https://github.com/triggerdotdev/trigger.dev/blob/2a874065524058afa23c751346332f92f6ab9d53/internal-packages/run-engine/src/engine/systems/dequeueSystem.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/triggerdotdev/trigger.dev/pull/3395/{{ revealButtonHref }}
https://github.com/triggerdotdev/trigger.dev/pull/3395/files#diff-1459e83217f8c86df98b8cb4aa5fe630961fa6bb500650e52124d5ee2454f846
https://github.com/triggerdotdev/trigger.dev/pull/3395/files#diff-1459e83217f8c86df98b8cb4aa5fe630961fa6bb500650e52124d5ee2454f846
https://github.com/triggerdotdev/trigger.dev/pull/3395/files#diff-1459e83217f8c86df98b8cb4aa5fe630961fa6bb500650e52124d5ee2454f846
https://github.com/triggerdotdev/trigger.dev/pull/3395/files#diff-1459e83217f8c86df98b8cb4aa5fe630961fa6bb500650e52124d5ee2454f846
https://github.com/triggerdotdev/trigger.dev/pull/3395/files#diff-1459e83217f8c86df98b8cb4aa5fe630961fa6bb500650e52124d5ee2454f846
https://github.com/triggerdotdev/trigger.dev/pull/3395/files#diff-1459e83217f8c86df98b8cb4aa5fe630961fa6bb500650e52124d5ee2454f846
https://github.com/triggerdotdev/trigger.dev/pull/3395/files#diff-1459e83217f8c86df98b8cb4aa5fe630961fa6bb500650e52124d5ee2454f846
internal-packages/run-engine/src/engine/systems/executionSnapshotSystem.tshttps://github.com/triggerdotdev/trigger.dev/pull/3395/files#diff-c595e4a2c7d1b3cb8e137f9c0cbc5af5a7ed38473514eb5e47fd2898a8da57f9
View file https://github.com/triggerdotdev/trigger.dev/blob/2a874065524058afa23c751346332f92f6ab9d53/internal-packages/run-engine/src/engine/systems/executionSnapshotSystem.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/triggerdotdev/trigger.dev/pull/3395/{{ revealButtonHref }}
https://github.com/triggerdotdev/trigger.dev/pull/3395/files#diff-c595e4a2c7d1b3cb8e137f9c0cbc5af5a7ed38473514eb5e47fd2898a8da57f9
https://github.com/triggerdotdev/trigger.dev/pull/3395/files#diff-c595e4a2c7d1b3cb8e137f9c0cbc5af5a7ed38473514eb5e47fd2898a8da57f9
Please reload this pagehttps://github.com/triggerdotdev/trigger.dev/pull/3395/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.