Skip to content

Commit 1047cc2

Browse files
committed
fix(inference): fail incomplete Hermes route sync
Signed-off-by: Ho Lim <subhoya@gmail.com>
1 parent f5198b8 commit 1047cc2

2 files changed

Lines changed: 41 additions & 21 deletions

File tree

src/lib/actions/inference-set-hermes-run.test.ts

Lines changed: 32 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ describe("runInferenceSet Hermes routing", () => {
207207
expect(seedOrder).toBeGreaterThan(writeOrder);
208208
});
209209

210-
it("does not re-seed the dashboard when the in-sandbox config write fails (#6893)", async () => {
210+
it("fails after commit when the in-sandbox config write fails (#7083)", async () => {
211211
const config: ConfigObject = {
212212
model: { default: "moonshotai/kimi-k2.6", provider: "custom" },
213213
};
@@ -227,22 +227,32 @@ describe("runInferenceSet Hermes routing", () => {
227227
throw new Error("write failed");
228228
});
229229

230-
await runInferenceSet(
231-
{
230+
await expect(
231+
runInferenceSet(
232+
{
233+
provider: "hermes-provider",
234+
model: "openai/gpt-5.4-mini",
235+
sandboxName: "hermes",
236+
noVerify: true,
237+
},
238+
deps,
239+
),
240+
).rejects.toThrow(/Hermes inference route synchronization did not complete/);
241+
242+
// A failed gateway-config write leaves the old config in place; re-seeding the
243+
// dashboard from it would be pointless. The host route remains committed, but
244+
// the command must fail so automation cannot accept a partial switch.
245+
expect(deps.calls.updateSandbox).toHaveBeenCalledWith(
246+
"hermes",
247+
expect.objectContaining({
232248
provider: "hermes-provider",
233249
model: "openai/gpt-5.4-mini",
234-
sandboxName: "hermes",
235-
noVerify: true,
236-
},
237-
deps,
250+
}),
238251
);
239-
240-
// A failed gateway-config write leaves the old config in place; re-seeding the
241-
// dashboard from it would be pointless (and the guidance is to rebuild).
242252
expect(deps.calls.seedHermesDashboardConfig).not.toHaveBeenCalled();
243253
});
244254

245-
it("does not re-seed or report synced when the config hash refresh fails (#6893)", async () => {
255+
it("fails after commit when the config hash refresh fails (#7083)", async () => {
246256
const config: ConfigObject = {
247257
model: { default: "moonshotai/kimi-k2.6", provider: "custom" },
248258
};
@@ -262,15 +272,17 @@ describe("runInferenceSet Hermes routing", () => {
262272
throw new Error("hash refresh failed");
263273
});
264274

265-
await runInferenceSet(
266-
{
267-
provider: "hermes-provider",
268-
model: "openai/gpt-5.4-mini",
269-
sandboxName: "hermes",
270-
noVerify: true,
271-
},
272-
deps,
273-
);
275+
await expect(
276+
runInferenceSet(
277+
{
278+
provider: "hermes-provider",
279+
model: "openai/gpt-5.4-mini",
280+
sandboxName: "hermes",
281+
noVerify: true,
282+
},
283+
deps,
284+
),
285+
).rejects.toThrow(/Hermes inference route synchronization did not complete/);
274286

275287
expect(deps.calls.writeSandboxConfig).toHaveBeenCalledOnce();
276288
expect(deps.calls.seedHermesDashboardConfig).not.toHaveBeenCalled();

src/lib/actions/inference-set.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1299,7 +1299,7 @@ async function runInferenceSetWithoutHostLock(
12991299
reasoningEffortRequest,
13001300
);
13011301

1302-
return finalizeInferenceMutation(
1302+
const mutation = finalizeInferenceMutation(
13031303
{
13041304
agentName,
13051305
configChanged: patched.changed,
@@ -1319,6 +1319,14 @@ async function runInferenceSetWithoutHostLock(
13191319
},
13201320
deps,
13211321
);
1322+
if (agentName === "hermes" && !inSandboxConfigSynced) {
1323+
throw new InferenceSetError(
1324+
`Hermes inference route synchronization did not complete for '${sandboxName}'. ` +
1325+
`The OpenShell route and NemoClaw registry remain committed, but the in-sandbox ` +
1326+
`Hermes config is stale. Run '${CLI_NAME} ${sandboxName} rebuild' to converge it.`,
1327+
);
1328+
}
1329+
return mutation;
13221330
} catch (error) {
13231331
if (!providerMutation) throw error;
13241332
if (restoredSelectionAfterProviderFailure) throw error;

0 commit comments

Comments
 (0)