mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-09 13:21:42 +00:00
test(codex): cover gateway-scale stale timeout floor and TTFB gate
This commit is contained in:
parent
cb1ccc57e6
commit
ede4d12561
2 changed files with 21 additions and 2 deletions
|
|
@ -380,7 +380,7 @@ def test_large_codex_request_waits_instead_of_ttfb_reconnect(tmp_path, monkeypat
|
|||
|
||||
monkeypatch.setattr(agent, "_run_codex_stream", fake_stream)
|
||||
|
||||
large_input = "x" * 120_000 # ~30k estimated tokens, above large-request gate.
|
||||
large_input = "x" * 44_000 # ~11k estimated tokens, above the 10k gate.
|
||||
resp = h.interruptible_api_call(agent, {"model": "gpt-5.5", "input": large_input})
|
||||
assert resp is sentinel
|
||||
assert "codex_ttfb_kill" not in closes
|
||||
|
|
@ -415,7 +415,7 @@ def test_large_codex_request_strict_ttfb_env_still_reconnects(tmp_path, monkeypa
|
|||
|
||||
monkeypatch.setattr(agent, "_run_codex_stream", fake_hang)
|
||||
|
||||
large_input = "x" * 120_000
|
||||
large_input = "x" * 44_000
|
||||
try:
|
||||
with pytest.raises(TimeoutError) as excinfo:
|
||||
h.interruptible_api_call(agent, {"model": "gpt-5.5", "input": large_input})
|
||||
|
|
|
|||
|
|
@ -188,3 +188,22 @@ providers:
|
|||
|
||||
agent = _make_agent(tmp_path)
|
||||
assert agent._compute_non_stream_stale_timeout({"input": "hi"}) == 1800.0
|
||||
|
||||
|
||||
# ── openai-codex gateway-scale stale floor ────────────────────────────────
|
||||
|
||||
|
||||
def test_openai_codex_stale_floor_covers_gateway_tool_payload():
|
||||
"""Gateway/Telegram tool payloads (~20k tokens) need the 600s Codex floor."""
|
||||
from agent.chat_completion_helpers import openai_codex_stale_timeout_floor
|
||||
|
||||
assert openai_codex_stale_timeout_floor(22_095) == 600.0
|
||||
assert openai_codex_stale_timeout_floor(10_001) == 600.0
|
||||
assert openai_codex_stale_timeout_floor(10_000) == 0.0
|
||||
|
||||
|
||||
def test_openai_codex_stale_floor_tiers():
|
||||
from agent.chat_completion_helpers import openai_codex_stale_timeout_floor
|
||||
|
||||
assert openai_codex_stale_timeout_floor(55_000) == 900.0
|
||||
assert openai_codex_stale_timeout_floor(120_000) == 1200.0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue