Skip to content

[codex] Add truncated reasoning response error#1768

Draft
rasdani wants to merge 1 commit into
mainfrom
codex/truncated-reasoning-error
Draft

[codex] Add truncated reasoning response error#1768
rasdani wants to merge 1 commit into
mainfrom
codex/truncated-reasoning-error

Conversation

@rasdani

@rasdani rasdani commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a narrow TruncatedReasoningError for renderer responses that hit finish_reason == "length" after emitting reasoning but before producing content or tool calls.

The new error subclasses EmptyModelResponseError, so existing retry/catch behavior remains compatible while downstream logs can distinguish true empty responses from length-truncated reasoning-only responses.

Validation

  • uv run ruff format verifiers/errors.py verifiers/clients/renderer_client.py verifiers/utils/error_utils.py tests/test_renderer_client.py tests/test_error_chain.py
  • uv run ruff check verifiers/errors.py verifiers/clients/renderer_client.py verifiers/utils/error_utils.py tests/test_renderer_client.py tests/test_error_chain.py
  • uv run pytest tests/test_renderer_client.py::test_renderer_client_rejects_reasoning_only_native_response tests/test_renderer_client.py::test_renderer_client_rejects_truncated_reasoning_native_response tests/test_error_chain.py::TestErrorChain::test_truncated_reasoning_error_round_trips
  • Replayed saved Nemotron Nano SWE repro with PYTHONPATH=/root/git/verifiers; the capped response now classifies as TruncatedReasoningError with finish_reason=length, content_len=0, tool_call_count=0, and reasoning_len=611.

Note

Add TruncatedReasoningError for responses that hit length limit during reasoning

  • Adds TruncatedReasoningError as a subclass of EmptyModelResponseError in verifiers/errors.py to distinguish length-truncated reasoning responses from generic empty responses.
  • Updates RendererClient.raise_from_native_response in renderer_client.py to raise TruncatedReasoningError instead of EmptyModelResponseError when a response has reasoning_content, no content or tool calls, and finish_reason == 'length'.
  • Registers TruncatedReasoningError in vf_error_types so it round-trips correctly through error serialization.

Macroscope summarized 6808f92.

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