From 171af42834a29c097209804f1d3b6bf8cd5a4358 Mon Sep 17 00:00:00 2001 From: Piotr Mlocek Date: Sun, 15 Mar 2026 17:30:24 -0700 Subject: [PATCH] refactor(inference): drop explicit verify flag --- crates/openshell-cli/src/main.rs | 80 +----------------------- crates/openshell-cli/src/run.rs | 6 +- crates/openshell-server/src/inference.rs | 2 +- python/openshell/sandbox.py | 5 -- python/openshell/sandbox_test.py | 34 ---------- 5 files changed, 6 insertions(+), 121 deletions(-) diff --git a/crates/openshell-cli/src/main.rs b/crates/openshell-cli/src/main.rs index 21dc4b604..8995c3df0 100644 --- a/crates/openshell-cli/src/main.rs +++ b/crates/openshell-cli/src/main.rs @@ -905,12 +905,8 @@ enum InferenceCommands { #[arg(long)] system: bool, - /// Verify the resolved upstream endpoint before saving the route. - #[arg(long, conflicts_with = "no_verify")] - verify: bool, - /// Skip endpoint verification before saving the route. - #[arg(long, conflicts_with = "verify")] + #[arg(long)] no_verify: bool, }, @@ -929,12 +925,8 @@ enum InferenceCommands { #[arg(long)] system: bool, - /// Verify the resolved upstream endpoint before saving the route. - #[arg(long, conflicts_with = "no_verify")] - verify: bool, - /// Skip endpoint verification before saving the route. - #[arg(long, conflicts_with = "verify")] + #[arg(long)] no_verify: bool, }, @@ -1812,12 +1804,11 @@ async fn main() -> Result<()> { provider, model, system, - verify, no_verify, } => { let route_name = if system { "sandbox-system" } else { "" }; run::gateway_inference_set( - endpoint, &provider, &model, route_name, verify, no_verify, &tls, + endpoint, &provider, &model, route_name, no_verify, &tls, ) .await?; } @@ -1825,7 +1816,6 @@ async fn main() -> Result<()> { provider, model, system, - verify, no_verify, } => { let route_name = if system { "sandbox-system" } else { "" }; @@ -1834,7 +1824,6 @@ async fn main() -> Result<()> { provider.as_deref(), model.as_deref(), route_name, - verify, no_verify, &tls, ) @@ -2567,48 +2556,6 @@ mod tests { )); } - #[test] - fn inference_set_accepts_verify_flag() { - let cli = Cli::try_parse_from([ - "openshell", - "inference", - "set", - "--provider", - "openai-dev", - "--model", - "gpt-4.1", - "--verify", - ]) - .expect("inference set should parse --verify"); - - assert!(matches!( - cli.command, - Some(Commands::Inference { - command: Some(InferenceCommands::Set { verify: true, .. }) - }) - )); - } - - #[test] - fn inference_update_accepts_verify_flag() { - let cli = Cli::try_parse_from([ - "openshell", - "inference", - "update", - "--provider", - "openai-dev", - "--verify", - ]) - .expect("inference update should parse --verify"); - - assert!(matches!( - cli.command, - Some(Commands::Inference { - command: Some(InferenceCommands::Update { verify: true, .. }) - }) - )); - } - #[test] fn inference_set_accepts_no_verify_flag() { let cli = Cli::try_parse_from([ @@ -2628,7 +2575,6 @@ mod tests { Some(Commands::Inference { command: Some(InferenceCommands::Set { no_verify: true, - verify: false, .. }) }) @@ -2652,32 +2598,12 @@ mod tests { Some(Commands::Inference { command: Some(InferenceCommands::Update { no_verify: true, - verify: false, .. }) }) )); } - #[test] - fn inference_set_rejects_verify_and_no_verify_together() { - let err = Cli::try_parse_from([ - "openshell", - "inference", - "set", - "--provider", - "openai-dev", - "--model", - "gpt-4.1", - "--verify", - "--no-verify", - ]) - .expect_err("verify and no-verify should conflict"); - - assert!(err.to_string().contains("--verify")); - assert!(err.to_string().contains("--no-verify")); - } - #[test] fn completion_script_uses_openshell_command_name() { let script = normalize_completion_script( diff --git a/crates/openshell-cli/src/run.rs b/crates/openshell-cli/src/run.rs index 802ce3e58..d17f4c36d 100644 --- a/crates/openshell-cli/src/run.rs +++ b/crates/openshell-cli/src/run.rs @@ -3390,7 +3390,6 @@ pub async fn gateway_inference_set( provider_name: &str, model_id: &str, route_name: &str, - verify: bool, no_verify: bool, tls: &TlsOptions, ) -> Result<()> { @@ -3413,7 +3412,7 @@ pub async fn gateway_inference_set( provider_name: provider_name.to_string(), model_id: model_id.to_string(), route_name: route_name.to_string(), - verify, + verify: false, no_verify, }) .await; @@ -3450,7 +3449,6 @@ pub async fn gateway_inference_update( provider_name: Option<&str>, model_id: Option<&str>, route_name: &str, - verify: bool, no_verify: bool, tls: &TlsOptions, ) -> Result<()> { @@ -3492,7 +3490,7 @@ pub async fn gateway_inference_update( provider_name: provider.to_string(), model_id: model.to_string(), route_name: route_name.to_string(), - verify, + verify: false, no_verify, }) .await; diff --git a/crates/openshell-server/src/inference.rs b/crates/openshell-server/src/inference.rs index 45f233dcd..55f439446 100644 --- a/crates/openshell-server/src/inference.rs +++ b/crates/openshell-server/src/inference.rs @@ -80,7 +80,7 @@ impl Inference for InferenceService { ) -> Result, Status> { let req = request.into_inner(); let route_name = effective_route_name(&req.route_name)?; - let verify = req.verify || !req.no_verify; + let verify = !req.no_verify; let route = upsert_cluster_inference_route( self.state.store.as_ref(), route_name, diff --git a/python/openshell/sandbox.py b/python/openshell/sandbox.py index f10f450c3..19bdcdf65 100644 --- a/python/openshell/sandbox.py +++ b/python/openshell/sandbox.py @@ -398,17 +398,12 @@ class InferenceRouteClient: *, provider_name: str, model_id: str, - verify: bool = False, no_verify: bool = False, ) -> ClusterInferenceConfig: - if verify and no_verify: - raise ValueError("verify and no_verify are mutually exclusive") - response = self._stub.SetClusterInference( inference_pb2.SetClusterInferenceRequest( provider_name=provider_name, model_id=model_id, - verify=verify, no_verify=no_verify, ), timeout=self._timeout, diff --git a/python/openshell/sandbox_test.py b/python/openshell/sandbox_test.py index d7052c928..c0148dcc7 100644 --- a/python/openshell/sandbox_test.py +++ b/python/openshell/sandbox_test.py @@ -6,8 +6,6 @@ from __future__ import annotations import json from typing import TYPE_CHECKING, Any, cast -import pytest - from openshell._proto import openshell_pb2 from openshell.sandbox import ( _PYTHON_CLOUDPICKLE_BOOTSTRAP, @@ -141,23 +139,6 @@ def test_from_active_cluster_prefers_openshell_gateway_env( client.close() -def test_inference_set_cluster_forwards_verify_flag() -> None: - stub = _FakeInferenceStub() - client = cast("InferenceRouteClient", object.__new__(InferenceRouteClient)) - client._timeout = 30.0 - client._stub = cast("Any", stub) - - result = client.set_cluster( - provider_name="openai-dev", - model_id="gpt-4.1", - verify=True, - ) - - assert result.provider_name == "openai-dev" - assert stub.request is not None - assert stub.request.verify is True - - def test_inference_set_cluster_forwards_no_verify_flag() -> None: stub = _FakeInferenceStub() client = cast("InferenceRouteClient", object.__new__(InferenceRouteClient)) @@ -172,18 +153,3 @@ def test_inference_set_cluster_forwards_no_verify_flag() -> None: assert stub.request is not None assert stub.request.no_verify is True - - -def test_inference_set_cluster_rejects_conflicting_flags() -> None: - stub = _FakeInferenceStub() - client = cast("InferenceRouteClient", object.__new__(InferenceRouteClient)) - client._timeout = 30.0 - client._stub = cast("Any", stub) - - with pytest.raises(ValueError, match="mutually exclusive"): - client.set_cluster( - provider_name="openai-dev", - model_id="gpt-4.1", - verify=True, - no_verify=True, - )