From d8be403097292ed4d469e9722d529e2487cb94e5 Mon Sep 17 00:00:00 2001 From: kshitijk4poor <82637225+kshitijk4poor@users.noreply.github.com> Date: Sun, 27 Sep 2026 13:09:34 +0530 Subject: [PATCH] fix(compression): match the Codex stall marker on the raw error text The stall check relied on the lowercased error string, which only works while CODEX_STREAM_STALL_MARKER happens to be all-lowercase. Match against str(e) so the shared marker stays authoritative regardless of case, and fold the two duplicate #124077 comments into one explaining the split (stall -> retry-ladder timeout; transport timeouts stay terminal). --- agent/context_compressor.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/agent/context_compressor.py b/agent/context_compressor.py index 87b6dab03c..ffb99647e9 100644 --- a/agent/context_compressor.py +++ b/agent/context_compressor.py @@ -745,9 +745,10 @@ def _classify_summary_failure(e: Exception) -> _SummaryFailureKind: """ status = _exc_status_code(e) err = str(e).lower() - # The Codex aux stream guard's mid-stream stall is transient (#124077). Its no-progress and - # hard-ceiling timeouts deliberately stay terminal network failures. - stall = isinstance(e, TimeoutError) and CODEX_STREAM_STALL_MARKER in err + # #124077: only the Codex aux stream guard's mid-stream stall is a retry-ladder timeout; real + # transport timeouts and the guard's no-progress/hard-ceiling timeouts stay terminal + # network failures (#29559/#94448). + stall = isinstance(e, TimeoutError) and CODEX_STREAM_STALL_MARKER in str(e) return _SummaryFailureKind( # Permanent-looking error on a distinct summary model: fall back to main instead of cooldown. model_not_found=status in {404, 503} @@ -757,8 +758,6 @@ def _classify_summary_failure(e: Exception) -> _SummaryFailureKind: # APIResponseValidationError "expecting value"; treat as transient. json_decode=isinstance(e, json.JSONDecodeError) or "expecting value" in err, # httpx premature-close errors are transient; treat like a timeout, not a 60s cooldown. - # Real transport timeouts stay here (terminal abort, #29559/#94448); only the stream-guard - # stall is a retry-ladder timeout, not a network failure (#124077). streaming_closed=_is_connection_error(e) and not stall, # HTTP 200 with empty body from a degraded provider, plus the sibling "no usable response" # shapes from _validate_llm_response.