Skip to content
Closed
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
17 changes: 17 additions & 0 deletions docs/reference/troubleshooting.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2598,6 +2598,23 @@ The Hermes entrypoint supervisor remains responsible for the gateway, dashboard,
In the OpenShell-managed topology, that nonroot supervisor repairs failed auxiliaries continuously, recovers a gateway after four consecutive failed listener or HTTP health checks, and quarantines relaunch after five exits within 60 seconds until the sandbox is recreated.
The host only repairs the host-side OpenShell forwards after the supervised processes pass health checks.

### Dashboard Chat keeps serving the previous model after a model switch

The Hermes Web Dashboard runs from an isolated profile under `/sandbox/.hermes/dashboard-home/`, seeded at container startup and kept separate from the main Hermes config.
`nemohermes inference set` converges this Dashboard profile onto the new model along with the main config, so Dashboard Chat and its `/api/model/info` endpoint report the switched model.
If the Dashboard profile is absent because the Dashboard is disabled, the convergence is a no-op.

When convergence fails, `inference set` prints a warning, withholds the `Inference route synced` success line, and Dashboard Chat may keep using the previous model.
Re-run the switch or restart the gateway to converge the Dashboard profile:

```bash
nemohermes inference set --provider <provider> --model <model> --sandbox <name>
```

```bash
nemohermes <name> hermes gateway restart
```

### Port 8642 in a browser shows a blank page or `Cannot GET /`

`nemohermes onboard` forwards port `8642`, but Hermes serves an OpenAI-compatible API at that port, not a chat dashboard.
Expand Down
12 changes: 11 additions & 1 deletion src/lib/actions/inference-set-gateway-restart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ interface InferenceResultForGateway {
model: string;
primaryModelRef: string;
inSandboxConfigSynced: boolean;
/**
* Hermes only: whether the isolated Web Dashboard profile converged onto the
* switched model (#6893). Undefined for agents without a Dashboard profile,
* treated as converged. When explicitly false the success line is withheld so
* `inference set` does not claim a route it did not fully apply.
*/
dashboardConverged?: boolean;
}

