Skip to content

test(e2e): reapply on kind with three separate agents that answer a fixed stub - #13551

Merged
cv merged 10 commits into
v1from
test/12734-kind-reapply
Oct 26, 2026
Merged

cv merged 10 commits into
v1from
test/12734-kind-reapply

Conversation

@gaveezy

@gaveezy gaveezy commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Failure

#12734 asks the Kind suite to show that a deployment survives an unchanged apply and a reapply of its export, that several agents keep separate identities, and that agents keep running and answer. The shared flow behind the OpenShift-profile and registry tests deployed one agent, applied once, exported and destroyed, and sent no request. A failed apply printed only the SDK's summary.

Decision

flowchart LR
    subgraph T["Test: SDK + bundled OpenTofu and providers"]
        direction TB
        A["1 apply"] --> U["2 unchanged apply"] --> R1["3 request round"]
        R1 --> X["4 export"] --> RA["5 apply the export"] --> R2["6 request round"] --> D["7 destroy"]
    end
    subgraph K["kind (CI) or k3s (local)"]
        subgraph N["deployment namespace, OpenShift UID range"]
            GW["OpenShell gateway"]
            S1["assistant (Pi)"]
            S2["researcher (Pi)"]
            S3["reviewer (Pi)"]
        end
        STUB["stub model<br/>own namespace"]
    end
    T -- "Helm, OpenShell API" --> GW
    T -- "fabric-agent-ctl invoke" --> S1 & S2 & S3
    S1 & S2 & S3 -- "policy rule" --> STUB
Loading
Step Checks
1 apply Every agent starts; in the OpenShift-profile test, the gateway and agent pods run as the namespace's first UID.
2 unchanged apply No changes; sandbox IDs, agent bindings and runtime IDs unchanged.
3, 6 requests Each agent answers from the first apply's runtime with the stub's per-run value.
4, 5 export Export equals the document; its apply changes nothing; state equals step 2's.
7 destroy Sandboxes gone within 60 s; namespace, key and PVC UIDs kept.
  • The three agents share the OpenShift-profile test's gateway, to stay within the 270 s Kind budget. The registry test keeps one agent.
  • Fabric reports no runtime status (fabric-agent-ctl: read-only status command for the owned runtime NeMo-Fabric#420), so an answer from the first runtime ID is the evidence the agent still runs.
  • The stub is the pinned nginx image the OIDC test already uses. It establishes the request path, not inference.
  • The Pi route declares input: ["text"], as examples/fabric-pi.yaml does; without it every request failed.
  • State is compared from step 2 on, because the first apply leaves two fields for the next refresh.
  • On a failed apply or request, the test prints pod states, logs and events.
  • Request rounds are capped at 30 s.

Validation

  • cargo ci passed after merging v1 with test(e2e): report one failed agent among three and correct the lifecycle test guides #13483: 1612 unit and 152 lifecycle tests.
  • On local k3s (arm64) with CI's Pi image, the Kind profile without the registry test passed twice. The request-sending test took 87–91 s of its 120 s limit.
  • Checks fail when they should: requests to a stale runtime ID got runtime_unavailable, and requests before the input fix got pi_model_error.
  • Deferred to CI: kind on both architectures, including the registry test.

Part of #12734.

…pace state on failure

## Failure

#12734 asks the Kind suite to check that an unchanged apply and an
export's apply change nothing on a cluster, and that sandbox and agent
identities survive them. No Kind test did either. The shared helper
behind the OpenShift-profile and registry tests applied once, exported,
compared the export and destroyed. A Kubernetes deployment that planned
changes on reapply, or replaced its sandbox or agent, still passed.

When that helper's apply failed, the test panicked with only the SDK's
summary; only the OIDC test printed the namespace's pods, events and
logs. The OpenShift-profile test could lose even that summary: the
helper waited for the caller's hook after apply had failed, and that
hook waits up to 300 s for the gateway and sandbox pods, longer than
the 240 s after which nextest stops a live-kind test. This comes from
reading the code; no run showed it.

## Decision

- Move `sandbox_binding` and `runtime_id` from `dummy_agent` and
  `fabric_live`, and `successful_invocation` with its unit tests, into
  `nemoclaw_e2e::state`. The readers select a sandbox and its agent by
  sandbox name, so the Kind helper can check each sandbox; `dummy_agent`
  and `fabric_live` pass their one sandbox's name, and `dummy_agent` no
  longer checks that the state holds exactly one sandbox.
- After the first apply, the Kind helper applies the document again and
  requires no changes. It then exports, applies the export, requires no
  changes and the same state as the second apply left under
  `assert_same_deployment_state`, and requires each sandbox ID and agent
  runtime ID to be unchanged.
- The state comparison starts at the second apply because the first
  apply leaves two values for the next refresh to record: the sandbox's
  `policy_hash`, empty until the gateway reports the policy loaded, and
  the auth resource's `release_present`, false until the Helm release
  exists. On k3s, comparing with the first apply failed on exactly those
  two values in two of two runs; both are documented provider behavior,
  not drift.
- The helper still destroys before asserting, so a failed check leaves
  no workload behind. The state readers panic when a sandbox or agent
  record is missing, for example after an export's apply removes one;
  the helper holds that panic until destroy has run.
- Move `namespace_diagnostics` from the OIDC test into `kubernetes_live`
  and print it when any apply in the helper fails, while the pods still
  exist. The helper stops waiting on the caller's hook once the first
  apply fails, as the OIDC test already does; after a successful apply
  it still waits for the hook, so the OpenShift-profile test observes
  both pods.
- Update docs/contributing/live-tests.md to describe the shared flow.

The extra applies add time to both callers. If either nears the 120 s
per-test limit, keep the reapply in the OpenShift-profile test only
rather than raising the budget.

## Validation

On linux_arm64:

- On `8a4c45af6`, `cargo ci` passed: fmt, clippy, build, test (1599
  passed, 199 skipped), schema, bundle, and lifecycle (150 passed in
  113 s).
- `cargo nextest run -p nemoclaw-e2e --lib` passed the moved unit tests
  and two new ones. Each of these edits to `nemoclaw_e2e::state` failed
  a test:
  - removing the name or the `managed` mode filter fails
    `readers_select_the_named_managed_sandbox_and_its_agent`;
  - removing the blank runtime ID assertion fails
    `a_blank_agent_runtime_id_is_rejected`;
  - removing the `flatten` call fails
    `sandbox_binding_preserves_the_workspace_from_its_typed_reference`;
  - removing the `error` check fails
    `failed_or_incomplete_results_are_not_successful_invocations`.
- `cargo nextest list --workspace --all-targets --run-ignored only`
  lists the same 7 live-kind and 11 live-docker tests on `origin/v1`
  and on this branch.
- `cargo test -p nemoclaw-e2e --test integration --no-run` compiles the
  live tests.
- `cargo run -p nemoclaw-build -- docs --check` passed.
- On a single-node k3s v1.36.5 cluster with Agent Sandbox v0.5.0, the
  `live-kind` profile without the kind-only registry test passed: the
  gateway, OpenShift-profile and OIDC tests and the three chart tests.
  It passed twice on `7c450df17` and once after rebasing onto
  `8a4c45af6`, each time with the Pi image from that commit's
  `live-images-linux_arm64` CI artifact, imported by digest. The
  OpenShift-profile test took 81-85 s against the 120 s per-test limit,
  about 5 s more than before this change. In one earlier run its first apply failed
  with `observation query failed` after the gateway pod restarted; the
  new diagnostics printed the pods, container logs and events.

Deferred to CI: `cargo ci live-kind` on kind, including
`kubernetes_live::registry`, and `cargo ci live-docker`, because this
host has no Docker or kind. Record the Live / Kind wall time and slowest
test against the 270 s and 120 s budgets (on v1, at most 199 s and
83 s). Live / Docker runs `dummy_agent` with the shared readers.

Part of #12734; this pull request does not close it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

…nd gateway

## Failure

#12734 asks the Kind suite to show that several agents on one cluster
gateway keep separate identities through apply, export, reapply and
destroy (plan point 10: three agents on one Kind gateway). Every Kind
document had one sandbox, `assistant` with agent `main`. No Kind test
could catch a deployment that gave two sandboxes one ID, bound an agent
to another sandbox, put one sandbox's policy on another, or left a
`Sandbox` object behind after destroy.

## Decision

- Budget: the plan's fallback, not a separate test. CI measured this
  pull request's `live-kind` suite at 188 s on arm64 and 182 s on amd64
  against the 270 s budget, with the OpenShift-profile test at 75-76 s
  against its 120 s limit, on 4-vCPU runners. Another test with its own
  gateway install was too likely to break the budget. The three agents
  share the OpenShift-profile test's gateway instead.
- `agent_document`, split out of `deploy_image_and_export`, takes
  `(sandbox, agent)` name pairs. All agents use one `inferences` entry
  through `inferenceRef`, as `examples/kubernetes/managed-development.yaml`
  does. Each sandbox also grants one endpoint named for it,
  `<sandbox>.example.test:443`, so no two sandboxes compile the same
  policy. The registry test passes `ONE_AGENT`, the `assistant` sandbox
  with agent `main` it deployed before; its route now comes from the
  shared entry, and its sandbox has the grant.
- The OpenShift-profile test deploys `assistant` (agent `main`),
  `researcher` and `reviewer` from the runner's agent image. Its hook
  waits, within the same 300 s, for all three agent pods and the gateway
  pod, and every one must run as the namespace's first UID. It is
  renamed `on_openshift_three_agents_keep_separate_identities_and_run_as_the_namespace_uid`,
  because the old name described one sandbox. No nextest filter or doc
  named it; the `^kubernetes_live::` filter still selects it.
- For every sandbox it deploys, the shared flow now also requires:
  - its own `openshell_sandbox` ID, with its `fabric_agent` bound to
    that ID. The new `nemoclaw_e2e::state::agent_sandbox_id` reads the
    binding. The flow does not compare Fabric runtime IDs across
    sandboxes: Fabric makes them unique only within one process
    (`new_id` in NeMo-Fabric 5574117), and each sandbox runs its own
    `fabric-agent-ctl serve`, so two agents started in the same
    millisecond can get the same ID.
  - the provider registrations and policy that NemoClaw compiles for
    that sandbox. Export already refreshes each sandbox from the gateway
    and compares both with the values compiled for its address; with
    the grants, a sandbox holding another's policy now fails. This
    checks NemoClaw's mapping; OpenShell enforces isolation, and the
    test does not check that (docs/design/scope.md, upstream
    boundaries).
  - one Agent Sandbox `Sandbox` object per sandbox before destroy, and
    none within 60 s after it. The flow finds the `Sandbox` kind through
    API discovery, so it reads whichever version the cluster serves. A
    missing kind is returned as an error and asserted after destroy.
  The storage UID checks are unchanged, and the flow still destroys
  before asserting.
- After a successful apply, the flow waits at most 30 s more for the
  caller's hook, then continues to destroy. Before, a hook that never
  matched a pod kept waiting up to its 300 s, past the 240 s at which
  nextest stops a `live-kind` test, so destroy never ran. Three pod
  names to match made that more likely.
- The tests request no inference.
- Update docs/contributing/live-tests.md. testing.md does not describe
  this test.

## Validation

On linux_arm64:

- `cargo ci` passed on this change: fmt, clippy, build, test (1599
  passed, 199 skipped), schema, bundle, and lifecycle (150 passed in
  112 s).
- `cargo fmt --all -- --check` and
  `cargo clippy --locked -p nemoclaw-e2e --all-targets -- -D warnings`
  passed.
- `cargo test -p nemoclaw-e2e --test integration --no-run` compiles the
  live tests, and `cargo nextest list --profile live-kind --run-ignored only`
  still lists 7 tests, including the renamed one.
- `cargo nextest run -p nemoclaw-e2e --lib` passed.
  `readers_select_the_named_managed_sandbox_and_its_agent` now also
  covers `agent_sandbox_id`. It did not compile before the reader
  existed, and failed when the reader read the first sandbox's agent for
  every name.
- `cargo run -p nemoclaw-build -- docs --check` passed.
- A temporary test, not committed, applied three sandboxes sharing one
  inference entry through the SDK and this change's bundle against the
  OpenShell fixture gateway, once with the grants and once without. In
  both, the second apply and the export's apply changed nothing, export
  returned the document, the three sandbox IDs differed, and each agent
  was bound to its own sandbox. Swapping `researcher`'s and `reviewer`'s
  policies on the fixture gateway then failed export with the grants
  (`observed ownership, generation, or durable identity changed`) and
  passed without them.
- A second temporary test compiled both callers' documents with the Pi
  harness: one `openshell_inference` for all sandboxes, one provider
  list, three different sandbox policies, and agents for `assistant`,
  `researcher` and `reviewer`.

Not run here: `cargo ci live-kind` and `cargo ci live-docker`, because
this host has no Docker or kind. The live run is deferred to a
single-node k3s run of the `live-kind` profile without the kind-only
registry test, and to CI's Live / Kind jobs, which also run the registry
test. Record the `live-kind` wall time and the OpenShift-profile test's
time against the 270 s and 120 s budgets. If that test nears 120 s,
don't raise the budget; discuss moving the three agents out of the
pull-request gate instead.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@gaveezy gaveezy changed the title test(e2e): apply unchanged and reapply the export on kind, with namespace state on failure test(e2e): apply unchanged and reapply the export on kind with three separate agents Oct 21, 2026
…plies

## Failure

#12734 asks development E2E to verify unchanged apply and export/reapply
for multi-agent deployments. Fabric reports no runtime status
(NVIDIA/NeMo-Fabric#420), so a runtime that stops is found only at its
next invocation, and no Kind test invoked an agent. The shared flow
compared sandbox and runtime IDs in OpenTofu state, which stay the same
when the runtime inside a sandbox stops, so a runtime that stopped during
either apply still passed. The agents' endpoint,
`https://inference.example.test/v1`, resolved nowhere, so no agent could
have answered a request.

## Decision

Sending stub-answered requests in the pull-request-gating Kind suite is
this pull request's choice. It is not #12734's model-backed agent
request, which the issue keeps as a separate acceptance check.

- Stub: just before the first apply, after the bundle and environment
  are read, `deploy_image_and_export` creates the namespace
  `nc-model-<hex>`, with the deployment namespace's suffix, holding a
  ConfigMap'd nginx.conf, a one-replica Deployment of the pinned
  `nginx-unprivileged` image the development issuer runs (read from
  versions.json `images.developmentIssuer`), and a ClusterIP Service
  `model` on port 8000. The pod runs like the issuer's: non-root,
  read-only root filesystem, no capabilities. It starts while the
  deployment applies; the flow waits at most 60 s for a ready replica
  just before the first request round. The flow deletes the namespace,
  without waiting, after destroy, or before failing when the first
  apply fails; the deployment itself stays after a failed first apply,
  as before.
- The stub's reply: `POST /v1/chat/completions` gets `return 200` with
  a `text/event-stream` body of OpenAI `chat.completion.chunk` events,
  a role chunk, a content chunk holding `nemoclaw-stub-<16 hex>`, new
  for each run, a `finish_reason: stop` chunk and `data: [DONE]`. That
  is the stream Fabric's Pi relay smoke test serves at 5574117. nginx's
  static handler refuses POST, while `return` discards the request
  body. nginx expands variables and backslash escapes in that text; the
  stream holds no `$`, `'` or `\`, and its line breaks are written as
  `\n`. One constant gives the endpoint's `/v1` and the nginx location.
- Endpoint: the shared inference provider, renamed `stub`, names
  `http://model.nc-model-<hex>.svc.cluster.local:8000/v1` without a key,
  the in-cluster Service form in docs/kubernetes.md. The OIDC test keeps
  its placeholder; it sends no request.
- Requests: after the unchanged apply, and again after the export's
  apply, the flow connects to the managed gateway as the SDK's
  providers do, through `Operations::connect` on the deployment's
  `<state>/kubernetes` with the gateway spec from the sandbox binding's
  `gateway_kubernetes`. It then calls `AgentBridge::invoke_agent` for
  every sandbox at once, with the binding and runtime ID the first apply
  recorded and a text prompt; Pi rejects any other input. No request is
  sent if the first apply's identities were unreadable or the stub was
  not ready; both are asserted.
- Round limit: each round ends after 30 s and abandons a request that
  has not answered, so the flow can reach destroy before nextest stops a
  live-kind test at 240 s; the bridge alone waits up to 330 s. A working
  round takes seconds. Fabric keeps running an abandoned request, and
  one lock in its serve process orders invoke and stop
  (`runtime_server/state.py` at 5574117). The export's round therefore
  skips an agent whose first request was abandoned instead of queueing a
  second prompt, and destroy's stop of that agent waits for the
  abandoned request to end. The test cannot bound that wait: a model
  request that hangs can still keep the test past 240 s and leave the
  deployment and the stub's namespace on a persistent cluster.
- Assertions, after destroy like the flow's other checks: for each
  sandbox and round, `invoke_agent` returned a run whose `runtime_id`
  and `agent_name` are the first apply's, that passes
  `successful_invocation`, and whose output holds the run's stub value.
  Each message names the sandbox and the round and says what was
  observed: a failed request or connection, a request not sent, no
  answer within 30 s, or the run's mismatch. If the stub is not ready
  or a check fails, the flow prints the stub's and the deployment's
  namespace diagnostics before destroy.
- What an answer shows: Fabric's serve process answers only a runtime ID
  that its in-memory map holds as running and active, and returns
  `runtime_unavailable` otherwise; a restarted pod or serve process
  loses the map, and a second start in one process is refused.
  `invoke_agent` returns an error for any failed envelope. So an answer
  after each apply shows that the runtime the first apply started still
  ran, which is the design's own detection (docs/design/fabric-management.md:
  "a runtime that stops is found at its next invocation"). It inspects
  no process and is not a health check. The stub's value shows that
  Pi's request, sent from inside the sandbox under its OpenShell policy,
  reached the stub. It does not establish inference or model
  compatibility, and it is not #12734's `spec.services` item, which the
  schema still rejects on cluster gateways (#12641).
- Both callers send the requests, and docs/contributing/testing.md asks
  that tests sending requests say so in their names. The tests are
  renamed
  `on_openshift_three_agents_keep_separate_identities_run_as_the_namespace_uid_and_answer_after_each_reapply`
  and
  `a_private_agent_image_uses_cluster_secrets_without_credentials_in_state_and_answers_after_each_reapply`.
  The live-kind profile selects them by module (`^kubernetes_live::`,
  and `^kubernetes_live::registry::` to run the registry test alone),
  so no filter changes.
- Shared code: the OIDC test's `create` and `random_hex` move into
  kubernetes_live.rs, and the OIDC test skips the issuer's NetworkPolicy
  where it creates the objects. `gateway_client` builds the client that
  `authenticated_gateway` built inline, and returns a connection error
  instead of panicking, so a round that cannot connect still reaches
  destroy. `agent_document` takes the endpoint and picks its loopback
  port itself.
- Update docs/contributing/live-tests.md: the stub, the requests, the
  round limit and what the requests check. "These live tests request no
  inference" becomes "run no model", with the limit of the stub's reply.
  The page also said the runner builds OpenClaw on AMD64; live-kind
  builds Pi on every platform until #13372 is fixed, and the requests
  rely on Pi, so that line now says so. testing.md names neither test.
- Budget: CI run 39625175941 on 8b07a2a measured Live / Kind at
  174.3 s (arm64) and 183.9 s (amd64) of 270 s, the OpenShift-profile
  test at 73.2 s and 76.3 s of 120 s, and the registry test at 62.2 s
  and 68.2 s. Estimated, not measured: placing the stub adds under 1 s,
  and each round adds a gateway connection and one concurrent set of
  invokes, mostly a cold `fabric-agent-ctl` start, about 3-8 s. If the
  OpenShift-profile test nears 120 s, speed it up or discuss moving the
  requests; don't raise the budget.

## Validation

On linux_arm64:

- `cargo ci` passed in 153 s: fmt, clippy, build, test (1601 passed,
  199 skipped), schema, bundle, and lifecycle (150 passed in 113 s).
- `cargo fmt --all -- --check` and
  `cargo clippy --locked -p nemoclaw-e2e --all-targets -- -D warnings`
  passed.
- `cargo test -p nemoclaw-e2e --test integration --no-run` compiles the
  live tests, and `cargo nextest list --profile live-kind --run-ignored only`
  lists 7 tests, including both renamed ones.
- `cargo nextest run -p nemoclaw-e2e --lib` passed (8 tests), and the
  integration binary's 19 offline tests passed, two of them in
  `kubernetes_live::requests`. They check the flow's own logic, not
  nginx or Pi:
  - `each_agent_must_answer_from_the_first_runtime_with_the_reply`
    failed when the runtime ID, agent name, success or reply check was
    removed, and covers a failed request and an abandoned one.
  - `an_agent_whose_earlier_request_was_abandoned_is_not_asked_again`
    failed with the skip disabled, when both agents were sent a request.
- A temporary test, not committed, compiled both callers' documents
  with the stub endpoint on the `openshift` and `kubernetes` providers.
  Each gave one literal inference server at the Service URL, a rule for
  `model.<namespace>.svc.cluster.local:8000` and `/v1/**` in each
  sandbox's policy, and Pi models with that base URL,
  `openai-completions` and the anonymous key variable.
- `cargo run -p nemoclaw-build -- docs --check` passed.

Not run here: this host has no Docker, kind or nginx. No offline test
checks the stub's stream; the live run does. The live run is pending on
k3s, for the tests that do not need kind, and in CI's Live / Kind jobs.
Untested until then: nginx serving the configured stream, Pi reaching
the Service through OpenShell's host rule on k3s's network, three
concurrent invokes through one port-forward, and the added time.

The Pi route also declares `input: ["text"]` beside `context_window`, as
examples/fabric-pi.yaml does. Without it pi-ai reads `model.input.includes("image")`
on every request, and the first k3s run failed all six requests with
`pi_model_error`. With it, the live-kind profile without the registry test
passed on k3s, and requests to a stale runtime ID failed with
`runtime_unavailable` as intended.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@gaveezy gaveezy changed the title test(e2e): apply unchanged and reapply the export on kind with three separate agents test(e2e): reapply on kind with three separate agents that answer a fixed stub Oct 21, 2026
docs/contributing/live-tests.md conflicted on the sentence about the
runner's agent image: v1 now says "The runner builds Pi", and this
branch says it builds Pi on every platform until OpenClaw can start in
an OpenShell sandbox (#13372). Keep this branch's wording; it states the
same image and the reason, which the request checks rely on.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@gaveezy
gaveezy requested a review from cv October 21, 2026 18:12
docs/contributing/live-tests.md conflicted with #13483 (5b1b48a) in two
places:

- The shared Kind flow: #13483 corrected the old one-agent description;
  this branch replaces it with the three-agent flow, its request rounds
  and the stub. Keep this branch's text.
- The end of the Kubernetes section: #13483 added the OIDC test's
  paragraph, and this branch rewords the "request no inference"
  sentence for the stub. Keep both: the OIDC paragraph, then this
  branch's sentence.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@wscurran wscurran added area: e2e End-to-end tests, nightly failures, or validation infrastructure chore Build, CI, dependency, or tooling maintenance platform: k8s Affects Kubernetes deployments labels Oct 23, 2026
crates/nemoclaw-e2e/tests/kubernetes_live.rs conflicted with #13698
(5583d2b), which added the same Pi model settings this branch adds,
plus a zero cost, in the document builder this branch rewrote. Keep this
branch's builder and its indentation, with v1's `input: [text]` and
`cost` settings. The builder names `{harness}` inline, so it takes no
`harness = harness` argument.

#13698 also lets OpenClaw start in OpenShell sandboxes (#13372), so
live-tests.md takes v1's "The runner builds Pi" in place of this branch's
"until OpenClaw can start" clause.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
gaveezy added a commit that referenced this pull request Oct 25, 2026
Bring in #13551's merge of v1 at df88a97 (f2fd87f). No conflicts.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@cv cv added the v1 NemoClaw v1 branch label Oct 26, 2026
crates/nemoclaw-e2e/tests/kubernetes_live.rs conflicted with #13703
(279ccb5), which keys `inferenceProviders` by name. This branch's
document builder renames the provider `stub`; it now declares it as the
key `stub:` in place of the list entry `- name: stub`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
gaveezy added a commit that referenced this pull request Oct 26, 2026
Bring in #13551's merge of v1 at 279ccb5 (08dfd80), which keys
inferenceProviders by name (#13703). No conflicts.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
#13705 (9106480) keys `sandboxes` by name. Two files conflicted, and
this branch's own code needed the same change:

- kubernetes_live.rs: keep this branch's document builder; each sandbox
  entry is now the key `{sandbox}:` in place of `- name: {sandbox}`.
  `identities` iterates `Document::sandboxes()`, which pairs each name
  with its definition.
- fabric_live.rs: both tests take their sandbox from
  `Document::sandboxes()`, since this branch's state readers need its
  name.
- dummy_agent.rs and fabric_live.rs pass `sandbox.name` directly; it is
  already a `&str`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
gaveezy added a commit that referenced this pull request Oct 26, 2026
Bring in #13551's merge of v1 at 9106480 (d1298f6), which keys
sandboxes by name (#13705). No conflicts.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
cv added a commit that referenced this pull request Oct 26, 2026
Part of #12733.

The managed-gateway live test could run only on kind.
It always deployed `runtime.provider: kubernetes`, so on OpenShift the
chart's UID and fsGroup 1000 fall outside the namespace's range and
`restricted-v2` refuses the gateway pod.
Its last step waited for the gateway's volumes to disappear after
deleting the namespace, which never happens under the `Retain` reclaim
policy of OpenShift Local's default StorageClass.
The OpenShift-profile test writes the namespace's UID range itself, so
on an OpenShift cluster it would replace the range that the cluster
assigns.

This change:

- Adds `NEMOCLAW_TEST_KUBE_RUNTIME` (`kubernetes` by default, or
`openshift`) to the gateway test.
With `openshift`, after each installation every pod in the namespace
must be admitted under `restricted-v2`, run every container as the first
UID of the namespace's range, and use the first supplemental group as
`fsGroup`.
The SCC name is asserted because #12733 asks whether the gateway needs
any SCC grant beyond the cluster's default.
- Before deleting the namespace, switches each volume bound to the
test's PVCs whose reclaim policy is not `Delete` to `Delete`, after
checking that the provisioner created it for that PVC, so that the
provisioner removes the volume and its storage.
  kind's volumes already use `Delete` and are left as they are.
- Makes the OpenShift-profile test refuse a cluster that serves the
`security.openshift.io` API group, before it deploys anything.
- Pins `NEMOCLAW_TEST_KUBE_RUNTIME=kubernetes` in `cargo ci live-kind`,
so a value exported for an OpenShift run cannot reach the kind run.
- Documents the prerequisites, the OpenShift checks, and recovery after
a failed run in `docs/contributing/live-tests.md`, including the chart's
cluster-scoped ClusterRole and ClusterRoleBinding, and updates the
matching sentence in `docs/usage.md`.

## Validation

On OpenShift Local 2.64.0 (OpenShift 4.22.14, Kubernetes v1.35.6, one
arm64 RHCOS node, Agent Sandbox v0.5.0), with a bundle from `cargo ci
bundle`:

- The gateway test with `NEMOCLAW_TEST_KUBE_RUNTIME=openshift` passed in
59.28 s.
The gateway and development-issuer pods ran under `restricted-v2` with
UID and fsGroup 1000670000 in both cycles; afterwards no test namespace,
volume, ClusterRole or ClusterRoleBinding remained.
- The OpenShift-profile test failed at its guard in 0.02 s without
deploying.

Locally: `cargo fmt --check`, `cargo clippy --all-targets -- -D
warnings` for `nemoclaw-e2e` and `nemoclaw-build`, `git diff --check`,
and `cargo run -p nemoclaw-build -- fern check` (0 errors).

Deferred to CI: `Live / Kind`, which runs the gateway and
OpenShift-profile tests on kind and refuses non-Linux hosts, and the
bundle and lifecycle checks that `cargo ci` selects for the changed e2e
crate.

Not covered: sandbox pods on OpenShift (they need an agent image the
cluster can pull), multi-node and amd64 OpenShift, and an existing OIDC
issuer instead of the development one.
#13551 edits the same two files and renames the OpenShift-profile test;
whichever merges second resolves the overlap.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: Carlos Villela <[email protected]>
gaveezy and others added 2 commits October 26, 2026 08:53
Two files conflicted with #13627 (69e0eab), which runs the gateway
live test on OpenShift; #13704 (f2d92ad) switched the live agent to
OpenClaw without conflicts. Keep both sides:

- kubernetes_live.rs: this branch's `random_hex` and `create` helpers
  and #13627's `runtime_provider`. The OpenShift-profile test starts with
  #13627's refusal of a cluster that serves `security.openshift.io`,
  then deploys this branch's three agents.
- live-tests.md: this branch's description of the shared flow, with
  #13627's sentence about that refusal after the UID-range sentence.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
gaveezy added a commit that referenced this pull request Oct 26, 2026
Bring in #13551's merge of v1 at 69e0eab (15ce41e): the live agent is
now OpenClaw (#13704), and the OpenShift-profile test refuses OpenShift
clusters (#13627). No conflicts.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
gaveezy added a commit that referenced this pull request Oct 26, 2026
Bring in 49b5e74 from #13551, which rewords two comments in
kubernetes_requests.rs for OpenClaw as well as Pi. No conflicts.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@cv
cv enabled auto-merge (squash) October 26, 2026 09:17
@cv
cv merged commit 62f994b into v1 Oct 26, 2026
52 checks passed
@cv
cv deleted the test/12734-kind-reapply branch October 26, 2026 09:25
gaveezy added a commit that referenced this pull request Oct 26, 2026
#13551 merged into v1 as a squash (62f994b), so this branch and v1
held the same changes in different commits, and the merge conflicted in
crates/nemoclaw-e2e/tests/kubernetes_oidc.rs. The squash matches #13551's
final head (49b5e74) in every file it touched, so the file was merged
three ways with that head as the base: this branch's own change on one
side and v1's on the other. The result differs from v1 by exactly this
pull request's own changes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
cv added a commit that referenced this pull request Oct 26, 2026
…es (#13724)

## Failure

On a pull request that selects the live suites, the slowest path is
Linux AMD64's `Build live images` (6.3 to 7.2 min), then `Live / Kind`.
Both live jobs on each platform then download the 1 GB live-images
archive, 202 to 205 s each, before their tests start. In #13551's last
run, `Live / Kind` took 10.8 min for 3.9 min of tests, and the whole
workflow took about 20 min.

Most pull requests change no image input, and v1 already pushes each
image-changing commit's checked agent and proxy images to
`ghcr.io/nvidia/nemoclaw/v1-ci`.

## Decision

```mermaid
flowchart LR
    P["plan: changes live-images"] -->|v1 commit found| L["Live / Docker, Live / Kind<br/>pull that commit's images"]
    P -->|none| B["Build live images<br/>(unchanged)"] --> A["live jobs load the archive"]
```

- **Planner:** `nemoclaw-build changes live-images --base REV` names the
newest of the latest 30 commits on the base's first-parent history that
pushed the agent, reference, and proxy images for both architectures,
provided the image rules find no change between it and `HEAD`. Checking
the image rules against that commit, not the merge base, also covers a
v1 commit whose image run a later push cancelled. Any failure leaves the
live suites to build, as today, including fork pull requests that can't
read the package.
- **Workflows:** the plan job reads the package (`packages: read`,
granted by `rust.yml` and `images.yml`). `Build live images` is skipped
when the plan names a commit. The live jobs then run with explicit
result checks, so a skipped build only stands in for a named commit and
never silently skips them.
- **`cargo ci live-docker|live-kind --images-commit COMMIT`:**
`live-docker` pulls the three images and derives the proxy pair from the
pushed proxy with one label each, as `ci live-images` builds it.
`live-kind` pulls the agent straight into the kind node with `ctr` and
reads its metadata bundle from the registry: a Docker save of a pulled
image lacks its config, so neither can go through the host engine.
Registry credentials reach `ctr` through the environment and are removed
before the tests run.
- **v1 pushes:** they also push the reference `dummy` image, which
`image-build.yml` already builds and qualifies, without an SBOM;
releases select their images from the Bake `agents` group and the proxy,
so it doesn't reach them.

v1 pushes and this PR, which changes `nemoclaw-build`, still build the
live images: reuse only starts once v1 has pushed `dummy`.

## Validation

- New tests failed first: three planner cases (reuse, an image change
since the pushed commit, an incomplete push) and two `ci` cases (the
pull path and its flag rules).
- `cargo ci`: 1,694 unit and 156 lifecycle tests pass; clippy is clean;
`fern check` reports 0 errors; `actionlint` reports only the existing
`images.yml` finding.
- `cargo ci live-kind --images-commit
69e0eab` on a GB10 (arm64), pulling
v1's pushed OpenClaw image: 7 of 7 pass, including the registry test,
which pushes the node's copy; no token appears in the log.
- Not run for real: `live-docker` pulling, because v1 hasn't pushed
`dummy` yet. The first pull request after this merges and v1 pushes
images will exercise it; its plan summary names the reused commit.

---------

Signed-off-by: Carlos Villela <[email protected]>
cv added a commit that referenced this pull request Oct 26, 2026
…en is refused (#13632)

Part of #12734. It builds on #13551, now merged.

## Failure

The Kind OIDC test used one token for apply, export and destroy, so no
live run showed that NemoClaw reads `token.env` again on each command,
the renewal docs/kubernetes.md documents ("When the token expires, get a
new one and rerun"). The refused plan was checked only for not echoing
the token: nothing showed that a refusal leaves state alone or that no
token reaches the state directory. The issuer's namespace was deleted
only after every check passed.

## Decision

```mermaid
flowchart LR
    K["issuer key<br/>nc-issuer-* namespace"] -->|first token| A["Deployment 1<br/>apply"]
    K -->|other audience| R["Deployment 2<br/>plan: refused"]
    K -->|rotated token, 1 s later| P["Deployment 3<br/>plan: no changes<br/>export = document<br/>destroy"]
    A --> R --> P --> S["no token in any<br/>state file"]
    R -.- U["intent.json, tfstate, kubernetes/<br/>byte-identical; no token in error"]
```

- Refusal: `intent.json`, `terraform.tfstate`, its backup and every file
under `kubernetes/` must be byte-identical before and after the
foreign-audience plan, with none added or removed, and the error text
must hold no token. The refusal surfaces as an OpenTofu execution error,
so its wording and class are not checked. Generated configuration, the
lock file, saved plans, `.terraform`, `.helm` and `diagnostics/` are
left out, because each command writes them.
- Rotation: the test signs a second token with the issuer's key one
second later, so `iat`, `nbf` and `exp` differ. Only a new Deployment
holds it, and it runs plan, export and destroy.
- Secrets: after export and after destroy, no regular file in the state
directory may contain any of the three tokens. The raw-byte search skips
OpenTofu's symbolic links to the bundle and cannot see inside saved
plans, which are zip archives.
- Cleanup: every assertion runs after destroy. If destroy with the
rotated token fails, a separate Deployment with the first token destroys
before the test fails. A drop guard deletes the issuer namespace when
the test passes or panics, bounded at 15 s; a nextest time-limit kill
skips it.
- No red test:
`a_refused_forward_token_is_an_authentication_failure_without_effects`
and `failed_and_partial_observations_retain_protocol_state` cover these
promises against fakes, and no defect is known. A token in state, or
state changed by a refusal, would be a defect to reproduce at the unit
or contract layer first.
- Out of scope: expiry enforcement, which #13422 left to OpenShell.
- docs/contributing/live-tests.md describes these checks and their
limits, and names the token field `token.env` instead of the rejected
`tokenEnv`.

## Validation

- After merging v1 `62f994bf8`, which holds #13551 and switches the live
agent to OpenClaw (#13704), `cargo ci` passed: 156 lifecycle tests.
- The real `cargo ci live-kind` with OpenClaw on linux_arm64 passed 7 of
7, including this OIDC test, at 102.6 s. This host runs Kind about 1.5
times slower than a CI runner.
- Earlier, on local k3s with Pi, it passed twice at 81.7–85.1 s, about 4
s more than before this change.
- Giving the rotated Deployment the other-audience token failed the
test, as intended: its operations failed with `observation
authentication failed`, which holds no token, and the fallback destroy
with the first token succeeded.
- Temporary offline tests, not committed, checked the state snapshot,
the token search and the guard. Against a server that accepts
connections and never answers, the guard returned after 15 s, and after
30 s without the bound.

---------

Signed-off-by: Carlos Villela <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: Carlos Villela <[email protected]>
@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 platform: k8s Affects Kubernetes deployments v1 NemoClaw v1 branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants