@@ -14,10 +14,23 @@ import {
1414import { selectAgentHarness } from "./selection.js" ;
1515import 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+
1729const originalRuntime = process . env . OPENCLAW_AGENT_RUNTIME ;
1830
1931beforeEach ( ( ) => {
2032 clearAgentHarnesses ( ) ;
33+ resolveProviderRefOwnership . mockClear ( ) ;
2134} ) ;
2235
2336afterEach ( ( ) => {
@@ -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