export interface InferenceMutation<T extends InferenceResultForGateway> {
Expand Down Expand Up @@ -101,7 +108,10 @@ export function finalizeInferenceMutation<T extends InferenceResultForGateway>(
deps.appendAuditEntry(auditEntry);
}

if (result.inSandboxConfigSynced && !openClawGatewayRestartRequired) {
// A Hermes switch whose Web Dashboard profile did not converge is not fully
// applied, so withhold the success line (the caller already warned) (#6893).
const hermesDashboardStale = agentName === "hermes" && result.dashboardConverged === false;
if (result.inSandboxConfigSynced && !openClawGatewayRestartRequired && !hermesDashboardStale) {
deps.log(
agentName === "hermes"
? ` Inference route synced for '${result.sandboxName}': ${result.model}`
Expand Down
85 changes: 85 additions & 0 deletions src/lib/actions/inference-set-hermes-run.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -380,3 +380,88 @@ describe("runInferenceSet Hermes routing", () => {
expect(deps.calls.writeSandboxConfig).not.toHaveBeenCalled();
});
});

describe("runInferenceSet Hermes Web Dashboard convergence (#6893)", () => {
function hermesDeps(
overrides: Partial<Parameters<typeof createDeps>[0]> = {},
): ReturnType<typeof createDeps> {
return createDeps({
config: {
model: { default: "old-model", provider: "custom", base_url: "https://inference.local/v1" },
},
entry: { name: "hermes", agent: "hermes", provider: "vllm-local", model: "old-model" },
defaultSandbox: "hermes",
target: HERMES_TARGET,
session: baseSession({ agent: "hermes", sandboxName: "hermes" }),
...overrides,
});
}

const syncedLine = (deps: ReturnType<typeof createDeps>): boolean =>
deps.calls.log.mock.calls.some((c) => String(c[0]).includes("Inference route synced"));

it("converges the isolated Dashboard profile after a successful switch", async () => {
const deps = hermesDeps();

const result = await runInferenceSet(
{ provider: "vllm-local", model: "nemotron-ultra", sandboxName: "hermes", noVerify: true },
deps,
);

// The regression on main: this call never happens, so Dashboard Chat stays
// on the previous model while every other surface reports the new one.
expect(deps.calls.convergeHermesDashboardModel).toHaveBeenCalledWith(
"hermes",
"/sandbox/.hermes",
"vllm-local",
"nemotron-ultra",
);
expect(result.dashboardConverged).toBe(true);
expect(syncedLine(deps)).toBe(true);
});

it("still reports synced when no Dashboard profile is present", async () => {
const deps = hermesDeps({ dashboardConverge: { status: "absent" } });

const result = await runInferenceSet(
{ provider: "vllm-local", model: "nemotron-ultra", sandboxName: "hermes", noVerify: true },
deps,
);

expect(deps.calls.convergeHermesDashboardModel).toHaveBeenCalledTimes(1);
expect(result.dashboardConverged).toBe(true);
expect(syncedLine(deps)).toBe(true);
});

it("withholds the success line and warns when Dashboard convergence fails", async () => {
const deps = hermesDeps({
dashboardConverge: { status: "failed", detail: "exec exited 1" },
});

const result = await runInferenceSet(
{ provider: "vllm-local", model: "nemotron-ultra", sandboxName: "hermes", noVerify: true },
deps,
);

expect(result.dashboardConverged).toBe(false);
expect(syncedLine(deps)).toBe(false);
expect(
deps.calls.log.mock.calls.some((c) => String(c[0]).includes("did not converge onto")),
).toBe(true);
});

it("does not touch the Dashboard path for OpenClaw switches", async () => {
const deps = createDeps({
config: { models: { mode: "merge", providers: {} } },
entry: { name: "alpha", agent: "openclaw", provider: "nvidia-prod", model: "old" },
defaultSandbox: "alpha",
});

await runInferenceSet(
{ provider: "nvidia-prod", model: "nvidia/nemotron-3-super-v3", sandboxName: "alpha" },
deps,
);

expect(deps.calls.convergeHermesDashboardModel).not.toHaveBeenCalled();
});
});
6 changes: 6 additions & 0 deletions src/lib/actions/inference-set.test-support.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ export function createDeps(options: {
localReachable?: boolean;
contextWindow?: number | null;
shieldsMutable?: boolean;
dashboardConverge?: ReturnType<InferenceSetDeps["convergeHermesDashboardModel"]>;
prepareRunOpenshell?: () => void;
rewriteConfigUrlsWithDnsPinning?: (value: ConfigValue) => Promise<ConfigValue>;
restartSandboxGateway?: InferenceSetDeps["restartSandboxGateway"];
Expand All @@ -92,6 +93,7 @@ export function createDeps(options: {
captureOpenshell: ReturnType<typeof vi.fn>;
writeSandboxConfig: ReturnType<typeof vi.fn>;
recomputeSandboxConfigHash: ReturnType<typeof vi.fn>;
convergeHermesDashboardModel: ReturnType<typeof vi.fn>;
updateSandbox: ReturnType<typeof vi.fn>;
readSandboxConfig: ReturnType<typeof vi.fn>;
updateSession: ReturnType<typeof vi.fn>;
Expand Down Expand Up @@ -124,6 +126,9 @@ export function createDeps(options: {
})),
writeSandboxConfig: vi.fn(),
recomputeSandboxConfigHash: vi.fn(),
convergeHermesDashboardModel: vi.fn(
() => options.dashboardConverge ?? { status: "converged" as const },
),
updateSandbox: vi.fn(() => true),
readSandboxConfig: vi.fn(() => options.config),
updateSession: vi.fn((mutator: (value: Session) => Session | void) => {
Expand Down Expand Up @@ -169,6 +174,7 @@ export function createDeps(options: {
readSandboxConfig: calls.readSandboxConfig,
writeSandboxConfig: calls.writeSandboxConfig,
recomputeSandboxConfigHash: calls.recomputeSandboxConfigHash,
convergeHermesDashboardModel: calls.convergeHermesDashboardModel,
prepareRunOpenshell: calls.prepareRunOpenshell,
captureOpenshell: calls.captureOpenshell,
appendAuditEntry: calls.appendAuditEntry,
Expand Down
49 changes: 49 additions & 0 deletions src/lib/actions/inference-set.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ import {
} from "../openshell-gateway-endpoint-guard";
import {
type AgentConfigTarget,
convergeHermesDashboardModel,
type HermesDashboardConvergeResult,
readSandboxConfig,
recomputeSandboxConfigHash,
resolveAgentConfig,
Expand Down Expand Up @@ -90,6 +92,12 @@ export interface InferenceSetResult {
configChanged: boolean;
sessionUpdated: boolean;
inSandboxConfigSynced: boolean;
/**
* Hermes only: whether the isolated Web Dashboard profile converged onto the
* switched model (#6893). Undefined when convergence was not attempted — a
* non-Hermes agent, or a Hermes switch whose main config never synced.
*/
dashboardConverged?: boolean;
}

export interface InferenceSetDeps extends InferenceGatewayRestartDeps {
Expand All @@ -110,6 +118,12 @@ export interface InferenceSetDeps extends InferenceGatewayRestartDeps {
config: ConfigObject,
) => void;
recomputeSandboxConfigHash: (sandboxName: string, target: AgentConfigTarget) => void;
convergeHermesDashboardModel: (
sandboxName: string,
configDir: string,
provider: string,
model: string,
) => HermesDashboardConvergeResult;
prepareRunOpenshell: () => void;
captureOpenshell: (
args: string[],
Expand Down Expand Up @@ -212,6 +226,7 @@ function defaultDeps(): InferenceSetDeps {
readSandboxConfig,
writeSandboxConfig,
recomputeSandboxConfigHash,
convergeHermesDashboardModel,
prepareRunOpenshell: () => {
getOpenshellBinary();
},
Expand Down Expand Up @@ -866,6 +881,39 @@ async function runInferenceSetWithoutHostLock(
` Run '${CLI_NAME} ${sandboxName} rebuild' to finish applying the model inside the sandbox.`,
);
}

// #6893: the Hermes Web Dashboard runs from an isolated HERMES_HOME and does
// not pick up an in-place model switch, so Dashboard Chat keeps serving the
// previous model even though every other status surface reports the new one.
// Converge that profile too before claiming success. Best-effort and gated on
// the main config having synced first: a Dashboard that was never enabled
// resolves to "absent" (no-op), and only a real convergence failure downgrades
// the success message.
// Undefined when convergence was not attempted (non-Hermes agent, or the main
// config never synced), true when the Dashboard converged or was absent, and
// false only on a real convergence failure — so the result never claims a
// Dashboard state it did not establish.
let dashboardConverged: boolean | undefined;
if (agentName === "hermes" && inSandboxConfigSynced) {
const dashboardResult = deps.convergeHermesDashboardModel(
sandboxName,
target.configDir,
provider,
model,
);
dashboardConverged = dashboardResult.status !== "failed";
if (dashboardResult.status === "failed") {
deps.log(
` Warning: updated the Hermes config for '${sandboxName}', but the Web Dashboard ` +
`profile did not converge onto '${model}': ${dashboardResult.detail}`,
);
deps.log(
` Dashboard Chat may keep using the previous model. Re-run '${CLI_NAME} inference set' ` +
`or run '${CLI_NAME} ${sandboxName} hermes gateway restart'.`,
);
}
}

Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
const sessionUpdated = updateMatchingOnboardSession(
sandboxName,
provider,
Expand All @@ -890,6 +938,7 @@ async function runInferenceSetWithoutHostLock(
configChanged: patched.changed,
sessionUpdated,
inSandboxConfigSynced,
dashboardConverged,
},
},
deps,
Expand Down
67 changes: 67 additions & 0 deletions src/lib/sandbox/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,12 @@ const HERMES_STRICT_HASH_FILE = "/etc/nemoclaw/hermes.config-hash";
const HERMES_RUNTIME_CONFIG_GUARD = "/usr/local/lib/nemoclaw/hermes-runtime-config-guard.py";
const HERMES_PYTHON = "/opt/hermes/.venv/bin/python";
const HERMES_RESTART_SEAL_STATE = "/run/nemoclaw/hermes-restart-seal.json";
// The Hermes Web Dashboard runs from an isolated HERMES_HOME under this subdir of
// the main config dir, seeded at container startup. An in-place `inference set`
// updates only the main config, so the Dashboard profile must be converged
// separately (#6893).
const HERMES_DASHBOARD_HOME_SUBDIR = "dashboard-home";
const HERMES_DASHBOARD_CONVERGE_TIMEOUT_MS = 30_000;
const MAX_OPENCLAW_CONFIG_BYTES = 16 * 1024 * 1024;
const CONFIG_CAPTURE_MAX_BUFFER = MAX_OPENCLAW_CONFIG_BYTES + 1024 * 1024;
const OPENCLAW_CONFIG_GUARD_TIMEOUT_MS = 6 * 60 * 1000;
Expand Down Expand Up @@ -574,6 +580,66 @@ function writeSandboxConfig(
}
}

export type HermesDashboardConvergeResult =
| { status: "converged" }
| { status: "absent" }
| { status: "failed"; detail: string };

/**
* Converge the isolated Hermes Web Dashboard profile onto a switched model.
*
* `nemoclaw inference set` writes only the main Hermes config; the Dashboard runs
* from a separate HERMES_HOME under `<configDir>/dashboard-home`, seeded at
* container startup. An in-place switch therefore leaves Dashboard Chat and its
* `/api/model/info` endpoint on the previous model (#6893). This mirrors the
* reporter-verified recovery — `hermes config set model.default` and
* `providers.<provider>.default_model` under the Dashboard HERMES_HOME — and
* no-ops when the Dashboard profile is absent (Dashboard disabled).
*
* `provider` and `model` are pre-validated by the `inference set` caller
* (`assertSupportedProvider` allowlist + `isSafeModelId`), so they are safe as a
* config dotpath segment and value; they are still passed as distinct argv
* elements, never interpolated into a shell string.
*/
function convergeHermesDashboardModel(
sandboxName: string,
configDir: string,
provider: string,
model: string,
): HermesDashboardConvergeResult {
const dashboardHome = `${configDir.replace(/\/+$/, "")}/${HERMES_DASHBOARD_HOME_SUBDIR}`;
// Presence probe as a pure argv `test -d` (this security-boundary file prefers
// argv over shell construction). `dockerSpawnSync` returns the exit status
// rather than throwing, so an absent profile (`test` exits 1) is a clean skip
// and only a genuine exec error (spawn failure, signal, or a non-0/1 status
// such as Docker's 125 for a missing container) is a convergence failure.
const probe = dockerSpawnSync(
privilegedSandboxExecArgv(sandboxName, ["test", "-d", dashboardHome], false, true),
{ encoding: "utf-8", timeout: HERMES_DASHBOARD_CONVERGE_TIMEOUT_MS },
);
if (probe.error) return { status: "failed", detail: probe.error.message };
if (probe.signal) return { status: "failed", detail: `probe terminated by ${probe.signal}` };
if (probe.status === 1) return { status: "absent" };
if (probe.status !== 0) {
return { status: "failed", detail: `dashboard probe exited ${String(probe.status)}` };
}
try {
for (const key of ["model.default", `providers.${provider}.default_model`]) {
privilegedSandboxExec(
sandboxName,
["env", `HERMES_HOME=${dashboardHome}`, "hermes", "config", "set", key, model],
{ timeout: HERMES_DASHBOARD_CONVERGE_TIMEOUT_MS },
);
}
return { status: "converged" };
} catch (error) {
return {
status: "failed",
detail: error instanceof Error && error.message ? error.message : String(error),
};
}
}

function buildRecomputeSandboxConfigHashScript(target: AgentConfigTarget): string | null {
// OpenClaw and Hermes write and refresh both hashes inside one fd-pinned sealed
// transaction. A second pathname-based hash pass would reopen the race that
Expand Down Expand Up @@ -1212,6 +1278,7 @@ export {
configGet,
configRotateToken,
configSet,
convergeHermesDashboardModel,
DEFAULT_AGENT_CONFIG,
extractDotpath,
findClobberingAncestor,
Expand Down
Loading
Loading