René's URL Explorer Experiment
Title: Lock a component's runs on the management host; add lock clear by shipmill-romamo[bot] · Pull Request #261 · cloudfall-dev/cloudfall · GitHub
Open Graph Title: Lock a component's runs on the management host; add lock clear by shipmill-romamo[bot] · Pull Request #261 · cloudfall-dev/cloudfall
X Title: Lock a component's runs on the management host; add lock clear by shipmill-romamo[bot] · Pull Request #261 · cloudfall-dev/cloudfall
Description: Stacked on #256.
Plan
Serves: G-1
Files: sdk/src/cloudfall/component_lock.py (new), sdk/src/cloudfall/lifecycle_error.py (new, LifecycleError moved out of lifecycle so component_lock can raise it), sdk/src/cloudfall/lifecycle.py, sdk/src/cloudfall/app.py, sdk/src/cloudfall/commands.py, sdk/README.md, sdk/tests/test_component_lock.py (new), changelog.d/221-component-lock.md
Order: a test that starts a second deploy (and a restart, a rollback, a build) while a deploy's playbook runs, failing on main because both reach the engine; then the management-host lock (an atomic hard link of a holder record under tmp/locks/, held by a context manager around deploy, rollback, restart and the artifact build); then cloudfall lock clear , which shows the lock and its age and removes it only once a person types the component id at a terminal
Proof: sdk/tests/test_component_lock.py (the race test fails on main), sdk/tests/test_lifecycle.py, sdk/tests/test_release_approval.py, the command catalog tests
Summary
This is the management-host half of #221. The host-side lock (one per component on each target server, taken in deploy/rollback/restart and released in always) is not in this PR, hence Part of #221.
The race, reproduced. test_a_second_run_of_the_component_fails_before_any_step starts a second run from inside the first run's playbook step. Before this change the second deploy rendered the inventory and ran deploy.yml while the first was still in it; the same holds for every pair of deploy, rollback, restart and build
The lock. component_lock(project, component, action) writes a holder record (component, action, user, host, pid, since, a random token) to a private file and hard-links it to tmp/locks/.json. os.link fails when the name exists, so taking the lock is atomic and the record is whole as soon as it exists. The context manager releases it in finally, so a failed run, an exception or Ctrl-C releases it too, and it removes the file only when the token is its own
Where it is held. deploy (from before the artifact check to after the receipt check), rollback, restart and build_release_artifact, so the CLI commands, the MCP tools and migrate all take it. health takes no lock: it only reads
A second run exits CONFLICT with component_locked before any step, e.g. component crm-backend is locked by a deploy that roman started on mac (process 4242) at 2026-11-13T10:00:00Z, 12 minutes ago; that process is still running. If no deploy of it is running, a person clears the lock with ``cloudfall lock clear crm-backend```. The context carries holder, ageSecondsandstale(true when the process is gone on this host, null when the lock was taken on another host). A malformed record exitsRECORD_INVALID`
cloudfall lock clear (new). It shows the lock with its age and removes it once a person types the component id at a terminal (ctx.attest, as release approve): requires_person, no MCP tool, --yes does not answer it. It refuses a lock whose process still runs on this host (CONFLICT, component_lock_in_use), and a lock taken again since it was shown. With no lock it answers cleared: false, effect noop
Nothing clears a lock by age
Test notes
New sdk/tests/test_component_lock.py: the race for every first run (deploy, rollback, restart) and second run (deploy, rollback, restart, build); release after a failed step and after Ctrl-C for each run; a killed run's lock reported stale with its age and left in place; a lock from another host reported as not known; a malformed record; another component's lock does not hold this one; the CLI's CONFLICT; lock clear at a terminal, off a terminal, mistyped, on a live process's lock, with no lock, and kept off MCP
Ran: uv run ruff check ., uv run mypy, ansible-lint (production profile, passed), and uv run pytest on test_component_lock, test_lifecycle, test_app, test_commands, test_project, test_agent_server, test_release_approval, test_deploy_approval, test_migrate_approval, test_operator, test_data_migration, test_data_copy_preflight, test_domains_apply/observe/converge, test_owned_postgresql_converge and engine test_command_health_gate and test_playbook. The full suite is left to CI
Not covered
The host-side lock, so two controllers (two people's checkouts, or the operator on another machine) are not serialized yet
cloudfall-engine artifact build and cloudfall-engine playbook run deploy called directly, and decisions approve / operator approve running a catalog playbook, do not go through the SDK's lifecycle functions and take no lock; the host-side lock is what would cover them
Part of #221
🤖 Generated with Claude Code
Open Graph Description: Stacked on #256.
Plan
Serves: G-1
Files: sdk/src/cloudfall/component_lock.py (new), sdk/src/cloudfall/lifecycle_error.py (new, LifecycleError moved out of lifecycle so component_lock can raise it)...
X Description: Stacked on #256.
Plan
Serves: G-1
Files: sdk/src/cloudfall/component_lock.py (new), sdk/src/cloudfall/lifecycle_error.py (new, LifecycleError moved out of lifecycle so component_lock can raise it)...
Opengraph URL: https://github.com/cloudfall-dev/cloudfall/pull/261
X: @github
direct link
Domain: github.com
IPv4 address: 140.82.112.3
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:647df643-d07a-ecf3-0752-04ad5890d3e2 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 8808:1CD602:19879AB:21AD75F:6B055A4E |
| html-safe-nonce | ae008f16aa3a6f9ef2e602e3253af67c15132a55a05577afdb3b4bb23a21a7b4 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4ODA4OjFDRDYwMjoxOTg3OUFCOjIxQUQ3NUY6NkIwNTVBNEUiLCJ2aXNpdG9yX2lkIjoiNzc2NjQxMzQ1NDE3Njc3MDYzOSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | cd1c283fae2a6991ae62dc6e2bb6856a4250f59fddbad0e4c441a4066b2f299c |
| hovercard-subject-tag | pull_request:5294596557 |
| 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/cloudfall-dev/cloudfall/pull/261/files |
| twitter:image | https://avatars.githubusercontent.com/u/5600783?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/5600783?s=400&v=4 |
| og:image:alt | Stacked on #256.
Plan
Serves: G-1
Files: sdk/src/cloudfall/component_lock.py (new), sdk/src/cloudfall/lifecycle_error.py (new, LifecycleError moved out of lifecycle so component_lock can raise it)... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | a79a02b7e7546ea306864e922ed2103ef4c04fac63168e11c2b2d4d816793080 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/cloudfall-dev/cloudfall git https://github.com/cloudfall-dev/cloudfall.git |
| octolytics-dimension-user_id | 339512759 |
| octolytics-dimension-user_login | cloudfall-dev |
| octolytics-dimension-repository_id | 1360999777 |
| octolytics-dimension-repository_nwo | cloudfall-dev/cloudfall |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1360999777 |
| octolytics-dimension-repository_network_root_nwo | cloudfall-dev/cloudfall |
| 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 | 10dff83edfd4f3617a7792a152d44991587b434c |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
| Skip to content | https://github.com/cloudfall-dev/cloudfall/pull/261/files#start-of-content |
| https://github.com/ |
| Sign in | https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fcloudfall-dev%2Fcloudfall%2Fpull%2F261%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%2Fcloudfall-dev%2Fcloudfall%2Fpull%2F261%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=cloudfall-dev%2Fcloudfall |
| Reload | https://github.com/cloudfall-dev/cloudfall/pull/261/files |
| Reload | https://github.com/cloudfall-dev/cloudfall/pull/261/files |
| Reload | https://github.com/cloudfall-dev/cloudfall/pull/261/files |
| cloudfall-dev | https://github.com/cloudfall-dev |
| cloudfall | https://github.com/cloudfall-dev/cloudfall |
| Code | https://github.com/cloudfall-dev/cloudfall |
| Issues78 (78) | https://github.com/cloudfall-dev/cloudfall/issues |
| Pull requests10 (10) | https://github.com/cloudfall-dev/cloudfall/pulls |
| Discussions | https://github.com/cloudfall-dev/cloudfall/discussions |
| Actions | https://github.com/cloudfall-dev/cloudfall/actions |
| Security and quality | https://github.com/cloudfall-dev/cloudfall/security |
| Insights | https://github.com/cloudfall-dev/cloudfall/insights |
| Sign up for GitHub
| https://github.com/signup?return_to=%2Fcloudfall-dev%2Fcloudfall%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=%2Fcloudfall-dev%2Fcloudfall%2Fissues%2Fnew%2Fchoose |
| shipmill-romamo | https://github.com/apps/shipmill-romamo |
| main | https://github.com/cloudfall-dev/cloudfall/tree/main |
| fix/221-component-lock | https://github.com/cloudfall-dev/cloudfall/tree/fix/221-component-lock |
|
Conversation
1
| https://github.com/cloudfall-dev/cloudfall/pull/261 |
|
Commits
2
| https://github.com/cloudfall-dev/cloudfall/pull/261/commits |
|
Checks
1
| https://github.com/cloudfall-dev/cloudfall/pull/261/checks |
|
Files changed
8
| https://github.com/cloudfall-dev/cloudfall/pull/261/files |
|
Lock a component's runs on the management host; add lock clear
| https://github.com/cloudfall-dev/cloudfall/pull/261/files#top |
|
Show all changes
2 commits
| https://github.com/cloudfall-dev/cloudfall/pull/261/files |
|
f25c4ca
Lock a component's runs on the management host; add lock clear
shipmill-romamo[bot] Nov 13, 2026
| https://github.com/cloudfall-dev/cloudfall/pull/261/commits/f25c4ca8f3a9270d6fa8f8696c5a863100b3b613 |
|
bdbe3f6
Merge branch 'main' into fix/221-component-lock
shipmill-romamo[bot] Nov 13, 2026
| https://github.com/cloudfall-dev/cloudfall/pull/261/commits/bdbe3f6a43fbd28d5d6ad410fbcd17dde2726f2c |
|
Clear filters
| https://github.com/cloudfall-dev/cloudfall/pull/261/files |
| Please reload this page | https://github.com/cloudfall-dev/cloudfall/pull/261/files |
| Please reload this page | https://github.com/cloudfall-dev/cloudfall/pull/261/files |
|
221-component-lock.md
| https://github.com/cloudfall-dev/cloudfall/pull/261/files#diff-3be30f7bdb800e13e391bcc496c5ccb2e9d201e3f41204b4d8216b75353b92f7 |
|
README.md
| https://github.com/cloudfall-dev/cloudfall/pull/261/files#diff-00ba42324c784ebcf27766700a3924a25e593009a52d5431331d42bef9edd2e9 |
|
app.py
| https://github.com/cloudfall-dev/cloudfall/pull/261/files#diff-80944e9d32bf3de16b8f897a076d9413719c085027f33cffff3fd7b0358d8763 |
|
commands.py
| https://github.com/cloudfall-dev/cloudfall/pull/261/files#diff-e11cc5881f876e11cf81d9bcb39f0fb74710976f27a01a99fb979dfc76c09cc1 |
|
component_lock.py
| https://github.com/cloudfall-dev/cloudfall/pull/261/files#diff-bf51dc445edbdccac4365b7e8d6c89de809c4beab3ef73708415ca0a62e9747f |
|
lifecycle.py
| https://github.com/cloudfall-dev/cloudfall/pull/261/files#diff-6593e43e7c2a82c570ff2144303fbc6af72efaf8ff8a4075fcc8733b8d86b4d8 |
|
lifecycle_error.py
| https://github.com/cloudfall-dev/cloudfall/pull/261/files#diff-de5f1fb4be2676fe3b8e042eb1e8dd32e399bf726cdc1c8d214d7df0ae1c9d01 |
|
test_component_lock.py
| https://github.com/cloudfall-dev/cloudfall/pull/261/files#diff-a6be1994b8d25e771f8917543401999b56bca20a2719ae8c48efb242359cf805 |
| changelog.d/221-component-lock.md | https://github.com/cloudfall-dev/cloudfall/pull/261/files#diff-3be30f7bdb800e13e391bcc496c5ccb2e9d201e3f41204b4d8216b75353b92f7 |
|
View file
| https://github.com/cloudfall-dev/cloudfall/blob/bdbe3f6a43fbd28d5d6ad410fbcd17dde2726f2c/changelog.d/221-component-lock.md |
|
Open in desktop
| https://desktop.github.com |
| https://github.co/hiddenchars |
| https://github.com/cloudfall-dev/cloudfall/pull/261/{{ revealButtonHref }} |
| sdk/README.md | https://github.com/cloudfall-dev/cloudfall/pull/261/files#diff-00ba42324c784ebcf27766700a3924a25e593009a52d5431331d42bef9edd2e9 |
|
View file
| https://github.com/cloudfall-dev/cloudfall/blob/bdbe3f6a43fbd28d5d6ad410fbcd17dde2726f2c/sdk/README.md |
|
Open in desktop
| https://desktop.github.com |
| https://github.co/hiddenchars |
| https://github.com/cloudfall-dev/cloudfall/pull/261/{{ revealButtonHref }} |
|
| https://github.com/cloudfall-dev/cloudfall/pull/261/files#diff-00ba42324c784ebcf27766700a3924a25e593009a52d5431331d42bef9edd2e9 |
|
| https://github.com/cloudfall-dev/cloudfall/pull/261/files#diff-00ba42324c784ebcf27766700a3924a25e593009a52d5431331d42bef9edd2e9 |
| sdk/src/cloudfall/app.py | https://github.com/cloudfall-dev/cloudfall/pull/261/files#diff-80944e9d32bf3de16b8f897a076d9413719c085027f33cffff3fd7b0358d8763 |
|
View file
| https://github.com/cloudfall-dev/cloudfall/blob/bdbe3f6a43fbd28d5d6ad410fbcd17dde2726f2c/sdk/src/cloudfall/app.py |
|
Open in desktop
| https://desktop.github.com |
| https://github.co/hiddenchars |
| https://github.com/cloudfall-dev/cloudfall/pull/261/{{ revealButtonHref }} |
|
| https://github.com/cloudfall-dev/cloudfall/pull/261/files#diff-80944e9d32bf3de16b8f897a076d9413719c085027f33cffff3fd7b0358d8763 |
|
| https://github.com/cloudfall-dev/cloudfall/pull/261/files#diff-80944e9d32bf3de16b8f897a076d9413719c085027f33cffff3fd7b0358d8763 |
|
| https://github.com/cloudfall-dev/cloudfall/pull/261/files#diff-80944e9d32bf3de16b8f897a076d9413719c085027f33cffff3fd7b0358d8763 |
|
| https://github.com/cloudfall-dev/cloudfall/pull/261/files#diff-80944e9d32bf3de16b8f897a076d9413719c085027f33cffff3fd7b0358d8763 |
|
| https://github.com/cloudfall-dev/cloudfall/pull/261/files#diff-80944e9d32bf3de16b8f897a076d9413719c085027f33cffff3fd7b0358d8763 |
|
| https://github.com/cloudfall-dev/cloudfall/pull/261/files#diff-80944e9d32bf3de16b8f897a076d9413719c085027f33cffff3fd7b0358d8763 |
|
| https://github.com/cloudfall-dev/cloudfall/pull/261/files#diff-80944e9d32bf3de16b8f897a076d9413719c085027f33cffff3fd7b0358d8763 |
|
| https://github.com/cloudfall-dev/cloudfall/pull/261/files#diff-80944e9d32bf3de16b8f897a076d9413719c085027f33cffff3fd7b0358d8763 |
|
| https://github.com/cloudfall-dev/cloudfall/pull/261/files#diff-80944e9d32bf3de16b8f897a076d9413719c085027f33cffff3fd7b0358d8763 |
|
| https://github.com/cloudfall-dev/cloudfall/pull/261/files#diff-80944e9d32bf3de16b8f897a076d9413719c085027f33cffff3fd7b0358d8763 |
|
| https://github.com/cloudfall-dev/cloudfall/pull/261/files#diff-80944e9d32bf3de16b8f897a076d9413719c085027f33cffff3fd7b0358d8763 |
|
| https://github.com/cloudfall-dev/cloudfall/pull/261/files#diff-80944e9d32bf3de16b8f897a076d9413719c085027f33cffff3fd7b0358d8763 |
|
| https://github.com/cloudfall-dev/cloudfall/pull/261/files#diff-80944e9d32bf3de16b8f897a076d9413719c085027f33cffff3fd7b0358d8763 |
|
| https://github.com/cloudfall-dev/cloudfall/pull/261/files#diff-80944e9d32bf3de16b8f897a076d9413719c085027f33cffff3fd7b0358d8763 |
|
| https://github.com/cloudfall-dev/cloudfall/pull/261/files#diff-80944e9d32bf3de16b8f897a076d9413719c085027f33cffff3fd7b0358d8763 |
| sdk/src/cloudfall/commands.py | https://github.com/cloudfall-dev/cloudfall/pull/261/files#diff-e11cc5881f876e11cf81d9bcb39f0fb74710976f27a01a99fb979dfc76c09cc1 |
|
View file
| https://github.com/cloudfall-dev/cloudfall/blob/bdbe3f6a43fbd28d5d6ad410fbcd17dde2726f2c/sdk/src/cloudfall/commands.py |
|
Open in desktop
| https://desktop.github.com |
| https://github.co/hiddenchars |
| https://github.com/cloudfall-dev/cloudfall/pull/261/{{ revealButtonHref }} |
|
| https://github.com/cloudfall-dev/cloudfall/pull/261/files#diff-e11cc5881f876e11cf81d9bcb39f0fb74710976f27a01a99fb979dfc76c09cc1 |
|
| https://github.com/cloudfall-dev/cloudfall/pull/261/files#diff-e11cc5881f876e11cf81d9bcb39f0fb74710976f27a01a99fb979dfc76c09cc1 |
|
| https://github.com/cloudfall-dev/cloudfall/pull/261/files#diff-e11cc5881f876e11cf81d9bcb39f0fb74710976f27a01a99fb979dfc76c09cc1 |
|
| https://github.com/cloudfall-dev/cloudfall/pull/261/files#diff-e11cc5881f876e11cf81d9bcb39f0fb74710976f27a01a99fb979dfc76c09cc1 |
|
| https://github.com/cloudfall-dev/cloudfall/pull/261/files#diff-e11cc5881f876e11cf81d9bcb39f0fb74710976f27a01a99fb979dfc76c09cc1 |
| Please reload this page | https://github.com/cloudfall-dev/cloudfall/pull/261/files |
| Please reload this page | https://github.com/cloudfall-dev/cloudfall/pull/261/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 |
Response headers:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | no-cache |
Viewport: width=device-width
URLs of crawlers that visited me.