fix: honor inactive runtime web providers

This commit is contained in:
Peter Steinberger
2026-04-10 23:32:08 +01:00
parent 3ead2d1090
commit 8473099c70
3 changed files with 15 additions and 3 deletions

View File

@@ -7,6 +7,16 @@ import { importFreshModule } from "../../../test/helpers/import-fresh.js";
async function withOpenRouterStateDir(run: (stateDir: string) => Promise<void>) {
const stateDir = mkdtempSync(join(tmpdir(), "openclaw-openrouter-capabilities-"));
process.env.OPENCLAW_STATE_DIR = stateDir;
for (const key of [
"ALL_PROXY",
"all_proxy",
"HTTP_PROXY",
"http_proxy",
"HTTPS_PROXY",
"https_proxy",
]) {
vi.stubEnv(key, "");
}
try {
await run(stateDir);
} finally {

View File

@@ -107,6 +107,7 @@ describe("web_fetch Cloudflare Markdown for Agents", () => {
global.fetch = withFetchPreconnect(fetchSpy);
const tool = createWebFetchTool({
lookupFn: lookupMock as unknown as LookupFn,
config: {
plugins: {
entries: {

View File

@@ -134,9 +134,10 @@ export function resolveWebProviderDefinition<
});
const providerId =
params.providerId ??
params.runtimeMetadata?.selectedProvider ??
params.runtimeMetadata?.providerConfigured ??
autoProviderId;
(params.runtimeMetadata ? params.runtimeMetadata.selectedProvider : autoProviderId);
if (!providerId) {
return null;
}
const provider =
providers.find((entry) => entry.id === providerId) ??
providers.find(