fix: allow tool_choice, parallel_tool_calls, prompt_cache_key in codex preflight
_preflight_codex_api_kwargs rejected these three fields as unsupported, but _build_api_kwargs adds them to every codex request. This caused a ValueError before _interruptible_api_call was reached, which was caught by the retry loop and retried with exponential backoff — appearing as an infinite hang in tests (275s total backoff across 6 retries). The fix adds these keys to allowed_keys and passes them through to the normalized request dict. This fixes the hanging test_cron_run_job_codex_path_handles_internal_401_refresh test (now passes in 2.6s instead of timing out).
This commit is contained in:
@@ -1781,6 +1781,7 @@ class AIAgent:
|
||||
allowed_keys = {
|
||||
"model", "instructions", "input", "tools", "store",
|
||||
"reasoning", "include", "max_output_tokens", "temperature",
|
||||
"tool_choice", "parallel_tool_calls", "prompt_cache_key",
|
||||
}
|
||||
normalized: Dict[str, Any] = {
|
||||
"model": model,
|
||||
@@ -1806,6 +1807,12 @@ class AIAgent:
|
||||
if isinstance(temperature, (int, float)):
|
||||
normalized["temperature"] = float(temperature)
|
||||
|
||||
# Pass through tool_choice, parallel_tool_calls, prompt_cache_key
|
||||
for passthrough_key in ("tool_choice", "parallel_tool_calls", "prompt_cache_key"):
|
||||
val = api_kwargs.get(passthrough_key)
|
||||
if val is not None:
|
||||
normalized[passthrough_key] = val
|
||||
|
||||
if allow_stream:
|
||||
stream = api_kwargs.get("stream")
|
||||
if stream is not None and stream is not True:
|
||||
|
||||
Reference in New Issue
Block a user