Skip to content

Anthropic: test_anthropic_beta_messages_create_captures_compaction_metadata can't be re-recorded #864

Description

While re-recording the latest anthropic cassettes for #849 (anthropic 1.11.0), test_anthropic_beta_messages_create_captures_compaction_metadata in py/src/braintrust/integrations/anthropic/test_anthropic.py failed:

assert response.stop_reason == "compaction"
AssertionError: assert 'max_tokens' == 'compaction'

The live API now stops with max_tokens instead of compaction for that short prompt (claude-opus-5, max_tokens=512, compaction={"type": "summarize"}, beta compact-2026-09-04). The old cassette was kept, so playback still passes, but the test can't be re-recorded as written.

Fix

Update the prompt and/or max_tokens so the API reliably triggers compaction, or relax the stop_reason assertion if the test only needs to verify the compaction metadata is captured. Then re-record cassettes/latest/test_anthropic_beta_messages_create_captures_compaction_metadata.yaml.

Parent: #858 (found while reviewing the 2026-10-05 weekly dependency update, #849).

🤖 Generated with Claude Code

Metadata

Metadata

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions