fix(#4550): harden gateway reasoning forwarding follow-up

This commit is contained in:
Rod Boev 2026-06-20 11:04:58 -04:00 committed by nesquena-hermes
parent 26c55404a5
commit ee588ba70e
2 changed files with 14 additions and 5 deletions

View file

@ -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

View file

@ -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()