[PR #5552] [CLOSED] fix(agent): keep streamed tool call real ids #5480

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

📋 Pull Request Information

Original PR: https://github.com/Mintplex-Labs/anything-llm/pull/5552
Author: @haimingZZ
Created: 4/28/2026
Status: Closed

Base: masterHead: fix/tooled-stream-real-id-haimingzz


📝 Commits (1)

  • 7ca3927 fix(agent): keep streamed tool call real ids

📊 Changes

2 files changed (+71 additions, -1 deletions)

View changed files

server/__tests__/utils/agents/aibitat/providers/helpers/tooled.test.js (+70 -0)
📝 server/utils/agents/aibitat/providers/helpers/tooled.js (+1 -1)

📄 Description

Summary

  • let native streaming tool-call assembly replace a generated fallback call_* id when a later chunk provides the real provider id
  • add a focused regression test for streams that start with id: null and later emit the real tool-call id

Why

This is part of the native OpenAI-compatible tool/function calling work tracked in #4181. In streaming mode, some OpenAI-compatible providers can start a tool call with a null id and send the real id in a later chunk. The current condition only overwrites ids that are not generated fallbacks, so the final functionCall.id can remain the synthetic fallback instead of the provider's real id.

Keeping the real id matters for the following assistant-tool result pairing (tool_call_id) as this native tool-calling path continues moving toward OpenAI spec tool calling + streaming.

Linked issue

Tests

  • npx jest server/__tests__/utils/agents/aibitat/providers/helpers/tooled.test.js --runInBand

🔄 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/5552 **Author:** [@haimingZZ](https://github.com/haimingZZ) **Created:** 4/28/2026 **Status:** ❌ Closed **Base:** `master` ← **Head:** `fix/tooled-stream-real-id-haimingzz` --- ### 📝 Commits (1) - [`7ca3927`](https://github.com/Mintplex-Labs/anything-llm/commit/7ca3927f6256dba02fbc13f5a006c6b6430cba18) fix(agent): keep streamed tool call real ids ### 📊 Changes **2 files changed** (+71 additions, -1 deletions) <details> <summary>View changed files</summary> ➕ `server/__tests__/utils/agents/aibitat/providers/helpers/tooled.test.js` (+70 -0) 📝 `server/utils/agents/aibitat/providers/helpers/tooled.js` (+1 -1) </details> ### 📄 Description ## Summary - let native streaming tool-call assembly replace a generated fallback `call_*` id when a later chunk provides the real provider id - add a focused regression test for streams that start with `id: null` and later emit the real tool-call id ## Why This is part of the native OpenAI-compatible tool/function calling work tracked in #4181. In streaming mode, some OpenAI-compatible providers can start a tool call with a null id and send the real id in a later chunk. The current condition only overwrites ids that are **not** generated fallbacks, so the final `functionCall.id` can remain the synthetic fallback instead of the provider's real id. Keeping the real id matters for the following assistant-tool result pairing (`tool_call_id`) as this native tool-calling path continues moving toward OpenAI spec tool calling + streaming. ## Linked issue - Supports #4181 ## Tests - `npx jest server/__tests__/utils/agents/aibitat/providers/helpers/tooled.test.js --runInBand` --- <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:29 -04:00
yindo closed this issue 2026-06-05 15:21:29 -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#5480