Bug in n8n AI Agent Batch Mode Caused Silent Context Leaks Between Items

A developer discovered a data corruption bug in n8n's AI Agent node that silently mixed conversation histories between items when Batch Processing was enabled with two or more concurrent items. From the second round onward, one item's tool-call history would overwrite another's, causing the language model to reason from the wrong item's context with no error or warning. The root cause was traced to two source files — executeBatch.ts discarded all but the first item's metadata during batch merging, while buildSteps.ts blindly reinjected that shared history into every item. The fix involved tagging each tool-call step with its originating item index, concatenating all items' histories during the merge, and filtering them back per item during reconstruction. The bug was reported and a pull request submitted to the n8n open-source repository on GitHub.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in