René's URL Explorer Experiment


Title: fix(execution): stop in-flight workflow runs when an account is deleted, removed or banned by waleedlatif1 · Pull Request #9145 · simstudioai/sim · GitHub

Open Graph Title: fix(execution): stop in-flight workflow runs when an account is deleted, removed or banned by waleedlatif1 · Pull Request #9145 · simstudioai/sim

X Title: fix(execution): stop in-flight workflow runs when an account is deleted, removed or banned by waleedlatif1 · Pull Request #9145 · simstudioai/sim

Description: Summary No removal path stopped in-flight workflow executions; #9089 stops Copilot runs only. On 2026-10-16 a prod run kept spending a hosted fal.ai key for five minutes after its owner deleted their account, then crashed on foreign-key errors. Banned accounts' runs also kept spending until their timeout. One mechanism for every removal path lib/execution/removal-stop-records.ts (light, safe for page graphs): collects the executions a removal must stop: running log rows, plus claimed resumes, which run under their own execution id; records them as durable execution.removal-stop outbox events, one per workspace; signals them through markExecutionCancelled + abortManualExecution, 10 at a time with a 10 s deadline, and never throws. lib/execution/removal-stops.ts (outbox handler): signals again, then sweeps both job queues for the workspace. New JobQueueBackend.cancelByWorkspace: Trigger: runs.list on the existing workspaceId: tag, filtered to the five workflow task types (workflow, schedule, webhook, resume, workflow-group cell) and active statuses, with each result's tags rechecked exactly. Pages of 100, 10 concurrent cancels, capped. Database: UPDATE async_jobs filtered on status, the same five job types, and metadata->>'workspaceId'; aborts this process's inline controllers. Queued runs are cancelled before they start a machine. Wired into Account deletion: stops are collected and enqueued inside the deletion transaction, after the existing workspace FOR UPDATE, so a rollback enqueues nothing. After commit the signal is fired and forgotten before any other step. The sweep runs in the outbox worker. The deletion response and the storage purge never wait on Trigger. Ban (disableUserResources): after the archives commit, stops are recorded for the workspaces the ban archived and signalled immediately. A failure to record them is logged, not thrown, so the committed ban never 500s. Bans are admin-only. Admin /admin/remove-user: Better Auth's user.delete.before collects the user's owned workspaces and the workflows they created; both cascade with the user. .after enqueues and signals the stops. Collection never blocks the removal. Runs stopped this way still log a noisy ending until #9144 lands; that PR makes it quiet. Type of Change Bug fix Testing Trigger backend tests use a fake that stores the tags enqueue actually sends. They prove: producer tags match the sweep filter; only the five task types are cancelled; the cap holds across calls; partial cancel failures still throw after the rest are cancelled; at most 10 cancels run concurrently. Handler tests run against the real cancellation module: no Redis completes; a refused Redis write retries; a sweep error retries; hitting the cap after progress continues; hitting the cap with no progress retries. database.test.ts pins the job-type filter. Each guard was mutated and went red, then green when restored. removal-stops.integration.ts (real Postgres + Redis) covers: deletion: flags set, queued job cancelled, a non-workflow cleanup-logs job and a bystander's run untouched; ban: immediate signal, sweep through the worker; admin removal: a workflow the user created in another workspace is stopped, a bystander's is not. check-tool-registry-boundary --check: all graphs within baseline. An independent adversarial review checked tag exact-match, job-type filtering on both backends, Better Auth hook semantics (1.6.27), FK cascades behind the admin path, and outbox retry behavior. Checklist Code follows project style guidelines Self-reviewed my changes Tests added/updated and passing No new warnings introduced

Open Graph Description: Summary No removal path stopped in-flight workflow executions; #9089 stops Copilot runs only. On 2026-10-16 a prod run kept spending a hosted fal.ai key for five minutes after its owner deleted the...

X Description: Summary No removal path stopped in-flight workflow executions; #9089 stops Copilot runs only. On 2026-10-16 a prod run kept spending a hosted fal.ai key for five minutes after its owner deleted the...

