Skip to content

Commit adedc32

Browse files
steipetePeter Steinberger
andauthored
test(agents): fixture harness provider discovery (#118228)
Co-authored-by: Peter Steinberger <[email protected]>
1 parent 8df95cc commit adedc32

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

‎src/agents/harness/registry.test.ts‎

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,23 @@ import {
1414
import { selectAgentHarness } from "./selection.js";
1515
import type { AgentHarness } from "./types.js";
1616

17+
const resolveProviderRefOwnership = vi.hoisted(() => vi.fn(() => ({ status: "unowned" as const })));
18+
19+
// Registry tests exercise selection handoff; provider owner/route tests own the real artifacts,
20+
// which would cold-load bundled plugin surfaces for this synthetic provider config.
21+
vi.mock("../../plugins/providers.js", () => ({
22+
resolveProviderRefOwnership,
23+
}));
24+
vi.mock("../../plugins/provider-model-routes.js", () => ({
25+
resolveProviderModelCatalogId: () => null,
26+
resolveProviderModelRoutes: () => null,
27+
}));
28+
1729
const originalRuntime = process.env.OPENCLAW_AGENT_RUNTIME;
1830

1931
beforeEach(() => {
2032
clearAgentHarnesses();
33+
resolveProviderRefOwnership.mockClear();
2134
});
2235

2336
afterEach(() => {
@@ -204,13 +217,18 @@ describe("agent harness registry", () => {
204217
registerAgentHarness(makeHarness("custom", { providers: ["anthropic"] }), {
205218
ownerPluginId: "plugin-a",
206219
});
220+
const config = providerRuntimeConfig("anthropic", "custom");
207221

208222
expect(
209223
selectAgentHarness({
210224
provider: "anthropic",
211225
modelId: "sonnet-4.6",
212-
config: providerRuntimeConfig("anthropic", "custom"),
226+
config,
213227
}).id,
214228
).toBe("custom");
229+
expect(resolveProviderRefOwnership).toHaveBeenCalledWith({
230+
provider: "anthropic",
231+
config,
232+
});
215233
});
216234
});

0 commit comments

Comments
 (0)