Skip to content

fix: trim_messages breaks when token_counter is a per-message c...#35669

Closed
Zakir Jiwani (JiwaniZakir) wants to merge 1 commit into
langchain-ai:masterfrom
JiwaniZakir:fix/issue-35629
Closed

fix: trim_messages breaks when token_counter is a per-message c...#35669
Zakir Jiwani (JiwaniZakir) wants to merge 1 commit into
langchain-ai:masterfrom
JiwaniZakir:fix/issue-35629

fix(core): resolve trim_messages misdetection of per-message token_co…

ee3d55b
Select commit
Loading
Failed to load commit list.
CodSpeed HQ / CodSpeed Performance Analysis failed Mar 8, 2026

Performance Regression: -28.81%

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

❌ 13 regressed benchmarks
⏩ 23 skipped benchmarks1

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
WallTime test_import_time[RunnableLambda] 439.3 ms 528.7 ms -16.91%
WallTime test_import_time[PydanticOutputParser] 475.2 ms 581.9 ms -18.34%
WallTime test_async_callbacks_in_sync 18.6 ms 26.1 ms -28.81%
WallTime test_import_time[InMemoryVectorStore] 550.3 ms 651.7 ms -15.55%
WallTime test_import_time[CallbackManager] 284.9 ms 337.5 ms -15.6%
WallTime test_import_time[HumanMessage] 239.9 ms 280.3 ms -14.42%
WallTime test_import_time[Runnable] 448.4 ms 524.4 ms -14.49%
WallTime test_import_time[tool] 484.6 ms 589.1 ms -17.75%
WallTime test_import_time[ChatPromptTemplate] 563.1 ms 680.2 ms -17.21%
WallTime test_import_time[LangChainTracer] 409.5 ms 490.8 ms -16.55%
WallTime test_import_time[BaseChatModel] 481.4 ms 567 ms -15.1%
WallTime test_import_time[InMemoryRateLimiter] 156.3 ms 183.6 ms -14.85%
WallTime test_import_time[Document] 170.8 ms 198.5 ms -13.95%

Comparing JiwaniZakir:fix/issue-35629 (ee3d55b) with master (fbfe4b8)

Open in CodSpeed

Footnotes

  1. 23 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.