Skip to content

test(e2e): use a rotated oidc token on kind and keep state when a token is refused - #13632

Merged
cv merged 17 commits into
v1from
test/12734-oidc-rotation
Oct 26, 2026
Merged

cv merged 17 commits into
v1from
test/12734-oidc-rotation

Conversation

@gaveezy

@gaveezy gaveezy commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

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

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"]
Loading
  • 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 test(e2e): keep only NemoClaw's retention promise in the Kubernetes destroy checks #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 test(e2e): reapply on kind with three separate agents that answer a fixed stub #13551 and switches the live agent to OpenClaw (test(e2e): run the live suites with 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.

gaveezy and others added 6 commits October 20, 2026 14:37
…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]>
…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]>
…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]>
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]>
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]>
…en is refused

Part of #12734. Stacked on #13551.

## Failure

The Kind OIDC test used one token for apply, export and destroy. No live
run showed that NemoClaw reads `token.env` again on each command, which
is 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, so nothing showed that a refusal leaves the
deployment's state alone or that no token reaches the state directory.
The issuer's namespace was deleted only after every check passed.

Offline tests already cover these promises with fakes:
`a_refused_forward_token_is_an_authentication_failure_without_effects`
(a refused token has no effects, and a new token works in the next
provider process) and `failed_and_partial_observations_retain_protocol_state`
(a failed read keeps the prior state). This change checks them against a
live gateway, issuer and OpenTofu. No defect is known. A token found in
state, or state changed by a refusal, would be one, to reproduce at the
unit or contract layer before fixing.

## Decision

- Refusal: before and after the foreign-audience plan, the test reads
  `intent.json`, `terraform.tfstate`, `terraform.tfstate.backup` if
  present, and every file under `kubernetes/`: the receipt and the
  gateway client material. Every file must be byte-identical, with none
  added or removed; a failure names only the paths. Generated
  configuration, the lock file, saved plans, `.terraform`, `.helm` and
  `diagnostics/` are left out, because the SDK, OpenTofu and the Helm
  provider write or lock them during each command, and a refusal may
  write diagnostics. The error's Display and Debug text must contain none of
  the three tokens. The refusal surfaces as an OpenTofu execution error,
  so its wording and error class are not checked.
- Rotation: the first token now lives only in the Deployment that
  applies, which is dropped after apply. After the refusal, the test
  signs a second token with the issuer's key, `material.token(now + 1)`,
  so its `iat`, `nbf` and `exp` differ from the first. A new Deployment
  whose Secrets hold only that token runs plan, export and destroy. The
  plan must report no changes, and the export must equal the document.
- Secrets: after export and again after destroy, the test reads every
  regular file under the state directory and fails if any contains one
  of the three tokens, naming only the paths. It does not follow the
  symbolic links OpenTofu makes to the bundle's providers. Saved plans
  are zip archives, so this raw search does not see inside them.
- Cleanup: every assertion now runs after destroy, including the
  existing no-issuer and storage checks. If destroy with the renewed
  token fails, which is the regression this test looks for, a separate
  Deployment holding the first token destroys before the test fails, so
  the rotation Deployment never holds the first token. An
  `OwnedNamespace` guard deletes the issuer's namespace when the test
  passes or panics, but not when nextest kills it at its time limit. A
  panic may be unwinding the runtime that drives the test's client, so
  the guard deletes through its own thread, runtime and client, bounded
  at 15 s because kube-client sets no read timeout.
- Out of scope: expiry enforcement, which #13422 removed as OpenShell's
  check. The test keeps its name, which already says "tokens".
- docs/contributing/live-tests.md describes the refusal, rotation, token
  search and its limits, and cleanup. It also names the token field
  `token.env`; the config schema rejects the `tokenEnv` the page named.
- Budget: the change adds one plan and installs no gateway; about
  10-20 s is estimated, not measured. Before this change, CI measured
  the test at 71-77 s of its 120 s limit, local k3s at 78-81 s, and the
  live-kind suite at 174-188 s of 270 s.

## Validation

On linux_arm64:

- `cargo ci` passed in 177 s: fmt, clippy, build, test (1612 passed,
  201 skipped), schema, bundle, and lifecycle (152 passed).
- `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 test, and `cargo nextest list --profile live-kind --run-ignored only`
  lists the same 7 tests.
- `cargo nextest run -p nemoclaw-e2e --lib` passed (8 tests).
- Temporary tests, not committed, checked the helpers offline. The
  state snapshot held the four state files of a fixture directory,
  ignored changed configuration and new diagnostics, and changed when the
  receipt changed or a backup appeared. The token search found a token
  in a nested diagnostics file and none behind a symbolic link. The
  namespace guard, dropped during a panic inside a Tokio runtime and
  again normally, contained its own thread's failure without aborting.
  Against a server that accepts connections and never answers, the
  guard returned after 15 s, and after 30 s without the bound.
- `cargo run -p nemoclaw-build -- docs`, then `docs --check`, passed.

Not run here: this host has no Docker, kind or Kubernetes cluster. The
live run is pending on k3s and in the pull request's Live / Kind jobs on
both architectures; it will report the OIDC test's time.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@wscurran wscurran added 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: k8s Affects Kubernetes deployments labels Oct 22, 2026
gaveezy and others added 10 commits October 25, 2026 14:55
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]>
Bring in #13551's merge of v1 at df88a97 (f2fd87f). No conflicts.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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]>
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]>
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]>
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]>
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]>
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]>
Base automatically changed from test/12734-kind-reapply to v1 October 26, 2026 09:25
#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]>
@github-actions

Copy link
Copy Markdown
Contributor

@cv
cv merged commit c06400d into v1 Oct 26, 2026
57 checks passed
@cv
cv deleted the test/12734-oidc-rotation branch October 26, 2026 15:45
@wscurran wscurran added the v1 NemoClaw v1 branch label Oct 27, 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 area: security Security controls, permissions, secrets, or hardening 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