Affected Area
Model interaction (OpenAI, Anthropic, Gemini, etc.)
Model Provider
anthropic
Model ID
claude-4-5-opus-20250224
Bug Description
When resuming a conversation or continuing a session, the CPE agent filters out "thinking" blocks from the conversation history before sending it back to the model. This is implemented via a BlockWhitelistFilter in internal/agent/generator.go which only allows gai.Content and gai.ToolCall blocks.
While this behavior is generally desirable for many models that don't support interleaved thinking or context preservation of reasoning traces, Claude 4.5 Opus specifically has the capability to preserve and refer to previous thinking blocks. Filtering these out deprives Opus of valuable context about its previous reasoning steps.
The logic currently looks like this:
// internal/agent/generator.go
filterToolGen := NewBlockWhitelistFilter(toolGen, []string{gai.Content, gai.ToolCall})
It unconditionally excludes gai.Thinking.
Expected Behavior
If the model is Claude 4.5 Opus (e.g., ID claude-4-5-opus-20250224), the BlockWhitelistFilter should include gai.Thinking in the allowed types list, so that previous thinking traces are preserved in the conversation history sent to the API.
For other models, the current behavior (filtering thinking blocks) should likely persist unless they are also known to support this.
Steps to Reproduce
- Configure CPE to use
claude-4-5-opus-20250224 with a thinking-budget enabled.
- Run a command that triggers reasoning/thinking.
- Continue the conversation (or inspect the logs/debug output if available).
- Observe that the previous "Thinking" block is not present in the context sent for the second turn.
Relevant Configuration
models:
- name: opus
id: claude-4-5-opus-20250224
type: anthropic
generationDefaults:
thinkingBudget: "1024"
Environment
- CPE version: (Current dev)
- Go version: 1.25.1
- OS: Linux
Additional Context
Reference code in internal/agent/generator.go:
// Wrap the tool generator with BlockWhitelistFilter to filter thinking blocks
// only from the initial dialog, but preserve them during tool execution
filterToolGen := NewBlockWhitelistFilter(toolGen, []string{gai.Content, gai.ToolCall})
Affected Area
Model interaction (OpenAI, Anthropic, Gemini, etc.)
Model Provider
anthropic
Model ID
claude-4-5-opus-20250224
Bug Description
When resuming a conversation or continuing a session, the CPE agent filters out "thinking" blocks from the conversation history before sending it back to the model. This is implemented via a
BlockWhitelistFilterininternal/agent/generator.gowhich only allowsgai.Contentandgai.ToolCallblocks.While this behavior is generally desirable for many models that don't support interleaved thinking or context preservation of reasoning traces, Claude 4.5 Opus specifically has the capability to preserve and refer to previous thinking blocks. Filtering these out deprives Opus of valuable context about its previous reasoning steps.
The logic currently looks like this:
It unconditionally excludes
gai.Thinking.Expected Behavior
If the model is Claude 4.5 Opus (e.g., ID
claude-4-5-opus-20250224), theBlockWhitelistFiltershould includegai.Thinkingin the allowed types list, so that previous thinking traces are preserved in the conversation history sent to the API.For other models, the current behavior (filtering thinking blocks) should likely persist unless they are also known to support this.
Steps to Reproduce
claude-4-5-opus-20250224with athinking-budgetenabled.Relevant Configuration
Environment
Additional Context
Reference code in
internal/agent/generator.go: