Skip to content

fix: prevent 400 format errors from triggering compression loop on Codex Responses API#6751

Merged
teknium1 merged 1 commit into
mainfrom
hermes/hermes-41cd011b
Apr 9, 2026
Merged

fix: prevent 400 format errors from triggering compression loop on Codex Responses API#6751
teknium1 merged 1 commit into
mainfrom
hermes/hermes-41cd011b

Conversation

@teknium1

@teknium1 teknium1 commented Apr 9, 2026

Copy link
Copy Markdown
Contributor

Summary

The error classifier's _classify_400() generic-400 heuristic only extracted err_body_msg from the nested body structure (body["error"]["message"]), missing the flat body format used by OpenAI's Responses API (body["message"]).

This caused descriptive 400 errors like Invalid 'input[index].name': string does not match pattern' to appear generic when the session was large (200k+ tokens, 500+ messages), misclassifying them as context overflow and triggering an infinite compression loop — the agent would compress 516 → 470 messages, step down token limits from 400k → 128k → 64k → 32k, and never recover because the underlying error was a tool name format issue, not context size.

Fix

Added flat-body fallback in _classify_400()body.get("message") when the nested body["error"]["message"] path returns empty. This is consistent with the parent classify_api_error() function which already handles this at line 297-298.

Tests

  • test_400_flat_body_descriptive_not_context_overflow — verifies Responses API format errors with large sessions are classified as format_error, not context_overflow
  • test_400_flat_body_generic_large_session_still_context_overflow — regression test ensuring genuinely generic flat-body errors still trigger the heuristic

All 88 error classifier tests pass. All 26 compression/overflow loop tests pass.

…dex Responses API

The error classifier's generic-400 heuristic only extracted err_body_msg from
the nested body structure (body['error']['message']), missing the flat body
format used by OpenAI's Responses API (body['message']). This caused
descriptive 400 errors like 'Invalid input[index].name: string does not match
pattern' to appear generic when the session was large, misclassifying them as
context overflow and triggering an infinite compression loop.

Added flat-body fallback in _classify_400() consistent with the parent
classify_api_error() function's existing handling at line 297-298.
@teknium1 teknium1 merged commit 3007174 into main Apr 9, 2026
2 of 4 checks passed
Tommyeds pushed a commit to Tommyeds/hermes-agent that referenced this pull request Apr 12, 2026
…dex Responses API (NousResearch#6751)

The error classifier's generic-400 heuristic only extracted err_body_msg from
the nested body structure (body['error']['message']), missing the flat body
format used by OpenAI's Responses API (body['message']). This caused
descriptive 400 errors like 'Invalid input[index].name: string does not match
pattern' to appear generic when the session was large, misclassifying them as
context overflow and triggering an infinite compression loop.

Added flat-body fallback in _classify_400() consistent with the parent
classify_api_error() function's existing handling at line 297-298.
angelburgosrosado pushed a commit to angelburgosrosado/hermes-agent that referenced this pull request Apr 27, 2026
…dex Responses API (NousResearch#6751)

The error classifier's generic-400 heuristic only extracted err_body_msg from
the nested body structure (body['error']['message']), missing the flat body
format used by OpenAI's Responses API (body['message']). This caused
descriptive 400 errors like 'Invalid input[index].name: string does not match
pattern' to appear generic when the session was large, misclassifying them as
context overflow and triggering an infinite compression loop.

Added flat-body fallback in _classify_400() consistent with the parent
classify_api_error() function's existing handling at line 297-298.
02356abc pushed a commit to 02356abc/hermes-agent that referenced this pull request May 14, 2026
…dex Responses API (NousResearch#6751)

The error classifier's generic-400 heuristic only extracted err_body_msg from
the nested body structure (body['error']['message']), missing the flat body
format used by OpenAI's Responses API (body['message']). This caused
descriptive 400 errors like 'Invalid input[index].name: string does not match
pattern' to appear generic when the session was large, misclassifying them as
context overflow and triggering an infinite compression loop.

Added flat-body fallback in _classify_400() consistent with the parent
classify_api_error() function's existing handling at line 297-298.
olympus-terminal pushed a commit to olympus-terminal/hermes-agent that referenced this pull request May 16, 2026
…dex Responses API (NousResearch#6751)

The error classifier's generic-400 heuristic only extracted err_body_msg from
the nested body structure (body['error']['message']), missing the flat body
format used by OpenAI's Responses API (body['message']). This caused
descriptive 400 errors like 'Invalid input[index].name: string does not match
pattern' to appear generic when the session was large, misclassifying them as
context overflow and triggering an infinite compression loop.

Added flat-body fallback in _classify_400() consistent with the parent
classify_api_error() function's existing handling at line 297-298.
gweeteve pushed a commit to gweeteve/hermes-agent that referenced this pull request Jun 2, 2026
…dex Responses API (NousResearch#6751)

The error classifier's generic-400 heuristic only extracted err_body_msg from
the nested body structure (body['error']['message']), missing the flat body
format used by OpenAI's Responses API (body['message']). This caused
descriptive 400 errors like 'Invalid input[index].name: string does not match
pattern' to appear generic when the session was large, misclassifying them as
context overflow and triggering an infinite compression loop.

Added flat-body fallback in _classify_400() consistent with the parent
classify_api_error() function's existing handling at line 297-298.
Egavasyug pushed a commit to Egavasyug/hermes-agent that referenced this pull request Jun 10, 2026
…dex Responses API (NousResearch#6751)

The error classifier's generic-400 heuristic only extracted err_body_msg from
the nested body structure (body['error']['message']), missing the flat body
format used by OpenAI's Responses API (body['message']). This caused
descriptive 400 errors like 'Invalid input[index].name: string does not match
pattern' to appear generic when the session was large, misclassifying them as
context overflow and triggering an infinite compression loop.

Added flat-body fallback in _classify_400() consistent with the parent
classify_api_error() function's existing handling at line 297-298.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant