René's URL Explorer Experiment


Title: feat(cli): auto-cancel dev runs on CLI exit via detached watchdog by ericallam · Pull Request #3191 · triggerdotdev/trigger.dev · GitHub

Open Graph Title: feat(cli): auto-cancel dev runs on CLI exit via detached watchdog by ericallam · Pull Request #3191 · triggerdotdev/trigger.dev

X Title: feat(cli): auto-cancel dev runs on CLI exit via detached watchdog by ericallam · Pull Request #3191 · triggerdotdev/trigger.dev

Description: When the dev CLI exits (e.g. ctrl+c via pnpm), runs that were mid-execution previously stayed stuck in EXECUTING status for up to 5 minutes until the heartbeat timeout fired. Now they are cancelled within seconds. The dev CLI spawns a lightweight detached watchdog process at startup. The watchdog monitors the CLI process ID and, when it detects the CLI has exited, calls a new POST /engine/v1/dev/disconnect endpoint to cancel all in-flight runs immediately (skipping PENDING_CANCEL since the worker is known to be dead). Watchdog design: Fully detached (detached: true, stdio: ignore, unref()) so it survives even when pnpm sends SIGKILL to the process tree Active run IDs maintained via atomic file write (.trigger/active-runs.json) Single-instance guarantee via PID file (.trigger/watchdog.pid) Safety timeout: exits after 24 hours to prevent zombie processes On clean shutdown, the watchdog is killed (no disconnect needed) Disconnect endpoint: Rate-limited: 5 calls/min per environment Capped at 500 runs per call Small counts (<= 25): cancelled inline with pMap concurrency 10 Large counts: delegated to the bulk action system Uses finalizeRun: true to skip PENDING_CANCEL and go straight to FINISHED Run engine change: cancelRun() now respects finalizeRun when the run is in EXECUTING status, skipping the PENDING_CANCEL waiting state and going directly to FINISHED

Open Graph Description: When the dev CLI exits (e.g. ctrl+c via pnpm), runs that were mid-execution previously stayed stuck in EXECUTING status for up to 5 minutes until the heartbeat timeout fired. Now they are cancelled...

X Description: When the dev CLI exits (e.g. ctrl+c via pnpm), runs that were mid-execution previously stayed stuck in EXECUTING status for up to 5 minutes until the heartbeat timeout fired. Now they are cancelled...

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

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:ba32c92f-d2df-84cb-b559-04ce94195973
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idCF56:2EB5D6:2B9BD6:40B418:6AFADE59
html-safe-noncec2b1d2cbe04b26ab895739062ee1f0c1a8bd801a8d51df2b01748fb6aa285431
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDRjU2OjJFQjVENjoyQjlCRDY6NDBCNDE4OjZBRkFERTU5IiwidmlzaXRvcl9pZCI6IjUxMTMwMTgwMTA1ODMwOTY5MjEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac051baed902ab1264ceca78f47354fea43e21f4d48028dfa2275637fb42468ebe
hovercard-subject-tagpull_request:3368478912
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/3191/files
twitter:imagehttps://avatars.githubusercontent.com/u/534?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/534?s=400&v=4
og:image:altWhen the dev CLI exits (e.g. ctrl+c via pnpm), runs that were mid-execution previously stayed stuck in EXECUTING status for up to 5 minutes until the heartbeat timeout fired. Now they are cancelled...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None9d9bd51a568909a83d1abb9d6f74d68f0c87ca85fe3a56d3f5d70d8b89add9f2
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
release4a7ae932999cc6d511008dbf980ff9efad2a31f7
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/triggerdotdev/trigger.dev/pull/3191/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Ftriggerdotdev%2Ftrigger.dev%2Fpull%2F3191%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%2F3191%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/3191/files
Reloadhttps://github.com/triggerdotdev/trigger.dev/pull/3191/files
Reloadhttps://github.com/triggerdotdev/trigger.dev/pull/3191/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 requests66 (66)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
ericallamhttps://github.com/ericallam
mainhttps://github.com/triggerdotdev/trigger.dev/tree/main
feature/tri-7779-we-need-to-cancel-runs-when-the-cli-exists-again-to-preventhttps://github.com/triggerdotdev/trigger.dev/tree/feature/tri-7779-we-need-to-cancel-runs-when-the-cli-exists-again-to-prevent
Conversation 25 https://github.com/triggerdotdev/trigger.dev/pull/3191
Commits 6 https://github.com/triggerdotdev/trigger.dev/pull/3191/commits
Checks 43 https://github.com/triggerdotdev/trigger.dev/pull/3191/checks
Files changed https://github.com/triggerdotdev/trigger.dev/pull/3191/files
Please reload this pagehttps://github.com/triggerdotdev/trigger.dev/pull/3191/files
feat(cli): auto-cancel dev runs on CLI exit via detached watchdog https://github.com/triggerdotdev/trigger.dev/pull/3191/files#top
Show all changes 6 commits https://github.com/triggerdotdev/trigger.dev/pull/3191/files
562e88a feat(cli): auto-cancel dev runs on CLI exit via detached watchdog ericallam Mar 7, 2026 https://github.com/triggerdotdev/trigger.dev/pull/3191/commits/562e88ab3196c03432fc8c5ee6eb295d235529e9
0721012 fix: address CodeRabbit review feedback ericallam Mar 7, 2026 https://github.com/triggerdotdev/trigger.dev/pull/3191/commits/07210123421d90c001f85f77379a4839b3c73cd7
e94add9 fix(cli): check response.ok and retry disconnect with exponential bac… ericallam Mar 8, 2026 https://github.com/triggerdotdev/trigger.dev/pull/3191/commits/e94add93411a3173ed064786ffd369539fb2e7bc
cb1cc61 fix(cli): use engineUrl for watchdog disconnect, exit on SIGINT ericallam Mar 9, 2026 https://github.com/triggerdotdev/trigger.dev/pull/3191/commits/cb1cc61c4762cbdf728ef39273edc5a40b67e004
09ac03a fix(cli): unify shutdown sequence, guard PID-file fallback against reuse ericallam Mar 9, 2026 https://github.com/triggerdotdev/trigger.dev/pull/3191/commits/09ac03ac91ba3c064d630cb5b0e2e7c19a2ed097
245c6ad fix: restrict dev disconnect endpoint to DEVELOPMENT environments ericallam Mar 9, 2026 https://github.com/triggerdotdev/trigger.dev/pull/3191/commits/245c6ade9e06b05ad8ac4ef2f17fb3f1716f4ea0
Clear filters https://github.com/triggerdotdev/trigger.dev/pull/3191/files
Please reload this pagehttps://github.com/triggerdotdev/trigger.dev/pull/3191/files
Please reload this pagehttps://github.com/triggerdotdev/trigger.dev/pull/3191/files
strange-moles-provide.md https://github.com/triggerdotdev/trigger.dev/pull/3191/files#diff-d9801ddddf0ec7399e0d360e9e7b671a5ba8da2995596fd048f9d5f746fbebb7
dev-cli-disconnect-md https://github.com/triggerdotdev/trigger.dev/pull/3191/files#diff-bdf833546f6758725a3474a1bb7b29c82169cea7354537c062de2459197c9aa7
engine.v1.dev.disconnect.ts https://github.com/triggerdotdev/trigger.dev/pull/3191/files#diff-7f53d83dbbab2684f2218527b304ae2906f50365ff2652a0b061f5782ac17e29
BulkActionV2.server.ts https://github.com/triggerdotdev/trigger.dev/pull/3191/files#diff-09fabf1a9b5dcf048077ab158eb66fdd148faa2152797f7edc5968a1702f6db0
cancelTaskRun.server.ts https://github.com/triggerdotdev/trigger.dev/pull/3191/files#diff-bf1b105f081b8c7f7ff5dd71c18f233d97d8e6eb6aa68ec2cf8581cc7107f374
runAttemptSystem.ts https://github.com/triggerdotdev/trigger.dev/pull/3191/files#diff-6be6606119f2547e117a3cfdbb47eb2fc6797271b8604e6c2ee1dc6d1db57ae8
apiClient.ts https://github.com/triggerdotdev/trigger.dev/pull/3191/files#diff-bb0355aa2762dd08069e67045d10b4d3c33defb8f828b7fbd1c954cc391bb6ff
devSupervisor.ts https://github.com/triggerdotdev/trigger.dev/pull/3191/files#diff-071ef3fb057647679a2bd68f4e5dbf642a873e637baaa657347b5a7bf1d701c3
devWatchdog.ts https://github.com/triggerdotdev/trigger.dev/pull/3191/files#diff-924000127cbd2c80eb673384e5a539c836aa7850262700657769949dc6edf620
api.ts https://github.com/triggerdotdev/trigger.dev/pull/3191/files#diff-c929980f61a97fbebd23b497e2303aa302e5365161fbea596997800df6a4c6c4
.changeset/strange-moles-provide.mdhttps://github.com/triggerdotdev/trigger.dev/pull/3191/files#diff-d9801ddddf0ec7399e0d360e9e7b671a5ba8da2995596fd048f9d5f746fbebb7
View file https://github.com/triggerdotdev/trigger.dev/blob/245c6ade9e06b05ad8ac4ef2f17fb3f1716f4ea0/.changeset/strange-moles-provide.md
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/triggerdotdev/trigger.dev/pull/3191/{{ revealButtonHref }}
.server-changes/dev-cli-disconnect-mdhttps://github.com/triggerdotdev/trigger.dev/pull/3191/files#diff-bdf833546f6758725a3474a1bb7b29c82169cea7354537c062de2459197c9aa7
View file https://github.com/triggerdotdev/trigger.dev/blob/245c6ade9e06b05ad8ac4ef2f17fb3f1716f4ea0/.server-changes/dev-cli-disconnect-md
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/triggerdotdev/trigger.dev/pull/3191/{{ revealButtonHref }}
apps/webapp/app/routes/engine.v1.dev.disconnect.tshttps://github.com/triggerdotdev/trigger.dev/pull/3191/files#diff-7f53d83dbbab2684f2218527b304ae2906f50365ff2652a0b061f5782ac17e29
View file https://github.com/triggerdotdev/trigger.dev/blob/245c6ade9e06b05ad8ac4ef2f17fb3f1716f4ea0/apps/webapp/app/routes/engine.v1.dev.disconnect.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/triggerdotdev/trigger.dev/pull/3191/{{ revealButtonHref }}
Please reload this pagehttps://github.com/triggerdotdev/trigger.dev/pull/3191/files
Please reload this pagehttps://github.com/triggerdotdev/trigger.dev/pull/3191/files
apps/webapp/app/v3/services/bulk/BulkActionV2.server.tshttps://github.com/triggerdotdev/trigger.dev/pull/3191/files#diff-09fabf1a9b5dcf048077ab158eb66fdd148faa2152797f7edc5968a1702f6db0
View file https://github.com/triggerdotdev/trigger.dev/blob/245c6ade9e06b05ad8ac4ef2f17fb3f1716f4ea0/apps/webapp/app/v3/services/bulk/BulkActionV2.server.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/triggerdotdev/trigger.dev/pull/3191/{{ revealButtonHref }}
https://github.com/triggerdotdev/trigger.dev/pull/3191/files#diff-09fabf1a9b5dcf048077ab158eb66fdd148faa2152797f7edc5968a1702f6db0
https://github.com/triggerdotdev/trigger.dev/pull/3191/files#diff-09fabf1a9b5dcf048077ab158eb66fdd148faa2152797f7edc5968a1702f6db0
https://github.com/triggerdotdev/trigger.dev/pull/3191/files#diff-09fabf1a9b5dcf048077ab158eb66fdd148faa2152797f7edc5968a1702f6db0
https://github.com/triggerdotdev/trigger.dev/pull/3191/files#diff-09fabf1a9b5dcf048077ab158eb66fdd148faa2152797f7edc5968a1702f6db0
apps/webapp/app/v3/services/cancelTaskRun.server.tshttps://github.com/triggerdotdev/trigger.dev/pull/3191/files#diff-bf1b105f081b8c7f7ff5dd71c18f233d97d8e6eb6aa68ec2cf8581cc7107f374
View file https://github.com/triggerdotdev/trigger.dev/blob/245c6ade9e06b05ad8ac4ef2f17fb3f1716f4ea0/apps/webapp/app/v3/services/cancelTaskRun.server.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/triggerdotdev/trigger.dev/pull/3191/{{ revealButtonHref }}
https://github.com/triggerdotdev/trigger.dev/pull/3191/files#diff-bf1b105f081b8c7f7ff5dd71c18f233d97d8e6eb6aa68ec2cf8581cc7107f374
https://github.com/triggerdotdev/trigger.dev/pull/3191/files#diff-bf1b105f081b8c7f7ff5dd71c18f233d97d8e6eb6aa68ec2cf8581cc7107f374
https://github.com/triggerdotdev/trigger.dev/pull/3191/files#diff-bf1b105f081b8c7f7ff5dd71c18f233d97d8e6eb6aa68ec2cf8581cc7107f374
https://github.com/triggerdotdev/trigger.dev/pull/3191/files#diff-bf1b105f081b8c7f7ff5dd71c18f233d97d8e6eb6aa68ec2cf8581cc7107f374
internal-packages/run-engine/src/engine/systems/runAttemptSystem.tshttps://github.com/triggerdotdev/trigger.dev/pull/3191/files#diff-6be6606119f2547e117a3cfdbb47eb2fc6797271b8604e6c2ee1dc6d1db57ae8
View file https://github.com/triggerdotdev/trigger.dev/blob/245c6ade9e06b05ad8ac4ef2f17fb3f1716f4ea0/internal-packages/run-engine/src/engine/systems/runAttemptSystem.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/triggerdotdev/trigger.dev/pull/3191/{{ revealButtonHref }}
https://github.com/triggerdotdev/trigger.dev/pull/3191/files#diff-6be6606119f2547e117a3cfdbb47eb2fc6797271b8604e6c2ee1dc6d1db57ae8
Please reload this pagehttps://github.com/triggerdotdev/trigger.dev/pull/3191/files
https://github.com/triggerdotdev/trigger.dev/pull/3191/files#diff-6be6606119f2547e117a3cfdbb47eb2fc6797271b8604e6c2ee1dc6d1db57ae8
packages/cli-v3/src/apiClient.tshttps://github.com/triggerdotdev/trigger.dev/pull/3191/files#diff-bb0355aa2762dd08069e67045d10b4d3c33defb8f828b7fbd1c954cc391bb6ff
View file https://github.com/triggerdotdev/trigger.dev/blob/245c6ade9e06b05ad8ac4ef2f17fb3f1716f4ea0/packages/cli-v3/src/apiClient.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/triggerdotdev/trigger.dev/pull/3191/{{ revealButtonHref }}
https://github.com/triggerdotdev/trigger.dev/pull/3191/files#diff-bb0355aa2762dd08069e67045d10b4d3c33defb8f828b7fbd1c954cc391bb6ff
https://github.com/triggerdotdev/trigger.dev/pull/3191/files#diff-bb0355aa2762dd08069e67045d10b4d3c33defb8f828b7fbd1c954cc391bb6ff
https://github.com/triggerdotdev/trigger.dev/pull/3191/files#diff-bb0355aa2762dd08069e67045d10b4d3c33defb8f828b7fbd1c954cc391bb6ff
https://github.com/triggerdotdev/trigger.dev/pull/3191/files#diff-bb0355aa2762dd08069e67045d10b4d3c33defb8f828b7fbd1c954cc391bb6ff
https://github.com/triggerdotdev/trigger.dev/pull/3191/files#diff-bb0355aa2762dd08069e67045d10b4d3c33defb8f828b7fbd1c954cc391bb6ff
https://github.com/triggerdotdev/trigger.dev/pull/3191/files#diff-bb0355aa2762dd08069e67045d10b4d3c33defb8f828b7fbd1c954cc391bb6ff
Please reload this pagehttps://github.com/triggerdotdev/trigger.dev/pull/3191/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.