Repository navigation
fix(sdk): let an interrupted apply finish the OpenTofu operations in progress - #14224
Merged
Merged
Conversation
…progress An interrupt during an apply or destroy sent SIGINT to OpenTofu and killed its process group 5 seconds later. OpenTofu was still waiting for the operations in progress, so a Helm install was left pending-install and the bindings of resources already created could be missing from the state (#14155). The first interrupt now lets OpenTofu stop by itself: it starts no further resource operations, finishes those in progress, and saves the state. The SDK emits Progress::Stopping while it waits, and Deployment::with_force_stop ends OpenTofu at once; the CLI cancels that token at a second interrupt, which its stopping notice explains. Other OpenTofu commands keep the 5-second grace. Refs #14155 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The script that stands in for OpenTofu waited in an endless loop for the interrupt. A shell that starts with interrupts ignored, such as a job that a non-interactive shell runs in the background, cannot trap them, so the test hung there. The wait now ends after 30 seconds and the test fails instead. OpenTofu itself installs its interrupt handler even when it starts with interrupts ignored. Refs #14155 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
Authoring session — opening
|
Contributor
|
v1 documentation preview: https://nvidia-preview-nemoclaw-v1-pr-14224.docs.buildwithfern.com/nemoclaw |
cv
added a commit
that referenced
this pull request
Nov 5, 2026
…rrupted (#14169) Managed Kubernetes and OpenShift gateways recover from an install that fails: Helm removes the failed release itself, a release that a stopped install leaves is named with the command that removes it, and an interrupted first apply keeps the bindings it created. ## Problem An apply that failed or was interrupted while Helm installed the gateway release left a deployment that neither apply nor destroy could recover (#14155): - When Helm's 600-second wait timed out, the release stayed `failed` in the cluster, but the pinned Helm provider (3.3.0) returned the error without saving the release in the state. The next apply failed with `cannot re-use a name that is still in use`, and destroy failed with `observation is incomplete`; only `helm uninstall`, then destroy and apply, recovered the deployment. - In a state directory without a state file, OpenTofu saved an interrupted apply's snapshot with only the last resource it updated, so the storage binding was lost and plan and destroy refused. Resolves #14155, with #14224, which lets the first interrupt finish the operations in progress. ## Change - The gateway release sets `atomic`: when its install fails or Helm's wait times out, Helm uninstalls the release before the Helm provider returns, and the error carries Helm's reason. The namespace, the credential key, and the gateway's volume claims stay. A failed upgrade now rolls back, as `helm upgrade --atomic` does. - A second interrupt, a crash, or a killed process can still stop the install and leave the release `pending-install`. When the cluster records the gateway release and the state does not bind it, plan, apply, and destroy stop before changing anything, name the release, and give its `helm uninstall` command (`Error::UnboundRelease`). NemoClaw can't tell that release from another owner's, so it leaves it. - The `kind-kubernetes-development` live case refuses the gateway's StatefulSet with an admission policy between its destroy and redeploy (the `hcl_live::admission` probe): the install must fail with the refusal, leave no record of the release, and keep the retained storage bound. It replaces the same check in the Rust gateway live test that #14174 retired. - When the state file is missing, a refresh-only apply of an empty configuration creates it before the first plan, which avoids the OpenTofu bug without reading the deployment's data sources before the managed gateway exists. - Rejected: the first version of this pull request recorded each install in `helm-install.json` and let destroy remove a leftover release through a separate OpenTofu root; `atomic` covers the common failures with much less code. `upgrade_install` doesn't help: Helm refuses to upgrade a `pending-install` release, and it would take over a release by name alone. - Upstream boundaries: Helm's own `atomic` option removes a failed install, the existing authentication observation establishes that a release record exists, and NemoClaw removes no release that it can't establish as its own. `internal-docs/design/scope.md` records both workarounds: - the state file, until OpenTofu fixes opentofu/opentofu#4809 (since v1.11.0); - `atomic` and the unbound-release check, until the Helm provider saves a failed install as tainted again, hashicorp/terraform-provider-helm#1886 (since 3.0.0). #14227 tracks removing both. ## Beyond CI On the single-node OpenShift 4.22.18 cluster from #14139, with this branch's bundle at 06be60b, which already carried #14224's change, and the document from #14155's runs (OIDC profile, one OpenClaw sandbox): - Helm's 600-second wait timed out while the gateway's OIDC issuer was unreachable. The apply failed with "release nc-6fe4115dbd9285c4-gateway failed, and has been uninstalled due to atomic being set: context deadline exceeded" and left no release record. The state kept storage and authentication, and the namespace kept the gateway's volume claim and its key. With the issuer back, plan installed the release again without refusing, apply completed in 67 seconds, and the agent replied. - One interrupt during the install, with the issuer reachable again 2 seconds later: the CLI printed the stopping notice, Helm's install completed after 49 seconds, and the apply stopped with exit code 130. The state bound the release; a reapply completed in 32 seconds, and the agent replied. - Two interrupts 10 seconds apart: the apply stopped at once, leaving the release `pending-install` without a binding while the state kept storage and authentication. Plan and destroy stopped within 5 seconds, named the release and its `helm uninstall` command, and left the release records unchanged. After that command, apply completed in 67 seconds, and the agent replied. --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Carlos Villela <cvillela@nvidia.com>
4 tasks done
cv
added a commit
that referenced
this pull request
Nov 11, 2026
…ms (#14413) The release notes now list every user-visible change on `v1` since the `v0.1.0-rc9` tag, including the breaking ones, and four example pages drop claims that later changes made false. ## Problem `docs/about/release-notes.md` listed three breaking changes and none of the features, fixes, and onboarding changes that reached `v1` after `v0.1.0-rc9`; it didn't name the configuration shapes the parser now rejects or the intent record version `v0.1.0-rc9` writes. Some example claims went stale: - `examples/spark/README.md` said the pinned OpenShell has the Podman TLS initialization blocker, ai-openshell/openshell#3427; its fix merged before OpenShell 0.1.0, and `v1` pins 0.1.7. - `examples/station/README.md` and `examples/gtc-dc/README.md` required exactly one visible GPU on the host; since #13929, `container.gpuDevices` lets a service on a host with more GPUs request one. - `examples/hcl/travel-team` said Fabric's Deep Agents adapter can't turn reasoning off, NVIDIA/NeMo-Fabric#433; NVIDIA/NeMo-Fabric#439 fixed that, and the pinned catalog's Deep Agents `reasoning_effort` accepts `none`. - The travel team cited #13313 for the booking key its service doesn't receive, but #13313 closed when `openshell_api` landed. ## Change - `docs/about/release-notes.md` gains "Changes Since v0.1.0-rc9", grouped by area, from the commits in `v0.1.0-rc9..origin/v1`; where a later commit changed an earlier one, the entry describes the current code, and changes added and removed after the tag aren't listed: - Agents and interfaces: #14037, #14038, #14269, #13981, #14024, #14186, #14052, #14385, #13971, #13858, #13947, #14039, #14042, #14044, #14343. - Inference: #13929, #14391, #14396, #14398, #14400, #13963, #13912, #13964, #14388, #14390, #14397. - Gateways and Kubernetes: #13909, #13970, #13922 (an existing namespace, refused at plan by #13756, is now bound; cluster-wide reads dropped), #14014, #14169, #13921. - Plan, apply, and diagnostics: #14224, #13756, #14141, #14133, #14135, #13775, #13744, #13701. - Onboarding: #13693, #13695, #13741, #13757, #13851, #13978, #14228, #14233, #14334, #14336. - Examples and builds: #14166, #14184, #14188, #14191, #14192, #14200, #13889, #14267, #14312, #14315, #14355, b30e9b4, #13781, #13813, #14246, and the pins in `versions.json` and `image/fabric/Dockerfile`. - Its breaking changes since the tag: - the intent record moving from 15, which `v0.1.0-rc9` writes, through 16 (#14266), 17 (#14343), 18 (#13929), 19 (#14391) and 20 (#14394); - name-keyed `sandboxes` and `inferenceProviders` (#13703, #13705); - a recipe `compatibility.gpu` outside every hardware profile (#13912); - model tuning the adapter doesn't accept (#14111), and Hermes's `max_tokens` losing its default (#14296); - `skills.paths` resolution (#14296); - endpoint and `networkCIDR` validation (#13847, #14081); - the HCL `gateway_values` attribute (#14014), and Kubernetes ownership receipts from before #13922 and #14014. The two earlier items stay, under their own heading. - `examples/spark/README.md` replaces the closed OpenShell#3427 blocker with the Podman and remote-model limits in `docs/resources/limits.md`. - `examples/station/README.md` and `examples/gtc-dc/README.md` require one GPU visible in the model container, and point to `container.gpuDevices` for a host with more. - `examples/hcl/travel-team/README.md` and `WALKTHROUGH.md` drop the NeMo-Fabric#433 limitation, and the travel team's booking-key statements link #14417 instead of #13313. Not listed, because both changes landed after the tag: Deep Agents Code (#14043, #14250), `compatibility.gpuCount` (#14391, #14394), and the "Creating infrastructure state" progress step (#14169, #14248). Checked and left unchanged: the root `README.md`, `crates/nemoclaw-onboarding/README.md`, `crates/nemoclaw-cli/assets/README.md`, `internal-docs/README.md`, the other example READMEs, and every example YAML header comment. The GPU autoscaling README and `load.sh` read the JSON fields `OperationResult` serializes, and ai-openshell/openshell#4287 is fixed only after the pinned 0.1.7. The two pre-tag release-note items still match the schema and SDK. `docs/README.md` is left to #14412, which retires the stale field reference snapshot it describes. Not verified: whether Hermes sends the booking key's placeholder to MCP servers; #14417 tracks the live check. ## Beyond CI Each relative link and anchor in the changed files resolves to an existing file and heading.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Failure
On an interrupt, an apply or destroy sent SIGINT to OpenTofu and killed it 5 seconds later, even when OpenTofu was still waiting for a resource operation in progress.
On a managed Kubernetes or OpenShift gateway, that operation is often the Helm provider's install, which waits up to 600 seconds for the gateway and can't be cancelled: the provider runs Helm without a context (hashicorp/terraform-provider-helm#776, closed without a change).
The kill then left the gateway's Helm release
pending-installin the cluster without a binding in the state, which no later apply or destroy could recover (#14155, run r5).Decision
After the first interrupt, an apply or destroy lets OpenTofu finish the resource operations in progress and save the state: OpenTofu's own interrupt handling stops it from starting new ones.
The CLI shows a durable stopping notice that says how to stop at once, and a second interrupt (
Deployment::with_force_stop) does.Other OpenTofu commands keep the 5-second grace.
This matches
tofu apply, where the first interrupt lets operations in progress finish and a second stops at once.Split from #14169, as its review suggested; #14169 carries the same two commits until this merges.
test(sdk): end the interrupted apply test's wait after 30 secondskeeps the interrupt test from hanging where a shell starts with interrupts ignored.Refs #14155
Validation
cargo cion macOS arm64 at 6f9bbba: every step passed, including 1771 tests in the test step and 101 in the lifecycle step. Live / Docker and Live / Kind run only on Linux, in this pull request's CI.process::tests::an_interrupted_apply_waits_until_opentofu_exits: with the former 5-second grace, "OpenTofu was stopped before it finished the operations in progress".kubernetes_interruption::stopping_now_after_an_interrupt_ends_opentofu_at_once, with a scripted OpenTofu: "the apply took 5.01s to stop after it was told to stop now"; without the new progress event, "the caller was not told that the apply is stopping".stopping_is_a_durable_warning_that_says_how_to_stop_now: no notice without the new progress arm.v1moveddocs/reference/cli.mdtodocs/references/cli.mdsince fix(sdk): recover from a gateway Helm install that failed or was interrupted #14169 began; the cherry-pick keeps both interrupt sentences withv1's new link, as fix(sdk): recover from a gateway Helm install that failed or was interrupted #14169 does after its merge ofv1.🤖 Generated with Claude Code