Repository: openai/openai-agents-python

Issue:
name_override not respected when use_docstring_info=False due to missing parentheses in func_name assignment in function_schema
### Describe the bug
A clear and concise description of what the bug is.

In the *function_schema* method of the OpenAI Agents SDK, the following line:

```func_name = name_override or doc_info.name if doc_info else func.__name__```

does not honor name_override when use_docstring_info=False. This happens because of operator precedence in Python. Without parentheses, the expression is interpreted as:

```func_name = (name_override or doc_info.name) if doc_info else func.__name__```
So when doc_info is None, even if name_override is set, it falls back to func.__name__.

### Debug information
- Agents SDK version: (e.g. `v0.0.3`)
- Python version (e.g. Python 3.10)

### Repro steps

from agents.function_schema import function_schema

def my_func():
    pass

schema = function_schema(
    my_func,
    name_override="CustomName",
    use_docstring_info=False
)

print(schema.name)  # Expected: "CustomName", Actual: "my_func"


### Expected behavior
Even when use_docstring_info=False, if name_override is provided, it should be used for func_name.

Suggested Fix:
Update this line:
func_name = name_override or doc_info.name if doc_info else func.__name__
To this (with parentheses to enforce correct evaluation):
func_name = name_override or (doc_info.name if doc_info else func.__name__)

Discussion:

Solution patch:
diff --git a/src/agents/function_schema.py b/src/agents/function_schema.py
index 1885669..dd1db1f 100644
--- a/src/agents/function_schema.py
+++ b/src/agents/function_schema.py
@@ -223,7 +223,8 @@ def function_schema(
         doc_info = None
         param_descs = {}
 
-    func_name = name_override or doc_info.name if doc_info else func.__name__
+    # Ensure name_override takes precedence even if docstring info is disabled.
+    func_name = name_override or (doc_info.name if doc_info else func.__name__)
 
     # 2. Inspect function signature and get type hints
     sig = inspect.signature(func)


Test patch:
diff --git a/tests/test_function_schema.py b/tests/test_function_schema.py
index 5618d8a..54e7e2f 100644
--- a/tests/test_function_schema.py
+++ b/tests/test_function_schema.py
@@ -439,3 +439,15 @@ def test_schema_with_mapping_raises_strict_mode_error():
 
     with pytest.raises(UserError):
         function_schema(func_with_mapping)
+
+
+def test_name_override_without_docstring() -> None:
+    """name_override should be used even when not parsing docstrings."""
+
+    def foo(x: int) -> int:
+        return x
+
+    fs = function_schema(foo, use_docstring_info=False, name_override="custom")
+
+    assert fs.name == "custom"
+    assert fs.params_json_schema.get("title") == "custom_args"