The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test(gateway): exercise the shared overflow classifier instead of a copy
kshitijk4poor1e7d29a08112
diff --git a/tests/gateway/test_7100_transient_failure_transcript.py b/tests/gateway/test_7100_transient_failure_transcript.pyindex 6131a6efe39..4ba88766c47 100644--- a/tests/gateway/test_7100_transient_failure_transcript.py+++ b/tests/gateway/test_7100_transient_failure_transcript.py@@ -16,25 +16,12 @@ The gateway classifier must distinguish:"""+from gateway.run_turn import is_context_overflow_failure_result++def _classify(agent_result: dict, history_len: int) -> tuple[bool, bool]:- """Replicate the gateway classifier from GatewayRunner._run_agent.-- Returns ``(agent_failed_early, is_context_overflow_failure)``.- """- agent_failed_early = bool(agent_result.get("failed"))- err = str(agent_result.get("error", "")).lower()- is_context_overflow_failure = agent_failed_early and (- bool(agent_result.get("compression_exhausted"))- or any(p in err for p in (- "context length", "context size", "context window",- "maximum context", "token limit", "too many tokens",- "reduce the length", "exceeds the limit",- "request entity too large", "prompt is too long",- "payload too large", "input is too long",- ))- or ("400" in err and history_len > 50)- )- return agent_failed_early, is_context_overflow_failure+ """``(agent_failed_early, is_context_overflow_failure)`` as the gateway computes them."""+ return bool(agent_result.get("failed")), is_context_overflow_failure_result(agent_result, history_len)class TestContextOverflowStillSkipsTranscript:diff --git a/tests/gateway/test_normalize_empty_agent_response.py b/tests/gateway/test_normalize_empty_agent_response.pyindex 013fddae756..46ea8416b57 100644--- a/tests/gateway/test_normalize_empty_agent_response.py+++ b/tests/gateway/test_normalize_empty_agent_response.py@@ -135,8 +135,8 @@ class TestNonempty400EnvelopeOverflowReply:_ENVELOPE = 'HTTP 400: {"object":"error","model":"deepseek-v4-flash"}'- def _failed(self, text, error=None):- return {"final_response": text, "failed": True, "error": error or text, "api_calls": 1}+ def _failed(self, text):+ return {"final_response": text, "failed": True, "error": text, "api_calls": 1}def test_long_history_rewrites_envelope_to_session_too_large(self):response = _normalize_empty_agent_response(