Back

langchain #35034

fix(anthropic): support automatic compaction (Opus 4.6)

by ccurme · Feb 06, 2026 at 19:29 UTC · scan-4d01c0e4f96a5473

Medium Risk (40%)

Get this automatically on every PR

Install the Axiomo GitHub App to get Signals as check runs and PR comments on every pull request.

Install App

Risk Assessment

Risk level: Medium (40%)

Risk Drivers

  • binary_files_added: 1 binary file(s) added
  • api_surface_change: API surface changed in 3 file(s)

Intent

3/3 criteria met

Support automatic compaction and add inference_geo parameter for Anthropic models

Non-Goals

  • - Feature enhancements unrelated to compaction
  • - Refactoring unrelated code
  • - Supporting versions below Opus 4.6

Acceptance Criteria

  • โœ“
    Support automatic compaction in Anthropic models

    Documentation and changes in `chat_models.py` for adaptive type

  • โœ“
    Document `thinking={'type':'adaptive'}`

    Clarification added in `chat_models.py`

  • โœ“
    Support `inference_geo` as an init param

    Test `test_inference_geo_in_payload` in `test_chat_models.py`

Confidence: 95.0% Source: diff analysis AI: openai

Contributors

ccurme PR Author 7 commits + Trusted
Account Age: 3245 days
Prior PRs: 1153
Merged: 1100

Trusted contributor with 1100 merged PRs. has 207 followers. unfamiliar with libs/partners/anthropic/tests/cassettes/test_compaction.yaml.gz.

Evidence

Evidence Completeness: 82.0%
ci_passing Passing
security_scan_clean Passing
lint_passing Passing
tests_passing Unavailable
build_successful Passing
Missing: coverage_maintained

Supply Chain

Low Risk
Modifies dependencies
Modifies lockfile
Modifies CI config
Modifies build scripts

Focus Files

Review 1 high-priority file(s)

libs/partners/anthropic/tests/integration_tests/test_chat_models.py +109

109 lines changed; Source code

high
libs/partners/anthropic/langchain_anthropic/chat_models.py +26

Source code

medium
libs/partners/anthropic/tests/unit_tests/test_chat_models.py +7

Source code

medium
libs/partners/anthropic/tests/cassettes/test_compaction.yaml.gz +0

New file

low
libs/partners/anthropic/pyproject.toml +2

Configuration

low

Triage

29

minutes to review

medium

effort level

none

staleness risk

Standard review process

Recommendation

APPROVE 76.0% readiness

Good evidence, acceptable risk, ready for merge

Next Steps

Question

Why is coverage_maintained missing? Consider adding this check.