Repository navigation
fix(inference): probe model invocability instead of endpoint reachability #7074
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
cv
merged 7 commits into
NVIDIA:main
from
DisturbedSage5840C:fix/inference-health-invocability-6846
Jul 18, 2026
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
9e09e8f
fix(inference): probe model invocability instead of endpoint reachabi…
DisturbedSage5840C 530cd8d
fix(inference): validate provider probe responses
apurvvkumaria aa10c28
fix(inference): keep status probes bounded
jyaunches 61cb8b1
docs(inference): clarify route reachability
jyaunches f2ca493
test(status): align route health expectations
jyaunches d21438d
merge(main): update PR 7074
jyaunches 498365f
Merge branch 'main' into fix/inference-health-invocability-6846
cv File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
142 changes: 142 additions & 0 deletions
142
src/lib/actions/sandbox/status-snapshot-inference-health.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,142 @@ | ||
| // SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| import { describe, expect, it } from "vitest"; | ||
|
|
||
| import type { ProviderHealthStatus } from "../../inference/health"; | ||
| import type { SandboxEntry } from "../../state/registry"; | ||
| import type { SandboxInferenceRouteHealth } from "./inference-route-health"; | ||
| import { collectSandboxStatusSnapshot } from "./status-snapshot"; | ||
|
|
||
| // Direct, unmocked coverage of `buildSandboxInferenceRouteHealth` through the | ||
| // exported `collectSandboxStatusSnapshot` entry point (it is not itself | ||
| // exported). status-flow.test.ts mocks collectSandboxStatusSnapshot wholesale | ||
| // and never exercises this code, so it never proves okLabel is actually set | ||
| // in production wiring rather than merely respected if present (#6846). | ||
| function snapshotDeps( | ||
| gateway: SandboxInferenceRouteHealth | null, | ||
| providerHealth: ProviderHealthStatus | null = null, | ||
| ) { | ||
| const sandbox: SandboxEntry = { | ||
| name: "alpha", | ||
| agent: "openclaw", | ||
| policies: [], | ||
| provider: "nvidia", | ||
| model: "nvidia/nemotron", | ||
| }; | ||
| return { | ||
| suppressInferenceProbe: false, | ||
| deps: { | ||
| getSandbox: () => sandbox, | ||
| listSandboxes: () => ({ sandboxes: [sandbox], defaultSandbox: sandbox.name }), | ||
| reconcile: async () => ({ state: "present" as const, output: "Phase: Ready" }), | ||
| // The live-route RPC lookup is independent of the authoritative | ||
| // inference.local gateway probe under test; throwing here just leaves | ||
| // liveRoute/routeDrift null without needing a fabricated exec transcript. | ||
| captureOpenshellForStatusImpl: async () => { | ||
| throw new Error("live route lookup not needed for this test"); | ||
| }, | ||
| probeProviderHealthImpl: () => providerHealth, | ||
| probeSandboxInferenceGatewayHealthImpl: async () => gateway, | ||
| }, | ||
| }; | ||
| } | ||
|
|
||
| describe("collectSandboxStatusSnapshot inference route health", () => { | ||
| it("labels a reachable route okLabel: reachable, not a bare healthy claim (#6846)", async () => { | ||
| const gateway: SandboxInferenceRouteHealth = { | ||
| ok: true, | ||
| endpoint: "https://inference.local/v1/models", | ||
| httpStatus: 200, | ||
| detail: | ||
| "Inference gateway responded HTTP 200 on https://inference.local/v1/models (full chain reachable).", | ||
| }; | ||
|
|
||
| const snapshot = await collectSandboxStatusSnapshot("alpha", snapshotDeps(gateway)); | ||
|
|
||
| expect(snapshot.inferenceHealth).toMatchObject({ | ||
| ok: true, | ||
| probed: true, | ||
| providerLabel: "Inference route", | ||
| endpoint: "https://inference.local/v1/models", | ||
| okLabel: "reachable", | ||
| }); | ||
| expect(snapshot.inferenceHealth?.failureLabel).toBeUndefined(); | ||
| }); | ||
|
|
||
| it("does not set okLabel for a 5xx route failure, and classifies it unhealthy (#6846)", async () => { | ||
| const gateway: SandboxInferenceRouteHealth = { | ||
| ok: false, | ||
| endpoint: "https://inference.local/v1/models", | ||
| httpStatus: 502, | ||
| detail: | ||
| "Inference gateway returned HTTP 502 on https://inference.local/v1/models; the route is reachable but unhealthy.", | ||
| }; | ||
|
|
||
| const snapshot = await collectSandboxStatusSnapshot("alpha", snapshotDeps(gateway)); | ||
|
|
||
| expect(snapshot.inferenceHealth).toMatchObject({ | ||
| ok: false, | ||
| failureLabel: "unhealthy", | ||
| }); | ||
| expect(snapshot.inferenceHealth?.okLabel).toBeUndefined(); | ||
| }); | ||
|
|
||
| it("does not set okLabel when the route is unreachable (#6846)", async () => { | ||
| const gateway: SandboxInferenceRouteHealth = { | ||
| ok: false, | ||
| endpoint: "https://inference.local/v1/models", | ||
| httpStatus: 0, | ||
| detail: | ||
| "Inference gateway unreachable on https://inference.local/v1/models from inside the sandbox.", | ||
| }; | ||
|
|
||
| const snapshot = await collectSandboxStatusSnapshot("alpha", snapshotDeps(gateway)); | ||
|
|
||
| expect(snapshot.inferenceHealth).toMatchObject({ | ||
| ok: false, | ||
| failureLabel: "unreachable", | ||
| }); | ||
| expect(snapshot.inferenceHealth?.okLabel).toBeUndefined(); | ||
| }); | ||
|
|
||
| it("stays unprobed with no okLabel when the gateway probe is unavailable (#6846)", async () => { | ||
| const snapshot = await collectSandboxStatusSnapshot("alpha", snapshotDeps(null)); | ||
|
|
||
| expect(snapshot.inferenceHealth).toMatchObject({ | ||
| ok: false, | ||
| probed: false, | ||
| providerLabel: "Inference route", | ||
| }); | ||
| expect(snapshot.inferenceHealth?.okLabel).toBeUndefined(); | ||
| expect(snapshot.inferenceHealth?.failureLabel).toBeUndefined(); | ||
| }); | ||
|
|
||
| it("keeps a failed model-invocation subprobe distinct from the reachable route label (#6846)", async () => { | ||
| const gateway: SandboxInferenceRouteHealth = { | ||
| ok: true, | ||
| endpoint: "https://inference.local/v1/models", | ||
| httpStatus: 200, | ||
| detail: | ||
| "Inference gateway responded HTTP 200 on https://inference.local/v1/models (full chain reachable).", | ||
| }; | ||
| const providerHealth: ProviderHealthStatus = { | ||
| ok: false, | ||
| probed: true, | ||
| providerLabel: "NVIDIA Endpoints", | ||
| endpoint: "https://integrate.api.nvidia.com/v1/chat/completions", | ||
| detail: "model invocation probe failed", | ||
| failureLabel: "unauthorized", | ||
| }; | ||
|
|
||
| const snapshot = await collectSandboxStatusSnapshot( | ||
| "alpha", | ||
| snapshotDeps(gateway, providerHealth), | ||
| ); | ||
|
|
||
| expect(snapshot.inferenceHealth).toMatchObject({ ok: true, okLabel: "reachable" }); | ||
| expect(snapshot.inferenceHealth?.subprobes).toEqual([ | ||
| { ...providerHealth, probeLabel: "upstream" }, | ||
| ]); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.