mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-18 16:14:44 +00:00
fix: report model run fallback metadata
This commit is contained in:
@@ -585,6 +585,47 @@ describe("capability cli", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("surfaces gateway model fallback attempts in model probe JSON", async () => {
|
||||
mocks.callGateway.mockResolvedValueOnce({
|
||||
result: {
|
||||
payloads: [{ text: "gateway fallback reply" }],
|
||||
meta: {
|
||||
agentMeta: {
|
||||
provider: "openai",
|
||||
model: "gpt-4.1-mini",
|
||||
fallbackAttempts: [
|
||||
{
|
||||
provider: "openrouter",
|
||||
model: "openrouter/auto",
|
||||
error: "model unavailable",
|
||||
reason: "model_not_found",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
} as never);
|
||||
|
||||
await runRegisteredCli({
|
||||
register: registerCapabilityCli as (program: Command) => void,
|
||||
argv: ["capability", "model", "run", "--prompt", "hello", "--gateway", "--json"],
|
||||
});
|
||||
|
||||
expect(mocks.runtime.writeJson).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
provider: "openai",
|
||||
model: "gpt-4.1-mini",
|
||||
attempts: [
|
||||
expect.objectContaining({
|
||||
provider: "openrouter",
|
||||
model: "openrouter/auto",
|
||||
reason: "model_not_found",
|
||||
}),
|
||||
],
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it("requests admin scope for gateway model probes with provider/model overrides", async () => {
|
||||
await runRegisteredCli({
|
||||
register: registerCapabilityCli as (program: Command) => void,
|
||||
|
||||
Reference in New Issue
Block a user