Opengraph URL: https://github.com/simstudioai/sim/pull/9145

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:8804dd73-b6d9-0094-a2bb-74c0e603bb47
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idA87C:3E7424:8F233E:CB14D4:6AFB50AE
html-safe-nonce8edd4fdfbb3dcf7f4b9677f0c2f654df83acd86da22517344da962485ea7ffb8
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBODdDOjNFNzQyNDo4RjIzM0U6Q0IxNEQ0OjZBRkI1MEFFIiwidmlzaXRvcl9pZCI6IjUyNzc1ODI2NTAzNTE3Njc3MjYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmaca2c32b6ab6d5b50ea2444b86b7e37491863215730c5f9a7be1e77ef912ebfe11
hovercard-subject-tagpull_request:4894876911
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/simstudioai/sim/pull/9145/files
twitter:imagehttps://avatars.githubusercontent.com/u/40672544?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/40672544?s=400&v=4
og:image:altSummary No removal path stopped in-flight workflow executions; #9089 stops Copilot runs only. On 2026-10-16 a prod run kept spending a hosted fal.ai key for five minutes after its owner deleted the...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None7122bb414b542dba14d71a3f0b9f6fd2abce715b9f5912d082800563e6c806d1
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/simstudioai/sim git https://github.com/simstudioai/sim.git
octolytics-dimension-user_id199344406
octolytics-dimension-user_loginsimstudioai
octolytics-dimension-repository_id912559512
octolytics-dimension-repository_nwosimstudioai/sim
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id912559512
octolytics-dimension-repository_network_root_nwosimstudioai/sim
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
releasecbf66c024bb6d10e6955baa7413c54cf13a201bb
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/simstudioai/sim/pull/9145/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim%2Fpull%2F9145%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%2Fsimstudioai%2Fsim%2Fpull%2F9145%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=simstudioai%2Fsim
Reloadhttps://github.com/simstudioai/sim/pull/9145/files
Reloadhttps://github.com/simstudioai/sim/pull/9145/files
Reloadhttps://github.com/simstudioai/sim/pull/9145/files
simstudioaihttps://github.com/simstudioai
simhttps://github.com/simstudioai/sim
Codehttps://github.com/simstudioai/sim
Issues129 (129)https://github.com/simstudioai/sim/issues
Pull requests197 (197)https://github.com/simstudioai/sim/pulls
Actionshttps://github.com/simstudioai/sim/actions
Projectshttps://github.com/simstudioai/sim/projects
Security and qualityhttps://github.com/simstudioai/sim/security
Insightshttps://github.com/simstudioai/sim/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fsimstudioai%2Fsim%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fsimstudioai%2Fsim%2Fissues%2Fnew%2Fchoose
waleedlatif1https://github.com/waleedlatif1
staginghttps://github.com/simstudioai/sim/tree/staging
fix/stop-runs-on-account-removalhttps://github.com/simstudioai/sim/tree/fix/stop-runs-on-account-removal
Conversation 61 https://github.com/simstudioai/sim/pull/9145
Commits 9 https://github.com/simstudioai/sim/pull/9145/commits
Checks 52 https://github.com/simstudioai/sim/pull/9145/checks
Files changed https://github.com/simstudioai/sim/pull/9145/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/9145/files
fix(execution): stop in-flight workflow runs when an account is deleted, removed or banned https://github.com/simstudioai/sim/pull/9145/files#top
Show all changes 9 commits https://github.com/simstudioai/sim/pull/9145/files
3ee51f8 fix(execution): stop in-flight workflow runs when an account is delet… waleedlatif1 Oct 16, 2026 https://github.com/simstudioai/sim/pull/9145/commits/3ee51f80cf479b7666600db05036e8880a31c51d
040ade0 fix(execution): keep removal stops off the deletion and ban critical … waleedlatif1 Oct 16, 2026 https://github.com/simstudioai/sim/pull/9145/commits/040ade01d8fd80cd58cc6c1467658fc691924d9d
b65ee91 test(execution): give each removal-stop fixture workflow a unique name waleedlatif1 Oct 16, 2026 https://github.com/simstudioai/sim/pull/9145/commits/b65ee91aae6e6e9c67bf9daef02a522c0c15a6b5
86faeab fix(execution): close the review's gaps in removal stops waleedlatif1 Oct 16, 2026 https://github.com/simstudioai/sim/pull/9145/commits/86faeabfea94dc78806f854896d676a7d0e58c74
197e901 refactor(execution): tighten removal stops after final audit waleedlatif1 Oct 16, 2026 https://github.com/simstudioai/sim/pull/9145/commits/197e901bdf85385b461c36c27d353a2273b761ff
cd54396 fix(execution): finish the removal sweep's edge cases waleedlatif1 Oct 16, 2026 https://github.com/simstudioai/sim/pull/9145/commits/cd543967844135e5620e289259f8310ea6d70aa8
e6fb280 fix(execution): abort local runs before the removal signal deadline c… waleedlatif1 Oct 16, 2026 https://github.com/simstudioai/sim/pull/9145/commits/e6fb2802611739337e3a24c12959b1d91c3d5e98
85d2cd2 fix(execution): guard ban stops against transfers and refusing runs waleedlatif1 Oct 16, 2026 https://github.com/simstudioai/sim/pull/9145/commits/85d2cd25e057270ce073d21d626b25d9d69f74d5
7dd7ff5 fix(execution): sweep a removed workspace's Trigger.dev runs of any age waleedlatif1 Oct 16, 2026 https://github.com/simstudioai/sim/pull/9145/commits/7dd7ff528296c50a4a818be5e933f57575464198
Clear filters https://github.com/simstudioai/sim/pull/9145/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/9145/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/9145/files
admin-removal-stops.test.ts https://github.com/simstudioai/sim/pull/9145/files#diff-05b8b54446c4a0435a82e41c1fd4f224da53dbe19edb9dca82e6fe3eff570bc0
admin-removal-stops.ts https://github.com/simstudioai/sim/pull/9145/files#diff-22f6054a01eba8db8519d696a42d08a63d373383600e899a0ca8bc209c6e9087
auth.ts https://github.com/simstudioai/sim/pull/9145/files#diff-1196450729bfda994f3823921eacd28e3200408dbb562d8481108db9abe4a0e2
database.test.ts https://github.com/simstudioai/sim/pull/9145/files#diff-9087a5b4b6a502eecdf7db9b25eb9073a11baff1a98261a5a4cecfe5402018ef
database.ts https://github.com/simstudioai/sim/pull/9145/files#diff-fefc9fd260f80579ec85711ad364032eba5dc97e39be0933bd84841d8d83e4c6
trigger-dev.test.ts https://github.com/simstudioai/sim/pull/9145/files#diff-b5bf5f0ed76ee983bd85f4bb53a0f92b294c79cff64e593184a39672b320464e
trigger-dev.ts https://github.com/simstudioai/sim/pull/9145/files#diff-b958b57cdd2a5f9c4810a9ab7f23f04197dc6bf85c187708611c43de2293676a
types.ts https://github.com/simstudioai/sim/pull/9145/files#diff-464f570b2f7f239bee176e78456417aaf2418ea40aa7ca13f1a2a31b837d56f4
handlers.ts https://github.com/simstudioai/sim/pull/9145/files#diff-61deec24805d0e76abf8b08fc79ea963d8150e03c963cedf7d7e74fe675053fe
removal-stop-event.ts https://github.com/simstudioai/sim/pull/9145/files#diff-b684b97a6813095c56dc68e0e645e78b044ddc805c2c30ed36fe9e6b1b3e401f
removal-stop-records.test.ts https://github.com/simstudioai/sim/pull/9145/files#diff-e14ae1c7c61ff6c4b424bcdc8273faff97afe5fd59eb3508e9a4308e29852ed7
removal-stop-records.ts https://github.com/simstudioai/sim/pull/9145/files#diff-1ba356bea79c0fe45a932a2e028adc96f22b70d760ba5740e17da8a55714a844
removal-stops.integration.ts https://github.com/simstudioai/sim/pull/9145/files#diff-28d7ab5618521686579062948f8ee79365fd4a0a97422d7ff0d47afa6c5ecd12
removal-stops.test.ts https://github.com/simstudioai/sim/pull/9145/files#diff-f88e96711ee51f667503c82f29fe159d8e15fe5c934ab3ec400ead499e89a18a
removal-stops.ts https://github.com/simstudioai/sim/pull/9145/files#diff-2263d5c0ea1f5a35a3c0c74227a48144c4df83cb239210a38b9b0bf44bd3a054
account-deletion.ts https://github.com/simstudioai/sim/pull/9145/files#diff-0ad7b582145ede5bc28a9b4d0fdc670303e35dfff9f0be64a9750358c65b509b
lifecycle.ts https://github.com/simstudioai/sim/pull/9145/files#diff-4ac8584a20de376e1a1ee56d455dec9907427b807ace597059e316122c4f4f5b
async-jobs.mock.ts https://github.com/simstudioai/sim/pull/9145/files#diff-7caaa09afa5d586a958e72225d50117a54c7e258ac365b41460ab30f87d38805
apps/sim/lib/auth/admin-removal-stops.test.tshttps://github.com/simstudioai/sim/pull/9145/files#diff-05b8b54446c4a0435a82e41c1fd4f224da53dbe19edb9dca82e6fe3eff570bc0
View file https://github.com/simstudioai/sim/blob/7dd7ff528296c50a4a818be5e933f57575464198/apps/sim/lib/auth/admin-removal-stops.test.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/9145/{{ revealButtonHref }}
apps/sim/lib/auth/admin-removal-stops.tshttps://github.com/simstudioai/sim/pull/9145/files#diff-22f6054a01eba8db8519d696a42d08a63d373383600e899a0ca8bc209c6e9087
View file https://github.com/simstudioai/sim/blob/7dd7ff528296c50a4a818be5e933f57575464198/apps/sim/lib/auth/admin-removal-stops.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/9145/{{ revealButtonHref }}
apps/sim/lib/auth/auth.tshttps://github.com/simstudioai/sim/pull/9145/files#diff-1196450729bfda994f3823921eacd28e3200408dbb562d8481108db9abe4a0e2
View file https://github.com/simstudioai/sim/blob/7dd7ff528296c50a4a818be5e933f57575464198/apps/sim/lib/auth/auth.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/9145/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/9145/files#diff-1196450729bfda994f3823921eacd28e3200408dbb562d8481108db9abe4a0e2
https://github.com/simstudioai/sim/pull/9145/files#diff-1196450729bfda994f3823921eacd28e3200408dbb562d8481108db9abe4a0e2
https://github.com/simstudioai/sim/pull/9145/files#diff-1196450729bfda994f3823921eacd28e3200408dbb562d8481108db9abe4a0e2
https://github.com/simstudioai/sim/pull/9145/files#diff-1196450729bfda994f3823921eacd28e3200408dbb562d8481108db9abe4a0e2
apps/sim/lib/core/async-jobs/backends/database.test.tshttps://github.com/simstudioai/sim/pull/9145/files#diff-9087a5b4b6a502eecdf7db9b25eb9073a11baff1a98261a5a4cecfe5402018ef
View file https://github.com/simstudioai/sim/blob/7dd7ff528296c50a4a818be5e933f57575464198/apps/sim/lib/core/async-jobs/backends/database.test.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/9145/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/9145/files#diff-9087a5b4b6a502eecdf7db9b25eb9073a11baff1a98261a5a4cecfe5402018ef
https://github.com/simstudioai/sim/pull/9145/files#diff-9087a5b4b6a502eecdf7db9b25eb9073a11baff1a98261a5a4cecfe5402018ef
apps/sim/lib/core/async-jobs/backends/database.tshttps://github.com/simstudioai/sim/pull/9145/files#diff-fefc9fd260f80579ec85711ad364032eba5dc97e39be0933bd84841d8d83e4c6
View file https://github.com/simstudioai/sim/blob/7dd7ff528296c50a4a818be5e933f57575464198/apps/sim/lib/core/async-jobs/backends/database.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/9145/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/9145/files#diff-fefc9fd260f80579ec85711ad364032eba5dc97e39be0933bd84841d8d83e4c6
https://github.com/simstudioai/sim/pull/9145/files#diff-fefc9fd260f80579ec85711ad364032eba5dc97e39be0933bd84841d8d83e4c6
https://github.com/simstudioai/sim/pull/9145/files#diff-fefc9fd260f80579ec85711ad364032eba5dc97e39be0933bd84841d8d83e4c6
https://github.com/simstudioai/sim/pull/9145/files#diff-fefc9fd260f80579ec85711ad364032eba5dc97e39be0933bd84841d8d83e4c6
https://github.com/simstudioai/sim/pull/9145/files#diff-fefc9fd260f80579ec85711ad364032eba5dc97e39be0933bd84841d8d83e4c6
https://github.com/simstudioai/sim/pull/9145/files#diff-fefc9fd260f80579ec85711ad364032eba5dc97e39be0933bd84841d8d83e4c6
https://github.com/simstudioai/sim/pull/9145/files#diff-fefc9fd260f80579ec85711ad364032eba5dc97e39be0933bd84841d8d83e4c6
https://github.com/simstudioai/sim/pull/9145/files#diff-fefc9fd260f80579ec85711ad364032eba5dc97e39be0933bd84841d8d83e4c6
Please reload this pagehttps://github.com/simstudioai/sim/pull/9145/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/9145/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.