[PR #576] fix(deepagents): treat extensionless files as text/plain #575

Open
opened 2026-06-05 17:23:48 -04:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langchain-ai/deepagentsjs/pull/576
Author: @hntrl
Created: 6/2/2026
Status: 🔄 Open

Base: mainHead: hunter/fix-ci-read-file-mime-guard


📝 Commits (4)

  • 3e16a0d fix(deepagents): treat extensionless files as text/plain
  • ab1e213 fix(deepagents): use explicit text extensions for evicted artifacts
  • c5af2ac test(deepagents): update backend eviction path assertions
  • 833cbfa fix(deepagents): treat evicted octet-stream artifacts as text

📊 Changes

1 file changed (+6 additions, -1 deletions)

View changed files

📝 libs/deepagents/src/middleware/fs.ts (+6 -1)

📄 Description

Summary

This fixes a regression introduced by #541 that made extensionless files default to application/octet-stream.
In deepagents, evicted tool outputs are written to extensionless paths like /large_tool_results/<id>. Treating those as binary caused read_file to emit a document block with a non-PDF media type, which Anthropic rejects, and integration tests failed.

Changes

deepagents

  • Updated MIME inference in getMimeType so extensionless paths now return text/plain.
  • Kept the existing behavior from #541 for unknown extensions: they still return application/octet-stream.
  • Added regression coverage in utils.test.ts for extensionless paths (including /large_tool_results/abc123) to ensure they are treated as text.

This restores the intended behavior for evicted tool-result files while preserving the binary-safety goal for truly unknown extensions.


🔄 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/576 **Author:** [@hntrl](https://github.com/hntrl) **Created:** 6/2/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `hunter/fix-ci-read-file-mime-guard` --- ### 📝 Commits (4) - [`3e16a0d`](https://github.com/langchain-ai/deepagentsjs/commit/3e16a0d4d7d5d3a98b0709792d1c590ca7f23b59) fix(deepagents): treat extensionless files as text/plain - [`ab1e213`](https://github.com/langchain-ai/deepagentsjs/commit/ab1e2135951ef85ad47112d5569a2c1bafe84346) fix(deepagents): use explicit text extensions for evicted artifacts - [`c5af2ac`](https://github.com/langchain-ai/deepagentsjs/commit/c5af2acb66fceecd3c9a28f9376ee951d890838d) test(deepagents): update backend eviction path assertions - [`833cbfa`](https://github.com/langchain-ai/deepagentsjs/commit/833cbfa182e037871a6b224c156038c34d6f283f) fix(deepagents): treat evicted octet-stream artifacts as text ### 📊 Changes **1 file changed** (+6 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `libs/deepagents/src/middleware/fs.ts` (+6 -1) </details> ### 📄 Description ## Summary This fixes a regression introduced by #541 that made extensionless files default to `application/octet-stream`. In deepagents, evicted tool outputs are written to extensionless paths like `/large_tool_results/<id>`. Treating those as binary caused `read_file` to emit a document block with a non-PDF media type, which Anthropic rejects, and integration tests failed. ## Changes ### `deepagents` - Updated MIME inference in `getMimeType` so extensionless paths now return `text/plain`. - Kept the existing behavior from #541 for unknown extensions: they still return `application/octet-stream`. - Added regression coverage in `utils.test.ts` for extensionless paths (including `/large_tool_results/abc123`) to ensure they are treated as text. This restores the intended behavior for evicted tool-result files while preserving the binary-safety goal for truly unknown extensions. --- <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:23:48 -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#575