Add TodoListMiddleware for code review planning#5813
Add TodoListMiddleware for code review planning#5813suhaibmujahid wants to merge 1 commit intomozilla:masterfrom
Conversation
Integrate TodoListMiddleware into the code review agent to enable tracking of investigation tasks during reviews.
JiwaniZakir
left a comment
There was a problem hiding this comment.
The import from langchain.agents.middleware import TodoListMiddleware is worth scrutinizing — langchain.agents.middleware does not appear to be a documented or stable LangChain module, and there's no pinned version or changelog reference to confirm this API exists. If this is a custom internal class or a very recent addition, it should either be vendored locally or accompanied by a minimum version constraint in the project's dependencies to prevent silent import failures.
The CODE_REVIEW_TODO_TOOL_DESCRIPTION in prompts.py mentions expand_context and find_function_definition by name as examples of "tool-based verification," which is a useful constraint — but the CODE_REVIEW_TODO_PROMPT doesn't echo this same framing. Since the prompt is what the model actually sees at runtime, it would be more effective to include those concrete tool examples there too, rather than only in the tool description that the model may see in a different context window position.
There are no tests covering the new middleware integration — at minimum, a unit test asserting that the agent is constructed with the TodoListMiddleware instance (checking middleware kwarg contents) would catch regressions if the create_agent signature changes. Given that middleware appears to be a new parameter path, this seems like a reasonable place to guard.
Resolves #5812
Integrate TodoListMiddleware into the code review agent to enable tracking of investigation tasks during reviews.