Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3519,7 +3519,7 @@ jobs:
secrets:
DOCKERHUB_USERNAME: ${{ github.ref == 'refs/heads/main' && github.workflow_ref == 'NVIDIA/NemoClaw/.github/workflows/e2e.yaml@refs/heads/main' && github.repository == 'NVIDIA/NemoClaw' && (github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && github.ref == 'refs/heads/main')) && (inputs.checkout_sha == '' || needs.generate-matrix.outputs.e2e_credentials_allowed == 'true') && secrets.DOCKERHUB_USERNAME || '' }}
DOCKERHUB_TOKEN: ${{ github.ref == 'refs/heads/main' && github.workflow_ref == 'NVIDIA/NemoClaw/.github/workflows/e2e.yaml@refs/heads/main' && github.repository == 'NVIDIA/NemoClaw' && (github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && github.ref == 'refs/heads/main')) && (inputs.checkout_sha == '' || needs.generate-matrix.outputs.e2e_credentials_allowed == 'true') && secrets.DOCKERHUB_TOKEN || '' }}
HOSTED_INFERENCE_API_KEY: ${{ github.ref == 'refs/heads/main' && github.workflow_ref == 'NVIDIA/NemoClaw/.github/workflows/e2e.yaml@refs/heads/main' && github.repository == 'NVIDIA/NemoClaw' && (github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && github.ref == 'refs/heads/main')) && (inputs.checkout_sha == '' || needs.generate-matrix.outputs.e2e_credentials_allowed == 'true') && (matrix.id == 'hosted-inference-openai' && secrets.OPENAI_API_KEY || matrix.id == 'hosted-inference-anthropic' && secrets.ANTHROPIC_API_KEY || matrix.id == 'hosted-inference-gemini' && secrets.GEMINI_API_KEY || matrix.id == 'hosted-inference-openrouter' && secrets.OPENROUTER_API_KEY || matrix.id == 'hosted-inference-hermes' && secrets.NOUS_API_KEY) || '' }}
HOSTED_INFERENCE_API_KEY: ${{ github.ref == 'refs/heads/main' && github.workflow_ref == 'NVIDIA/NemoClaw/.github/workflows/e2e.yaml@refs/heads/main' && github.repository == 'NVIDIA/NemoClaw' && (github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && github.ref == 'refs/heads/main')) && (inputs.checkout_sha == '' || needs.generate-matrix.outputs.e2e_credentials_allowed == 'true') && matrix.id == 'hosted-inference-openrouter' && secrets.OPENROUTER_API_KEY || '' }}

catalogue-standard:
name: ${{ matrix.display_name }} (${{ matrix.runtime_provider }})
Expand Down
14 changes: 12 additions & 2 deletions src/lib/inference/health.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,26 +149,36 @@ describe("inference health", () => {

it("invokes the Gemini OpenAI-compatible chat-completions shim, not the native v1/models surface", () => {
let capturedArgv: string[] = [];
let authConfigContent = "";
const credentialNames: string[] = [];
const result = probeRemoteProviderHealth("gemini-api", {
model: "gemini-2.5-flash",
getCredentialImpl: (envName) => (envName === "GEMINI_API_KEY" ? "gm-test-secret" : null),
getCredentialImpl: (envName) => {
credentialNames.push(envName);
return envName === "GEMINI_API_KEY" ? "gm-test-secret" : null;
},
runCurlProbeImpl: (argv) => {
capturedArgv = argv;
authConfigContent = fs.readFileSync(curlArgValue(argv, "--config")!, "utf8");
return httpOk();
},
});

expect(result?.ok).toBe(true);
expect(result?.probed).toBe(true);
expect(credentialNames).toEqual(["GEMINI_API_KEY"]);
expect(result?.endpoint).toBe(
"https://generativelanguage.googleapis.com/v1beta/openai/chat/completions",
);
expect(capturedArgv.at(-1)).toBe(
"https://generativelanguage.googleapis.com/v1beta/openai/chat/completions",
);
expect(capturedArgv.join(" ")).not.toContain("gm-test-secret");
expect(authConfigContent).toContain("Authorization: Bearer gm-test-secret");
const payload = JSON.parse(capturedArgv[capturedArgv.indexOf("-d") + 1]);
expect(payload).toMatchObject({
expect(payload).toEqual({
model: "gemini-2.5-flash",
messages: [{ role: "user", content: "Reply with exactly: OK" }],
max_tokens: 256,
});
});
Expand Down
65 changes: 29 additions & 36 deletions test/e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2385,32 +2385,27 @@ The explicit `dgx-station-express` target runs the local Station Express install

## Fixed hosted provider qualification

`live/inference-routing-provider-smoke.test.ts` owns credential-backed native inference smoke tests.
Select `openai`, `anthropic`, `gemini`, `openrouter`, or `hermes` with
`NEMOCLAW_INFERENCE_ROUTING_PROVIDER_SMOKE`. Selecting `openrouter` runs both
OpenRouter agent cases; `all` runs all six cases.
Use an approved disposable environment and credentials from its approved source.
`live/inference-routing-provider-smoke.test.ts` owns the credential-backed OpenRouter smoke.
Select `openrouter` with `NEMOCLAW_INFERENCE_ROUTING_PROVIDER_SMOKE` to run both
OpenRouter agent cases.
Use an approved disposable environment and OpenRouter credential from its approved source.
These tests are outside the credential-free `inference-routing` PR lane.
A skipped provider is missing qualification evidence.
A skipped OpenRouter case is missing qualification evidence.
TC-INF-05 uses the same probe for NVIDIA credential isolation.
Its separate environment, process, filesystem, and canary checks are replaced by the probe results;
support tests cover leak detection and control cleanup.

OpenAI, Anthropic, Gemini, and OpenRouter onboard OpenClaw and start a fresh agent process.
Hermes Provider onboards Hermes and submits a fresh request to its managed API.
OpenRouter onboards OpenClaw and starts a fresh agent process.
The `hosted-inference-openrouter` target also onboards Deep Agents Code with the same
OpenRouter key and model. Its six-assertion case checks onboarding, credential isolation,
the native TOML route, and one fresh `dcode -n --json` response.
The five OpenClaw and Hermes cases check the native endpoint, credential placeholder,
The OpenClaw case checks the native endpoint, credential placeholder,
selected adapter, response model, and nonempty answer.
The OpenRouter case switches the running sandbox to a second model and back.
It requires a fresh agent response with that model after each switch and checks that the return route is readable.
Each `nemoclaw inference set` switch also verifies its selected model with a sandbox-side inference request.
After each successful switch, it requires a fresh OpenClaw response whose reported model matches the selection.
An unavailable or rate-limited intermediate model fails the first switch.
The alternate route read and return-route model assertion were removed from this live case:
agent responses prove the effective model after each restart, while the recorded-model behavior
belongs to the `inference get` source tests. Both switch exit checks and the return route read remain.
After onboarding, each hosted-provider case runs one sandbox probe before its first native agent request.
The case does not read either route. The `inference get` source tests cover recorded-model behavior.
After onboarding, the OpenRouter case runs one sandbox probe before its first native agent request.
The OpenRouter model-switch requests and follow-up agent responses do not repeat that scan.
The probe checks the raw environment and a bounded file sample for a salted fingerprint of the selected credential.
The probe tries `ps aux`, then `ps -ef`, to check process arguments.
Expand All @@ -2426,30 +2421,33 @@ rejection and credential binding.
Deterministic tests own protocol/header construction, ownership collisions,
sandbox isolation, restart, and failed-operation recovery.

Each selected case requires its matching approved model variable, listed below. The smoke does not select a default model.
The Hermes smoke uses `NOUS_API_KEY`. It does not prove interactive OAuth login or token refresh.
The smoke requires the approved `NEMOCLAW_OPENROUTER_MODEL`; it does not select a default model.
Credentials remain in the test host environment and OpenShell provider store; artifacts redact them.
The cleanup helper destroys each test sandbox. The Deep Agents Code case checks sandbox absence even if onboarding fails.
Other hosted cases check absence after successful onboarding; failed onboarding uses best-effort cleanup.
The OpenClaw case checks absence after successful onboarding; failed onboarding uses best-effort cleanup.
Neither path proves removal of credentials from the OpenShell provider store.
Discard the approved disposable gateway after each run, including failed onboarding. Use a fresh gateway for a retry.

Select one explicit target with `targets=hosted-inference-openai`, `hosted-inference-anthropic`,
`hosted-inference-gemini`, `hosted-inference-openrouter`, or `hosted-inference-hermes`.
These Docker targets reuse `inference-routing-provider-smoke.test.ts` and the trusted E2E controller.
These targets require explicit selection. Default suites and changed-file selection do not include them,
even when a workflow or provider source changes. The initial consumer is Slice 2 (#12589); its native
provider behavior must exist in the candidate before running these assertions. Advisor can recommend
an explicit hosted target. Selection does not grant dispatch or credential access.
Select `targets=hosted-inference-openrouter` explicitly.
This Docker target reuses `inference-routing-provider-smoke.test.ts` and the trusted E2E controller.
It requires explicit selection. Default suites and changed-file selection do not include it,
even when a workflow or provider source changes. Advisor can recommend the OpenRouter target.
Selection does not grant dispatch or credential access.
The credential-free `inference-routing` target remains separate.

Before dispatch, obtain an approved disposable environment and credential source for the selected provider.
OpenAI, Anthropic, Gemini, and Hermes Provider use deterministic source contracts for fixed
endpoint and method selection, request headers and body, native agent configuration,
provider-bound credentials, and rejection of crossed routes. OpenAI, Anthropic, and Gemini
also have response-parsing contracts. Hermes malformed HTTP 2xx body parsing is deferred
to #13290. Their four former credentialed selectors are unavailable. These contracts do not
demonstrate live upstream authentication, model availability, or a fresh remote answer.
That evidence is deferred for issues #12589 and #12955; neither issue waits on those E2Es.

Before dispatch, obtain an approved disposable environment and OpenRouter credential source.
Credential-bearing hosted runs require the canonical `e2e.yaml` workflow from `main`.
Branch-dispatched workflows receive no hosted-provider or registry credentials, even for an approved candidate.
The controller passes only that target's repository secret (`OPENAI_API_KEY`, `ANTHROPIC_API_KEY`,
`GEMINI_API_KEY`, `OPENROUTER_API_KEY`, or `NOUS_API_KEY`) to the test step.
Set the corresponding repository variable `NEMOCLAW_OPENAI_MODEL`, `NEMOCLAW_ANTHROPIC_MODEL`,
`NEMOCLAW_GEMINI_MODEL`, `NEMOCLAW_OPENROUTER_MODEL`, or `NEMOCLAW_HERMES_MODEL` to an approved model.
The controller passes only `OPENROUTER_API_KEY` to the test step.
Set `NEMOCLAW_OPENROUTER_MODEL` to an approved model.
Missing credentials or models fail before onboarding. A selected test that skips cannot produce passing evidence.
The existing controller binds artifacts to the tested source revision and trusted workflow revision.
For an authorized hosted-provider candidate run, the trusted reporter comments on the PR after the selected jobs finish.
Expand All @@ -2463,9 +2461,4 @@ Candidate-controlled host processes can read or copy the selected provider key w
The sandbox isolation check does not attest isolation from those host processes.
Job cleanup and artifact redaction do not revoke the key or erase a copy made by candidate code.
Rotate or revoke the key in its issuing provider to remove later access.
Hermes API-key evidence does not qualify interactive OAuth login.

Hermes OAuth remains a separate live qualification for Slice 2 (#12589). An authorized account operator
must complete device authorization in an approved disposable interactive environment, verify a fresh
request through the returned native endpoint, restart, and verify another fresh request. Record the
tested commit and redacted results. This prerequisite adds no OAuth selector or automation.
Hermes interactive OAuth evidence is also deferred for Slice 2 (#12589).
18 changes: 6 additions & 12 deletions test/e2e/live/inference-routing-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,12 @@ const CREDENTIAL_CLASSIFICATION_PATTERN =
const TRANSPORT_CLASSIFICATION_PATTERN =
/unreachable|timeout|connect|ECONNREFUSED|ETIMEDOUT|ENETUNREACH|EHOSTUNREACH|ENOTFOUND|EAI_AGAIN|No route to host|transport|network|endpoint|dns/i;

function shouldRunProviderSmoke(
provider: "openai" | "anthropic" | "gemini" | "openrouter" | "hermes",
): boolean {
function shouldRunProviderSmoke(provider: "openrouter"): boolean {
// The former shell script auto-ran these smokes when provider secrets were
// present. This live migration requires an explicit opt-in so PR-safe jobs
// cannot spend third-party quota accidentally; any future secret-backed lane
// must set NEMOCLAW_INFERENCE_ROUTING_PROVIDER_SMOKE=all or a provider name.
// present. This live smoke requires explicit selection so PR-safe jobs do
// not spend third-party quota accidentally.
const requested = process.env.NEMOCLAW_INFERENCE_ROUTING_PROVIDER_SMOKE?.trim().toLowerCase();
return requested === "1" || requested === "true" || requested === "all" || requested === provider;
return requested === provider;
}

type SkipFn = (note?: string) => void;
Expand Down Expand Up @@ -440,15 +437,12 @@ async function expectAnthropicMessageThroughSandbox(
);
}

export function requireProviderSmokeSelected(
provider: "openai" | "anthropic" | "gemini" | "openrouter" | "hermes",
skip: SkipFn,
): void {
export function requireProviderSmokeSelected(provider: "openrouter", skip: SkipFn): void {
if (!shouldRunProviderSmoke(provider)) {
const label = provider;
skipLive(
skip,
`set NEMOCLAW_INFERENCE_ROUTING_PROVIDER_SMOKE=${provider} or all to run ${label} smoke`,
`set NEMOCLAW_INFERENCE_ROUTING_PROVIDER_SMOKE=${provider} to run ${label} smoke`,
);
}
}
Expand Down
Loading