Skip to content
Sadiq Khan

draft · 1 min read · open-source, langchain, python

The _get_last_messages bug in LangChain

Tracking down and fixing a subtle bug in a 120k-star codebase.

This essay is a draft. The outline below is a placeholder.

The symptom

What went wrong and how it showed up.

Finding the cause

Reading through _get_last_messages and reproducing the failure.

The fix

The change, the tests that cover it, and hardening default_tool_parser along the way.

Contributing to a large project

What I learned about getting a pull request merged in a busy repository.