Skip to content

fix(sdk): avoid unnecessary REMOVE_ALL_MESSAGES in PatchToolCallsMiddleware#1015

Closed
Christian Bromann (christian-bromann) wants to merge 4 commits intomainfrom
cb/improve-dangling-toolcall-fix
Closed

fix(sdk): avoid unnecessary REMOVE_ALL_MESSAGES in PatchToolCallsMiddleware#1015
Christian Bromann (christian-bromann) wants to merge 4 commits intomainfrom
cb/improve-dangling-toolcall-fix

Conversation

@christian-bromann
Copy link
Copy Markdown
Member

@christian-bromann Christian Bromann (christian-bromann) commented Feb 2, 2026

Adding to check whether we need to update the state if no dangling tool calls were found.

Overwrite is an explicit state replacement signal - When we return {"messages": Overwrite(patched_messages)}, LangGraph will perform a state update operation, replacing the messages entirely. This happens regardless of whether the content is identical to what was already there.

Returning None seems a more performant approach.

@github-actions github-actions Bot added the deepagents Related to the `deepagents` SDK / agent harness label Feb 3, 2026
@mdrxy Mason Daugherty (mdrxy) changed the title fix(deepagents): avoid unnecessary REMOVE_ALL_MESSAGES in PatchToolCallsMiddleware fix(sdk): avoid unnecessary REMOVE_ALL_MESSAGES in PatchToolCallsMiddleware Mar 7, 2026
@github-actions github-actions Bot added the fix A bug fix (PATCH) label Mar 7, 2026
@langchain-automated-triage langchain-automated-triage Bot added the internal User is a member of the `langchain-ai` GitHub organization label Mar 10, 2026
@github-actions github-actions Bot added the size: M 200-499 LOC label Mar 10, 2026
@langchain-automated-triage langchain-automated-triage Bot added the size: M 200-499 LOC label Mar 10, 2026
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Mar 19, 2026

Merging this PR will not alter performance

✅ 32 untouched benchmarks
⏩ 15 skipped benchmarks1


Comparing cb/improve-dangling-toolcall-fix (a36e233) with main (877cd0e)

Open in CodSpeed

Footnotes

  1. 15 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.

…oolcall-fix

# Conflicts:
#	libs/deepagents/deepagents/middleware/patch_tool_calls.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

deepagents Related to the `deepagents` SDK / agent harness fix A bug fix (PATCH) internal User is a member of the `langchain-ai` GitHub organization size: M 200-499 LOC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants