fix: NoneType not iterable error when summarizing at max iterations
In _handle_max_iterations, the codex_responses path set tools=None to
prevent tool calls during summarization. However, the OpenAI SDK's
_make_tools() treats None as a valid value (not its Omit sentinel) and
tries to iterate over it, causing TypeError: 'NoneType' object is not
iterable.
Fix: use codex_kwargs.pop('tools', None) to remove the key entirely,
so the SDK never receives it and uses its default omit behavior.
Fixes #300
This commit is contained in:
parent
f084538cb9
commit
4f5ffb8909
1 changed files with 2 additions and 2 deletions
|
|
@ -2667,7 +2667,7 @@ class AIAgent:
|
||||||
|
|
||||||
if self.api_mode == "codex_responses":
|
if self.api_mode == "codex_responses":
|
||||||
codex_kwargs = self._build_api_kwargs(api_messages)
|
codex_kwargs = self._build_api_kwargs(api_messages)
|
||||||
codex_kwargs["tools"] = None
|
codex_kwargs.pop("tools", None)
|
||||||
summary_response = self._run_codex_stream(codex_kwargs)
|
summary_response = self._run_codex_stream(codex_kwargs)
|
||||||
assistant_message, _ = self._normalize_codex_response(summary_response)
|
assistant_message, _ = self._normalize_codex_response(summary_response)
|
||||||
final_response = (assistant_message.content or "").strip() if assistant_message else ""
|
final_response = (assistant_message.content or "").strip() if assistant_message else ""
|
||||||
|
|
@ -2713,7 +2713,7 @@ class AIAgent:
|
||||||
# Retry summary generation
|
# Retry summary generation
|
||||||
if self.api_mode == "codex_responses":
|
if self.api_mode == "codex_responses":
|
||||||
codex_kwargs = self._build_api_kwargs(api_messages)
|
codex_kwargs = self._build_api_kwargs(api_messages)
|
||||||
codex_kwargs["tools"] = None
|
codex_kwargs.pop("tools", None)
|
||||||
retry_response = self._run_codex_stream(codex_kwargs)
|
retry_response = self._run_codex_stream(codex_kwargs)
|
||||||
retry_msg, _ = self._normalize_codex_response(retry_response)
|
retry_msg, _ = self._normalize_codex_response(retry_response)
|
||||||
final_response = (retry_msg.content or "").strip() if retry_msg else ""
|
final_response = (retry_msg.content or "").strip() if retry_msg else ""
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue