Skip to content

feat(js/plugins/middleware): implemented filesystem middleware#5051

Open
pavelgj wants to merge 8 commits intopj/gm-middleware-skillsfrom
pj/gm-middleware-filesystem
Open

feat(js/plugins/middleware): implemented filesystem middleware#5051
pavelgj wants to merge 8 commits intopj/gm-middleware-skillsfrom
pj/gm-middleware-filesystem

Conversation

@pavelgj
Copy link
Copy Markdown
Member

@pavelgj pavelgj commented Apr 2, 2026

No description provided.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new filesystem middleware for Genkit, providing tools for listing, reading, writing, and editing files within a restricted root directory. The review identified several critical issues regarding concurrency and protocol compliance. Specifically, the use of a shared messageQueue in the middleware factory creates a race condition where messages from different requests could be mixed or lost. Additionally, the error handling in the tool execution hook fails to return a required tool response, which would likely cause API errors in subsequent LLM calls. There is also a bug in the search_and_replace tool where special characters in the replacement string could lead to file corruption; a suggestion was provided to use a replacement function to treat the content as a literal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant