Gateway: add docs hint for plugin override trust error (#49513)

This commit is contained in:
Josh Lehman 2026-03-17 22:53:34 -07:00 committed by GitHub
parent ff849613a4
commit 937f118d8e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 25 additions and 1 deletions

View File

@ -298,6 +298,27 @@ describe("loadGatewayPlugins", () => {
});
});
test("includes docs guidance when a plugin fallback override is not trusted", async () => {
const serverPlugins = await importServerPluginsModule();
const runtime = await createSubagentRuntime(serverPlugins);
serverPlugins.setFallbackGatewayContext(createTestContext("fallback-untrusted-plugin"));
const gatewayScopeModule = await import("../plugins/runtime/gateway-request-scope.js");
await expect(
gatewayScopeModule.withPluginRuntimePluginIdScope("voice-call", () =>
runtime.run({
sessionKey: "s-untrusted-override",
message: "use untrusted override",
provider: "anthropic",
model: "claude-haiku-4-5",
deliver: false,
}),
),
).rejects.toThrow(
'plugin "voice-call" is not trusted for fallback provider/model override requests. See https://docs.openclaw.ai/tools/plugin#runtime-helpers and search for: plugins.entries.<id>.subagent.allowModelOverride',
);
});
test("allows trusted fallback model-only overrides when the model ref is canonical", async () => {
const serverPlugins = await importServerPluginsModule();
const runtime = await createSubagentRuntime(serverPlugins, {

View File

@ -155,7 +155,10 @@ function authorizeFallbackModelOverride(params: {
if (!policy?.allowModelOverride) {
return {
allowed: false,
reason: `plugin "${pluginId}" is not trusted for fallback provider/model override requests.`,
reason:
`plugin "${pluginId}" is not trusted for fallback provider/model override requests. ` +
"See https://docs.openclaw.ai/tools/plugin#runtime-helpers and search for: " +
"plugins.entries.<id>.subagent.allowModelOverride",
};
}
if (policy.allowAnyModel) {