Skip to content

claude_code_agent: eval output folds the model's thinking into the graded answer #5565

Open

Description

@gwarmstrong

Problem

Without training-token capture, which is the eval path, parse_stream_json in responses_api_agents/claude_code_agent/parsing.py folds the model's thinking into the next assistant text as <think>...</think>. Thinking from tool-only turns is buffered until the next text, so the final message carries reasoning, often from several turns, ahead of the answer. Verifiers that grade the final message see all of it. For example, equivalence_llm_judge joins the last assistant message's text without stripping think blocks, so the judge grades reasoning plus answer.

Evidence: an internal HLE Diamond run of Claude Code 2.1.108 through a Gym Model Server (Nemotron 3.5 Super on vLLM). 162 of 162 final answers started with <think>, and the judge's requests contained the block. The Model Server's Messages responses had thinking and text as separate blocks, so the fold happens in the adapter. The other session harnesses keep reasoning out of the graded answer: Pi and Codex return reasoning items, OpenClaw and Hermes strip it, and OpenCode does with #5548.

History

Proposal

Emit thinking as reasoning items in eval output too, as capture mode already does, so messages hold only the model's text. Rename fold_thinking to capture_transcript for what it still controls under capture: only the main conversation, in model order, with pending tool calls kept. A fix is ready; the PR will link here.

Questions for @lafrancef and @linj-glitch:

  • Does anything rely on folded <think> text in Claude Code's eval output, such as a verifier, an exporter or a dataset pipeline?
  • Is there a reason to keep eval and capture output different here?

Part of #5552.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions