[PR #248] [MERGED] fix(deepagents): preserve ToolMessage metadata on eviction #294

Closed
opened 2026-06-05 17:22:33 -04:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langchain-ai/deepagentsjs/pull/248
Author: @hntrl
Created: 2/23/2026
Status: Merged
Merged: 2/23/2026
Merged by: @hntrl

Base: mainHead: hunter/preserve-artifacts


📝 Commits (1)

  • b5f8dc7 fix(deepagents): preserve ToolMessage metadata on eviction

📊 Changes

3 files changed (+72 additions, -0 deletions)

View changed files

.changeset/preserve-toolmessage-metadata.md (+5 -0)
📝 libs/deepagents/src/middleware/fs.test.ts (+61 -0)
📝 libs/deepagents/src/middleware/fs.ts (+6 -0)

📄 Description

Summary

Fixes a bug where the filesystem eviction path for large ToolMessage results rebuilt the message with only content/tool_call_id/name, dropping important runtime fields. After this change, we preserve the original ToolMessage metadata on the replacement message so downstream tracing/replay logic can still access it.

Changes

  • When evicting a large tool result to /large_tool_results/<tool_call_id>, construct the replacement ToolMessage by copying through:
    • id
    • artifact
    • status
    • metadata
    • additional_kwargs
    • response_metadata
  • Add a regression test to ensure those fields survive the eviction path.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/langchain-ai/deepagentsjs/pull/248 **Author:** [@hntrl](https://github.com/hntrl) **Created:** 2/23/2026 **Status:** ✅ Merged **Merged:** 2/23/2026 **Merged by:** [@hntrl](https://github.com/hntrl) **Base:** `main` ← **Head:** `hunter/preserve-artifacts` --- ### 📝 Commits (1) - [`b5f8dc7`](https://github.com/langchain-ai/deepagentsjs/commit/b5f8dc7a92fc557ae4e0e0668688601d44ef941c) fix(deepagents): preserve ToolMessage metadata on eviction ### 📊 Changes **3 files changed** (+72 additions, -0 deletions) <details> <summary>View changed files</summary> ➕ `.changeset/preserve-toolmessage-metadata.md` (+5 -0) 📝 `libs/deepagents/src/middleware/fs.test.ts` (+61 -0) 📝 `libs/deepagents/src/middleware/fs.ts` (+6 -0) </details> ### 📄 Description ## Summary Fixes a bug where the filesystem eviction path for large `ToolMessage` results rebuilt the message with only `content`/`tool_call_id`/`name`, dropping important runtime fields. After this change, we preserve the original `ToolMessage` metadata on the replacement message so downstream tracing/replay logic can still access it. ## Changes - When evicting a large tool result to `/large_tool_results/<tool_call_id>`, construct the replacement `ToolMessage` by copying through: - `id` - `artifact` - `status` - `metadata` - `additional_kwargs` - `response_metadata` - Add a regression test to ensure those fields survive the eviction path. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-06-05 17:22:33 -04:00
yindo closed this issue 2026-06-05 17:22:33 -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#294