[GH-ISSUE #60] File state loss during multiple file operations #17

Closed
opened 2026-02-16 06:16:49 -05:00 by yindo · 1 comment
Owner

Originally created by @janpawellek on GitHub (Nov 18, 2025).
Original GitHub issue: https://github.com/langchain-ai/deepagentsjs/issues/60

Bug description

When using filesystem tools (such as write_file, edit_file, etc.), only the most recently edited file remains in the files state. All other previously existing files disappear after performing an operation.

Steps to reproduce

  1. Create multiple files using the tool (e.g., write_file)
  2. Edit or write a new file
  3. Check the state - only the most recent file is found in the state, all others are missing

Expected behavior

  • When a filesystem tool updates a file, the new file state should include all existing files plus the updated one
  • Previously created files should not disappear

Root cause analysis

  • The code merges file updates incorrectly by including only the update from the current operation, ignoring existing files.
  • In src/middleware/fs.ts, the code should merge file updates into the full existing state.
  • This causes data loss and prevents multiple file operations from coexisting in the application state.

Fix

https://github.com/langchain-ai/deepagentsjs/pull/63

Originally created by @janpawellek on GitHub (Nov 18, 2025). Original GitHub issue: https://github.com/langchain-ai/deepagentsjs/issues/60 ### Bug description When using filesystem tools (such as `write_file`, `edit_file`, etc.), only the most recently edited file remains in the `files` state. All other previously existing files disappear after performing an operation. ### Steps to reproduce 1. Create multiple files using the tool (e.g., `write_file`) 2. Edit or write a new file 3. Check the state - only the most recent file is found in the state, all others are missing ### Expected behavior - When a filesystem tool updates a file, the new file state should include all existing files plus the updated one - Previously created files should not disappear ### Root cause analysis - The code merges file updates incorrectly by including only the update from the current operation, ignoring existing files. - In `src/middleware/fs.ts`, the code should merge file updates into the full existing state. - This causes data loss and prevents multiple file operations from coexisting in the application state. ### Fix https://github.com/langchain-ai/deepagentsjs/pull/63
yindo closed this issue 2026-02-16 06:16:49 -05:00
Author
Owner

@janpawellek commented on GitHub (Dec 5, 2025):

Solved by https://github.com/langchain-ai/deepagentsjs/pull/74
Thank you for that great analysis!

@janpawellek commented on GitHub (Dec 5, 2025): Solved by https://github.com/langchain-ai/deepagentsjs/pull/74 Thank you for that great analysis!
yindo changed title from File state loss during multiple file operations to [GH-ISSUE #60] File state loss during multiple file operations 2026-06-05 17:20:58 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/deepagentsjs#17