diff --git a/api/gateway_chat.py b/api/gateway_chat.py index c809b023..3cc42166 100644 --- a/api/gateway_chat.py +++ b/api/gateway_chat.py @@ -108,6 +108,7 @@ def _gateway_reasoning_effort_for_request(cfg, *, model=None, model_provider=Non model, provider_id=model_provider, ) + # Preserve explicit "none" while still omitting absent or invalid effort. return None if not coerced else str(coerced) except Exception: return None diff --git a/tests/test_gateway_approval_runs_api.py b/tests/test_gateway_approval_runs_api.py index 5f97bd1d..a5b57a61 100644 --- a/tests/test_gateway_approval_runs_api.py +++ b/tests/test_gateway_approval_runs_api.py @@ -135,12 +135,20 @@ def test_gateway_runs_api_submission(): captured = {} original_text = "hello from runs" - def fake_runs_streaming(*args, **kwargs): + def fake_runs_streaming( + session_id, + msg_text, + model, + workspace, + stream_id, + base_url, + api_key, + prefill_messages, + body_extras, + **kwargs, + ): runs_called["called"] = True - captured["body_extras"] = kwargs.get("body_extras") - if captured["body_extras"] is None: - if len(args) > 8: - captured["body_extras"] = args[8] + captured["body_extras"] = body_extras return (original_text, {"input_tokens": 10, "output_tokens": 5}) mock_session = MagicMock()