Skip to content

Commit 78a972e

Browse files
Remove feature flag for execute tool API
Signed-off-by: Nathalie Jonathan <nathhjo@amazon.com>
1 parent d1e53af commit 78a972e

File tree

7 files changed

+0
-51
lines changed

7 files changed

+0
-51
lines changed

common/src/main/java/org/opensearch/ml/common/settings/MLCommonsSettings.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -337,12 +337,6 @@ private MLCommonsSettings() {}
337337
Setting.Property.Dynamic
338338
);
339339

340-
// Feature flag for execute tool API
341-
public static final Setting<Boolean> ML_COMMONS_EXECUTE_TOOL_ENABLED = Setting
342-
.boolSetting(ML_PLUGIN_SETTING_PREFIX + "execute_tools_enabled", false, Setting.Property.NodeScope, Setting.Property.Dynamic);
343-
public static final String ML_COMMONS_EXECUTE_TOOL_DISABLED_MESSAGE =
344-
"The Execute Tool API is not enabled. To enable, please update the setting " + ML_COMMONS_EXECUTE_TOOL_ENABLED.getKey();
345-
346340
public static final Setting<List<String>> ML_COMMONS_REMOTE_JOB_STATUS_FIELD = Setting
347341
.listSetting(
348342
ML_PLUGIN_SETTING_PREFIX + "remote_job.status_field",

common/src/main/java/org/opensearch/ml/common/settings/MLFeatureEnabledSetting.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import static org.opensearch.ml.common.settings.MLCommonsSettings.ML_COMMONS_AGENT_FRAMEWORK_ENABLED;
1010
import static org.opensearch.ml.common.settings.MLCommonsSettings.ML_COMMONS_CONNECTOR_PRIVATE_IP_ENABLED;
1111
import static org.opensearch.ml.common.settings.MLCommonsSettings.ML_COMMONS_CONTROLLER_ENABLED;
12-
import static org.opensearch.ml.common.settings.MLCommonsSettings.ML_COMMONS_EXECUTE_TOOL_ENABLED;
1312
import static org.opensearch.ml.common.settings.MLCommonsSettings.ML_COMMONS_INDEX_INSIGHT_FEATURE_ENABLED;
1413
import static org.opensearch.ml.common.settings.MLCommonsSettings.ML_COMMONS_LOCAL_MODEL_ENABLED;
1514
import static org.opensearch.ml.common.settings.MLCommonsSettings.ML_COMMONS_MCP_CONNECTOR_ENABLED;
@@ -54,8 +53,6 @@ public class MLFeatureEnabledSetting {
5453
private volatile Boolean isMetricCollectionEnabled;
5554
private volatile Boolean isStaticMetricCollectionEnabled;
5655

57-
private volatile Boolean isExecuteToolEnabled;
58-
5956
private volatile Boolean isMcpConnectorEnabled;
6057

6158
private volatile Boolean isAgenticMemoryEnabled;
@@ -79,7 +76,6 @@ public MLFeatureEnabledSetting(ClusterService clusterService, Settings settings)
7976
isRagSearchPipelineEnabled = ML_COMMONS_RAG_PIPELINE_FEATURE_ENABLED.get(settings);
8077
isMetricCollectionEnabled = ML_COMMONS_METRIC_COLLECTION_ENABLED.get(settings);
8178
isStaticMetricCollectionEnabled = ML_COMMONS_STATIC_METRIC_COLLECTION_ENABLED.get(settings);
82-
isExecuteToolEnabled = ML_COMMONS_EXECUTE_TOOL_ENABLED.get(settings);
8379
isMcpConnectorEnabled = ML_COMMONS_MCP_CONNECTOR_ENABLED.get(settings);
8480
isAgenticMemoryEnabled = ML_COMMONS_AGENTIC_MEMORY_ENABLED.get(settings);
8581
isIndexInsightEnabled = ML_COMMONS_INDEX_INSIGHT_FEATURE_ENABLED.get(settings);
@@ -106,7 +102,6 @@ public MLFeatureEnabledSetting(ClusterService clusterService, Settings settings)
106102
clusterService
107103
.getClusterSettings()
108104
.addSettingsUpdateConsumer(MLCommonsSettings.ML_COMMONS_RAG_PIPELINE_FEATURE_ENABLED, it -> isRagSearchPipelineEnabled = it);
109-
clusterService.getClusterSettings().addSettingsUpdateConsumer(ML_COMMONS_EXECUTE_TOOL_ENABLED, it -> isExecuteToolEnabled = it);
110105
clusterService.getClusterSettings().addSettingsUpdateConsumer(ML_COMMONS_MCP_CONNECTOR_ENABLED, it -> isMcpConnectorEnabled = it);
111106
clusterService.getClusterSettings().addSettingsUpdateConsumer(ML_COMMONS_AGENTIC_MEMORY_ENABLED, it -> isAgenticMemoryEnabled = it);
112107
clusterService.getClusterSettings().addSettingsUpdateConsumer(ML_COMMONS_STREAM_ENABLED, it -> isStreamEnabled = it);
@@ -209,14 +204,6 @@ public boolean isStaticMetricCollectionEnabled() {
209204
return isStaticMetricCollectionEnabled;
210205
}
211206

212-
/**
213-
* Whether the execute tool API is enabled. If disabled, execute tool API in ml-commons will be blocked
214-
* @return whether the execute tool API is enabled.
215-
*/
216-
public boolean isToolExecuteEnabled() {
217-
return isExecuteToolEnabled;
218-
}
219-
220207
/**
221208
* Whether the Agentic memory APIs are enabled. If disabled, Agentic memory APIs in ml-commons will be blocked
222209
* @return whether the agentic memory feature is enabled.

common/src/test/java/org/opensearch/ml/common/settings/MLFeatureEnabledSettingTests.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ public void setUp() {
4444
MLCommonsSettings.ML_COMMONS_RAG_PIPELINE_FEATURE_ENABLED,
4545
MLCommonsSettings.ML_COMMONS_METRIC_COLLECTION_ENABLED,
4646
MLCommonsSettings.ML_COMMONS_STATIC_METRIC_COLLECTION_ENABLED,
47-
MLCommonsSettings.ML_COMMONS_EXECUTE_TOOL_ENABLED,
4847
MLCommonsSettings.ML_COMMONS_MCP_CONNECTOR_ENABLED,
4948
MLCommonsSettings.ML_COMMONS_AGENTIC_MEMORY_ENABLED,
5049
MLCommonsSettings.ML_COMMONS_INDEX_INSIGHT_FEATURE_ENABLED,

plugin/src/main/java/org/opensearch/ml/plugin/MachineLearningPlugin.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1359,7 +1359,6 @@ public List<Setting<?>> getSettings() {
13591359
MLCommonsSettings.ML_COMMONS_MCP_SERVER_ENABLED,
13601360
MLCommonsSettings.ML_COMMONS_METRIC_COLLECTION_ENABLED,
13611361
MLCommonsSettings.ML_COMMONS_STATIC_METRIC_COLLECTION_ENABLED,
1362-
MLCommonsSettings.ML_COMMONS_EXECUTE_TOOL_ENABLED,
13631362
MLCommonsSettings.ML_COMMONS_AGENTIC_MEMORY_ENABLED,
13641363
MLCommonsSettings.ML_COMMONS_INDEX_INSIGHT_FEATURE_ENABLED,
13651364
MLCommonsSettings.REMOTE_METADATA_GLOBAL_TENANT_ID,

plugin/src/main/java/org/opensearch/ml/rest/RestMLExecuteAction.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import static org.opensearch.core.rest.RestStatus.BAD_REQUEST;
99
import static org.opensearch.core.rest.RestStatus.INTERNAL_SERVER_ERROR;
1010
import static org.opensearch.core.xcontent.XContentParserUtils.ensureExpectedToken;
11-
import static org.opensearch.ml.common.settings.MLCommonsSettings.ML_COMMONS_EXECUTE_TOOL_DISABLED_MESSAGE;
1211
import static org.opensearch.ml.plugin.MachineLearningPlugin.ML_BASE_URI;
1312
import static org.opensearch.ml.utils.MLExceptionUtils.AGENT_FRAMEWORK_DISABLED_ERR_MSG;
1413
import static org.opensearch.ml.utils.RestActionUtils.PARAMETER_AGENT_ID;
@@ -129,9 +128,6 @@ MLExecuteTaskRequest getRequest(RestRequest request) throws IOException {
129128
((AgentMLInput) input).setTenantId(tenantId);
130129
((AgentMLInput) input).setIsAsync(async);
131130
} else if (uri.startsWith(ML_BASE_URI + "/tools/")) {
132-
if (!mlFeatureEnabledSetting.isToolExecuteEnabled()) {
133-
throw new IllegalStateException(ML_COMMONS_EXECUTE_TOOL_DISABLED_MESSAGE);
134-
}
135131
String toolName = request.param(PARAMETER_TOOL_NAME);
136132
functionName = FunctionName.TOOL;
137133
input = MLInput.parse(parser, functionName.name());

plugin/src/test/java/org/opensearch/ml/rest/RestMLExecuteActionTests.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ public class RestMLExecuteActionTests extends OpenSearchTestCase {
7575
public void setup() {
7676
MockitoAnnotations.openMocks(this);
7777
when(mlFeatureEnabledSetting.isAgentFrameworkEnabled()).thenReturn(true);
78-
when(mlFeatureEnabledSetting.isToolExecuteEnabled()).thenReturn(true);
7978
restMLExecuteAction = new RestMLExecuteAction(mlFeatureEnabledSetting);
8079

8180
threadPool = new TestThreadPool(this.getClass().getSimpleName() + "ThreadPool");
@@ -230,13 +229,6 @@ public void testPrepareRequest_disabled() {
230229
assertThrows(IllegalStateException.class, () -> restMLExecuteAction.handleRequest(request, channel, client));
231230
}
232231

233-
public void testPrepareRequestToolExecute_disabled() {
234-
RestRequest request = getExecuteToolRestRequest();
235-
236-
when(mlFeatureEnabledSetting.isToolExecuteEnabled()).thenReturn(false);
237-
assertThrows(IllegalStateException.class, () -> restMLExecuteAction.handleRequest(request, channel, client));
238-
}
239-
240232
public void testPrepareRequestClientException() throws Exception {
241233
doAnswer(invocation -> {
242234
ActionListener<MLExecuteTaskResponse> actionListener = invocation.getArgument(2);

plugin/src/test/java/org/opensearch/ml/settings/MLFeatureEnabledSettingTests.java

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import static org.opensearch.ml.common.settings.MLCommonsSettings.ML_COMMONS_AGENT_FRAMEWORK_ENABLED;
1616
import static org.opensearch.ml.common.settings.MLCommonsSettings.ML_COMMONS_CONNECTOR_PRIVATE_IP_ENABLED;
1717
import static org.opensearch.ml.common.settings.MLCommonsSettings.ML_COMMONS_CONTROLLER_ENABLED;
18-
import static org.opensearch.ml.common.settings.MLCommonsSettings.ML_COMMONS_EXECUTE_TOOL_ENABLED;
1918
import static org.opensearch.ml.common.settings.MLCommonsSettings.ML_COMMONS_INDEX_INSIGHT_FEATURE_ENABLED;
2019
import static org.opensearch.ml.common.settings.MLCommonsSettings.ML_COMMONS_LOCAL_MODEL_ENABLED;
2120
import static org.opensearch.ml.common.settings.MLCommonsSettings.ML_COMMONS_MCP_CONNECTOR_ENABLED;
@@ -76,7 +75,6 @@ public void setUp() {
7675
ML_COMMONS_RAG_PIPELINE_FEATURE_ENABLED,
7776
ML_COMMONS_METRIC_COLLECTION_ENABLED,
7877
ML_COMMONS_STATIC_METRIC_COLLECTION_ENABLED,
79-
ML_COMMONS_EXECUTE_TOOL_ENABLED,
8078
ML_COMMONS_AGENTIC_MEMORY_ENABLED,
8179
ML_COMMONS_MCP_CONNECTOR_ENABLED,
8280
ML_COMMONS_INDEX_INSIGHT_FEATURE_ENABLED,
@@ -121,20 +119,4 @@ public void testMetricCollectionSettings() {
121119
assertFalse(mlFeatureEnabledSetting.isMetricCollectionEnabled());
122120
assertTrue(mlFeatureEnabledSetting.isStaticMetricCollectionEnabled());
123121
}
124-
125-
@Test
126-
public void testToolExecuteSettings() {
127-
// Test initial values
128-
assertFalse(mlFeatureEnabledSetting.isToolExecuteEnabled());
129-
130-
// Simulate settings change
131-
Settings newSettings = Settings.builder().put(ML_COMMONS_EXECUTE_TOOL_ENABLED.getKey(), true).build();
132-
133-
// Update settings through cluster service
134-
when(clusterService.getSettings()).thenReturn(newSettings);
135-
mlFeatureEnabledSetting = new MLFeatureEnabledSetting(clusterService, newSettings);
136-
137-
// Verify updated values
138-
assertTrue(mlFeatureEnabledSetting.isToolExecuteEnabled());
139-
}
140122
}

0 commit comments

Comments
 (0)