[PR #5716] [MERGED] fix provider override in agents #5541

Closed
opened 2026-06-05 15:21:40 -04:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Mintplex-Labs/anything-llm/pull/5716
Author: @timothycarambat
Created: 5/27/2026
Status: Merged
Merged: 5/27/2026
Merged by: @timothycarambat

Base: masterHead: agent-context-windows


📝 Commits (1)

  • 71a8c66 fix provider override in agents

📊 Changes

3 files changed (+74 additions, -36 deletions)

View changed files

📝 server/utils/agents/aibitat/index.js (+44 -31)
📝 server/utils/agents/aibitat/plugins/chat-history.js (+2 -2)
📝 server/utils/agents/aibitat/providers/ai-provider.js (+28 -3)

📄 Description

Fix issue where .contextLimit called from agent tools:

  • web-scraping
  • doc-summarize
  • filesystem

would pass in an object into this caller - which expected a string, and would then failover silently to an 8K context window instead of using the actual user defined or reported context window.

This would lead to weird behaviors when models would try to send large documents to models resulting in errors or generall mishandle the context window.


Fixes root cause:

  • TypeError reporting when trying to set provider to anything other than a string
  • Added type validation get/setters
  • Added verbose error logging in case this somehow crops up in future due to lack of type safety in JS
  • Minor refactor in aibitat handleAsyncExecution and handleExecution to use class level object for providerInstance.

🔄 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/Mintplex-Labs/anything-llm/pull/5716 **Author:** [@timothycarambat](https://github.com/timothycarambat) **Created:** 5/27/2026 **Status:** ✅ Merged **Merged:** 5/27/2026 **Merged by:** [@timothycarambat](https://github.com/timothycarambat) **Base:** `master` ← **Head:** `agent-context-windows` --- ### 📝 Commits (1) - [`71a8c66`](https://github.com/Mintplex-Labs/anything-llm/commit/71a8c66765aeea0bfc5f5d1be293f367cfe7c4d2) fix provider override in agents ### 📊 Changes **3 files changed** (+74 additions, -36 deletions) <details> <summary>View changed files</summary> 📝 `server/utils/agents/aibitat/index.js` (+44 -31) 📝 `server/utils/agents/aibitat/plugins/chat-history.js` (+2 -2) 📝 `server/utils/agents/aibitat/providers/ai-provider.js` (+28 -3) </details> ### 📄 Description Fix issue where `.contextLimit` called from agent tools: - web-scraping - doc-summarize - filesystem would pass in an object into this caller - which expected a string, and would then failover silently to an 8K context window instead of using the actual user defined or reported context window. This would lead to weird behaviors when models would try to send large documents to models resulting in errors or generall mishandle the context window. --- Fixes root cause: - TypeError reporting when trying to `set` provider to anything other than a string - Added type validation get/setters - Added verbose error logging in case this somehow crops up in future due to lack of type safety in JS - Minor refactor in aibitat `handleAsyncExecution` and `handleExecution` to use class level object for providerInstance. --- <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 15:21:40 -04:00
yindo closed this issue 2026-06-05 15:21:40 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mintplex-Labs/anything-llm#5541