Skip to content

test: replace the managed bearer cleanup lifecycle scenario with SDK and contract tests - #13874

Merged
kaofelix merged 7 commits into
v1from
test/faster-managed-bearer-cleanup
Oct 29, 2026
Merged

kaofelix merged 7 commits into
v1from
test/faster-managed-bearer-cleanup

Conversation

@kaofelix

@kaofelix kaofelix commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

Failure

managed_bearer_cleanup_recovers_damage_keeps_bindings_and_teardown_accepts_both_identities took 40-43 s locally and 54-92 s on linux_amd64 CI. The lifecycle limit is 90 s per test. The scenario runs 14 nemoclaw commands of about 3 s each. About 2 s of each command is the pinned kreuzwerker/docker provider waiting before every docker_network read (#12982).

Decision

Replace the scenario with faster tests. Every NemoClaw behavior it checked still has a test that fails when the behavior breaks, and the affected lifecycle tests drop from about 74 s to about 37 s summed in local runs.

Each check that only this scenario made moves to the fastest test that can still make it.

Most of these checks concern replacement cleanup. When OpenTofu replaces a container but fails to delete the old one, it keeps the old container in state as a deposed object, and the next apply deletes it.

Check New home Cost
The SDK lets apply delete a deposed container, accepts one that is already gone, and lets destroy delete both containers. Export refuses while a deposed container remains. New SDK test replacement_cleanup. It runs Deployment over the scripted OpenTofu. 1.4 s, in the unit and integration step
Pinned OpenTofu and the Docker provider 4.6.0 report a deposed container in the shapes the SDK test uses. New nemoclaw-provider contract test replacement_cleanup. It runs OpenTofu and the provider against the SSH simulator, with no CLI and no network. Under 2 s
Export succeeds while the generated key is readable by others. The bearer scenario's existing export now runs with that key. No extra command

The remaining checks already had faster tests; see Validation.

How the two cleanup tests fit together

The contract test pins what OpenTofu reports. The SDK test feeds the SDK copies of those reports. Each test's comment points to the other.

Engine state Plan entry for the old container
Old container still running, on apply or teardown "deposed":"deadbeef", ["delete"], before.id = old ID
Old container already gone "deposed":"deadbeef", ["no-op"], before and after null

OpenTofu reports no resource_drift entry for the old container in any of these plans, and the contract test asserts that too. So the copies match the real output on every field the SDK reads.

The contract test checks plans and state only. Deleting the old container is OpenTofu's and the provider's job (docs/provider.md, scope), so the test never runs tofu apply on the deposed container.

Why the key check stays in a lifecycle scenario

docs/inference.md promises that export does not need the inference key. Two things keep that true: readiness reads the key only during apply, and no provider reads it during refresh. A unit test could cover only one provider's refresh. The lifecycle scenario covers every provider and the SDK at once, and reusing its export costs no extra time.

Validation

Coverage

I removed each production behavior the deleted scenario guarded, one at a time. For each removal I rebuilt the bundle from the changed code and ran the unit, integration and lifecycle tests. An unchanged control run passed everything.

Behavior removed Tests that fail
Export refuses pending cleanup SDK unit test of plan scope; replacement_cleanup (SDK)
Apply accepts the old container's delete Same SDK unit test; replacement_cleanup (SDK)
Apply accepts an old container that is already gone Same SDK unit test; replacement_cleanup (SDK)
Destroy accepts the old container's delete Two SDK unit tests; replacement_cleanup (SDK)
Readiness checks the key's file mode nemoclaw-provider unit test for vLLM readiness; proxy readiness contract test
vLLM readiness reads the key The same nemoclaw-provider unit test
Refresh never reads the key (removed by making the OpenShell provider's refresh refuse an insecure key) Only the bearer scenario, at its export
Storage refuses a volume on another daemon nemoclaw-docker storage unit test
Storage refuses a substituted volume None needed: nemoclaw-tofu refuses any change of bound ID, and the service_storage contract test asserts that through OpenTofu

The scenario's other checks repeated other scenarios. A failed plan or apply leaves state and the engine unchanged in the vLLM and Ollama remote_service scenarios. Teardown with an incompatible image runs in the same two scenarios.

A second change showed where the export guarantee comes from. Making export plan the whole graph, readiness included, still passed the key check, because readiness defers its key read to apply. So the guarantee rests on readiness and refresh, not on how export builds its configuration.

Runtime

Local runs on macOS, two runs each, with the same bundle:

Test origin/v1 This PR
Deleted scenario 40.4 s, 40.3 s —
Bearer scenario 34.0 s, 34.1 s 34.4 s, 35.0 s
Cleanup contract test — 1.9 s, 1.7 s
Summed about 74 s about 37 s

CI times, from the two latest v1 runs and this PR's run:

Platform Deleted scenario on v1 Cleanup contract test on this PR
linux_amd64 59.7 s, 67.9 s 4.7 s
linux_arm64 58.7 s, 56.1 s 2.5 s
darwin_arm64 80.9 s, 102.8 s 4.2 s
windows_amd64 114.8 s, 91.7 s Not run; the test is Unix-only

The bearer scenario's CI times on this PR stay within its range on v1.

The nemoclaw-provider contract tests stay within their 82 s budget.

Checks run

cargo ci passed locally. I did not run live-docker or live-kind locally, because nothing that runs in images or on Kubernetes changed; CI ran both and they passed. CI's lifecycle tests passed on all four platforms.

Limits

  • No single end-to-end run. OpenTofu's output and the SDK's handling of it are checked in two tests linked by copied shapes. If an OpenTofu or provider upgrade changes the shapes, the contract test fails and the SDK test's copies must be updated by hand.
  • The old container is written into state by the test. OpenTofu leaves an old container in state only for resources with create_before_destroy, which NemoClaw's graphs never set. The deleted scenario wrote this state by hand as well. Inference: the SDK handles a state that NemoClaw does not produce today.
  • Unused simulator code. The SSH simulator's cleanup_failure control no longer has a caller. Removing it changes code that every simulator request goes through, so it is left for a separate change.

…un in parallel

The scenario spent about 40 s locally on 14 nemoclaw commands, each paying the Docker provider's 2 s network refresh; CI runs of it took 54-92 s against a 90 s budget. Cleanup recovery with damaged storage and the failure, key, and teardown checks now run in scenarios of their own, each with one runtime, so the lifecycle profile runs them side by side.
…K test

Both lifecycle scenarios are deleted. Replacement cleanup, the export refusal
while it is pending, and teardown with a deposed container now run through
Deployment over scripted OpenTofu, with plans in the shapes OpenTofu 1.12.9
and the Docker provider 4.6.0 reported for them. Their other checks already
fail in unit and contract tests when the behavior they guard is removed.
@github-actions

Copy link
Copy Markdown
Contributor

@wscurran wscurran added the v1 NemoClaw v1 branch label Oct 27, 2026
@kaofelix
kaofelix marked this pull request as draft October 27, 2026 22:42
@copy-pr-bot

copy-pr-bot Bot commented Oct 27, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

…key export check

The SDK test reads canned plans; a provider contract test now checks that
pinned OpenTofu and the Docker provider produce them. The bearer scenario
again shows that export succeeds while the generated key is insecure and
apply refuses it.
@kaofelix kaofelix changed the title test: replace the managed bearer cleanup lifecycle scenario with a scripted SDK test test: replace the managed bearer cleanup lifecycle scenario with SDK and contract tests Oct 27, 2026
…he cleanup contract test

The bearer scenario's export now runs while the generated key is readable by
others, which adds no command. The contract test checks only the plans and
state the SDK reads, including that drift reports nothing for the old
container; deleting the old container is OpenTofu's job.
@kaofelix

Copy link
Copy Markdown
Collaborator Author
Authoring session — opening
Field Status Value Evidence or limit
Harness recorded Claude Code CLI 2.1.311; 2.1.312 from 2026-10-29T09:02Z Version on each record entry; one upgrade
Skills recorded nemoclaw-contributor-create-pr (injected) Skill invocations to cutoff; skill listings without contents not counted
Instruction files recorded AGENTS.md (injected); user memory index (injected); WRITING.md (complete read); user memory validation-is-evidence (complete read); .github/PULL_REQUEST_TEMPLATE.md (complete read); .github/SESSION_REPORT_TEMPLATE.md (complete read) Instruction injections and read results to cutoff
Tool calls recorded Bash: 214; Write: 5; Read: 4; Edit: 3; Skill: 1 Harness-level calls to cutoff, including 3 failed calls; commands nested inside Bash (cargo, gh, scripts) are not counted; no subagents
Session window recorded 2026-10-27T19:39Z to 2026-10-29T09:49Z; 38 h 10 min First record event to cutoff, including idle time; excludes an earlier session on this branch (2026-10-27T14:44Z to 19:39Z) whose intermediate commit splitting the scenario this PR's diff removes
Compactions recorded 1 Compaction boundary at 2026-10-27T22:29Z; the persisted record before it was inspected
Models recorded claude-opus-5-5 Model on every assistant turn; no changes
Reasoning levels recorded medium Effort recorded on every assistant turn; no changes

@kaofelix
kaofelix marked this pull request as ready for review October 29, 2026 11:29
@kaofelix
kaofelix merged commit e9dc7fb into v1 Oct 29, 2026
65 checks passed
@kaofelix
kaofelix deleted the test/faster-managed-bearer-cleanup branch October 29, 2026 14:14
@wscurran wscurran added area: e2e End-to-end tests, nightly failures, or validation infrastructure chore Build, CI, dependency, or tooling maintenance labels Oct 29, 2026
@cv cv added this to the Roadmap: GTC DC 2026 milestone Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: e2e End-to-end tests, nightly failures, or validation infrastructure chore Build, CI, dependency, or tooling maintenance v1 NemoClaw v1 branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants