mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-06-04 07:31:58 +00:00
fix(agent): recover Codex streams with null output
This commit is contained in:
parent
bb4703c761
commit
43a3f119fc
4 changed files with 250 additions and 62 deletions
|
|
@ -2554,6 +2554,45 @@ class TestCodexAuxiliaryAdapterTimeout:
|
|||
assert time.monotonic() - started < 0.14
|
||||
|
||||
|
||||
class TestCodexAuxiliaryAdapterNullOutputRecovery:
|
||||
def test_recovers_output_item_when_sdk_raises_during_iteration(self):
|
||||
"""Regression for #11179 in auxiliary calls such as compression/title generation."""
|
||||
|
||||
output_item = SimpleNamespace(
|
||||
type="message",
|
||||
content=[SimpleNamespace(type="output_text", text="aux survived")],
|
||||
)
|
||||
|
||||
class NullOutputParseStream:
|
||||
def __enter__(self):
|
||||
return self
|
||||
|
||||
def __exit__(self, exc_type, exc, tb):
|
||||
return False
|
||||
|
||||
def __iter__(self):
|
||||
yield SimpleNamespace(type="response.output_item.done", item=output_item)
|
||||
raise TypeError("'NoneType' object is not iterable")
|
||||
|
||||
def get_final_response(self): # pragma: no cover - iterator fails first
|
||||
raise AssertionError("get_final_response should not be reached")
|
||||
|
||||
class FakeResponses:
|
||||
def __init__(self):
|
||||
self.create = MagicMock()
|
||||
|
||||
def stream(self, **kwargs):
|
||||
return NullOutputParseStream()
|
||||
|
||||
fake_client = SimpleNamespace(responses=FakeResponses())
|
||||
adapter = _CodexCompletionsAdapter(fake_client, "gpt-5.5")
|
||||
|
||||
response = adapter.create(messages=[{"role": "user", "content": "summarize"}])
|
||||
|
||||
assert response.choices[0].message.content == "aux survived"
|
||||
fake_client.responses.create.assert_not_called()
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Issue #23432 — auxiliary timeout poisons cached client; later aux calls fail
|
||||
# ---------------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue