Skip to content

test(e2e): cover the lifecycle of kind: container services - #14167

Merged
cv merged 3 commits into
v1from
test/12568-container-lifecycle
Nov 4, 2026
Merged

cv merged 3 commits into
v1from
test/12568-container-lifecycle

Conversation

@cv

@cv cv commented Nov 4, 2026 •

Copy link
Copy Markdown
Collaborator

Failure

#13093 added kind: container services and said it fixed #12568, but only compile tests, one state test, and the provider's host_container_health tests covered them. Nothing applied a container service through the SDK and the real Docker provider, so these #12568 criteria had no coverage: bounded readiness, unchanged reapply, failures and retries, replacement, and cleanup.

Decision

Add container_service, a Rust system test in crates/nemoclaw-e2e/tests/integration/rust. It deploys a managed Docker gateway, one agent, and three container services, one for each readiness mode: HTTP path, runtimeStatus, and Docker HEALTHCHECK. The tests run through the SDK, the bundle's OpenTofu, and the real Docker provider. The engine is a fake that keeps what the provider creates and reuses test-support/docker_engine.rs for the gateway's storage. The tofu test scenarios mock the Docker provider, so they can't show what it creates, replaces, or deletes, or the provider errors that expect_failures can't catch. The module runs on Unix only, like the other managed Docker gateway tests. No VoiceClaw image, real container, or credential is used.

Criterion Test Result
Apply creates resources, waits for bounded readiness, and leaves no background process apply_waits_for_each_readiness_mode_then_exits_and_reapply_keeps_the_containers Each mode reports starting before ready, and apply waits for it. Each service gets one container and one data volume. After apply returns, the engine and health endpoint get no request for 3 s, longer than the provider's 2 s poll.
Unchanged reapply keeps the healthy service same test An unchanged plan has no changes. Reapply checks readiness again but sends no engine mutation and doesn't touch the sandbox or the Fabric start.
Unhealthy startup, unknown observations, and interrupted setup report actionable failures; retry doesn't duplicate unhealthy_or_unknown_readiness_fails_apply_and_retry_keeps_the_created_containers, readiness_that_never_arrives_times_out_within_its_bound_and_retry_completes, interrupted_setup_is_unfinished_and_retry_completes_without_duplicates Apply fails with the provider's reason: an unhealthy HEALTHCHECK, an undefined runtime status phase (its value isn't echoed), a missing HEALTHCHECK, or a timeout within the 8 s bound. A cancelled apply leaves the deployment unfinished. Each retry creates no second container or volume. The interruption test cancels during the web service's readiness wait, after the provider has created and recorded the container: only that service is deployed, and only its readiness check knows its health path.
Configuration changes follow replacement semantics and ordering a_changed_application_is_replaced_alone_and_keeps_its_volume Changing one service's environment plans delete-then-create for that container only. The old container is deleted before the new one is created. The new container mounts the same data volume and readiness is checked again. The other containers and the agent don't change.
Destroy removes owned resources and keeps external resources and retained data apply_refuses_removal_and_destroy_deletes_owned_applications_keeping_other_resources Destroy deletes every application container and its disposable volume. It keeps the gateway's retained storage and another owner's container, volume, and network. Applying the same document again over the retained storage succeeds.

All six tests passed on their first run against v1 and found no product bug. They stay as regression coverage. The fake engine is not real Docker, so these tests don't establish Docker or VoiceClaw behavior.

The #13093 description reports that retained-state recreation failed during gateway observation in a live run. With container services, destroy followed by apply over the retained gateway storage succeeds against these fixtures. That run doesn't reproduce the live failure, so it doesn't rule it out.

An interrupt during the Docker provider's container create is different. The first version of the interruption test could cancel there, and darwin CI failed: the retry created a second web container. Locally, holding the fake engine's create response and cancelling during it reproduced the same result. OpenTofu stops the Docker provider, which abandons the create request. The engine had already created the container, so the provider never recorded it, and the retry created another. Real Docker would refuse the retry's create because the name is in use. The provider owns its create, so this is outside this PR. Cancelling during the readiness wait never duplicated a container in 36 local runs, 16 of them under CPU load. I didn't observe the darwin run's exact cancellation point.

Part of #12568; depends on the declaration from #12567 (#13093). These criteria remain open:

  • Destroy preserving the intended agent. Destroy removes the whole deployment, including its agents. Apply refuses to remove a container service from the document with apply cannot remove a managed runtime and changes nothing. runtime_bindings in crates/nemoclaw-sdk/src/deployment/runtime.rs refuses any removed docker_volume binding, including the disposable container_storage volume. So no operation removes an application while keeping the agent. The test pins the current refusal. Maintainers need to decide whether apply should remove a container service whose only storage is disposable. I didn't change the policy.
  • Interrupting the provider's container create. An interrupt during the Docker provider's create leaves a container that neither state nor the retry knows, as described above. Per the upstream boundaries, that belongs to the Docker provider or needs a maintainer decision.
  • Live qualification. These tests use fixtures. A live Docker run of a container service isn't part of this PR.

Validation

  • NEMOCLAW_TEST_BUNDLE=$PWD/dist/linux_arm64 cargo test -p nemoclaw-e2e --test integration container_service:: -- --ignored: 6 passed in 11.5 s.
  • cargo ci on Linux ARM64 (base origin/v1): fmt, Clippy, build, 1,812 unit tests, schema, bundle, and 102 lifecycle tests passed. The 6 container_service tests took 44.1 s summed, with the slowest at 11.4 s.
  • cargo ci live-docker didn't run. The change adds only fixture tests and contributor docs and doesn't change what runs in images.
  • CI runs the other platforms. Windows skips the module.

Drive three container services, one per readiness mode, through the SDK,
the bundle's OpenTofu, and the real Docker provider against a fake engine:
bounded readiness, unchanged reapply, actionable failures and retries,
interruption, replacement, refused removal, and destroy.

Part of #12568.
@cv

cv commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator Author
Authoring session — opening
Field Status Value Evidence or limit
Harness partial pi 1.5.0 (Herdr helper agent) Session file schema v3; the release comes from the harness documentation paths in the system prompt, not a version field in the record
Skills recorded test-driven-development (complete read); nemoclaw-contributor-create-pr (complete read) Tool reads in the session record to the cutoff
Instruction files recorded AGENTS.md (injected); WRITING.md (complete read); .github/PULL_REQUEST_TEMPLATE.md (complete read); .github/SESSION_REPORT_TEMPLATE.md (complete read) Startup injection and tool reads in the session record
Tool calls recorded typescript: 116 wrapper calls before the PR description was written Includes failed calls; the wrapper hides nested shell, file, and gh calls
Session window recorded 2026-11-04T02:08Z to 2026-11-04T03:00Z; about 52 min First event to cutoff, including idle time
Compactions recorded 0 Complete record to cutoff; one staged summary of earlier tool results, not a compaction
Models recorded azure/anthropic/claude-opus-5-5 Model change event and assistant messages; no changes
Reasoning levels recorded medium Thinking-level event; no changes

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

cv added 2 commits November 3, 2026 20:11
The interruption test cancelled when the web health endpoint received any
request, while other containers could still be in creation. An interrupt
during the Docker provider's container create loses the provider's record
of a container the engine created, so the retry created a second one, as
in darwin CI. Deploy only the web service, give its health path a unique
token so only its readiness check counts, and assert that the interrupted
apply kept its record before checking that the retry creates nothing.
@cv
cv merged commit 259d08b into v1 Nov 4, 2026
60 checks passed
@cv
cv deleted the test/12568-container-lifecycle branch November 4, 2026 08:01
@wscurran wscurran added area: docs Documentation, examples, guides, or docs build area: e2e End-to-end tests, nightly failures, or validation infrastructure area: security Security controls, permissions, secrets, or hardening chore Build, CI, dependency, or tooling maintenance platform: container Affects Docker, containerd, Podman, or images v1 NemoClaw v1 branch labels Nov 4, 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: docs Documentation, examples, guides, or docs build area: e2e End-to-end tests, nightly failures, or validation infrastructure area: security Security controls, permissions, secrets, or hardening chore Build, CI, dependency, or tooling maintenance platform: container Affects Docker, containerd, Podman, or images v1 NemoClaw v1 branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants