From 0ed6780798d85980187c9423f4285a7f75dec739 Mon Sep 17 00:00:00 2001 From: Luis Alejandro Vega Date: Sun, 5 Jul 2026 02:30:04 -0300 Subject: [PATCH] fix: add nvidia to PROVIDER_TOOL_LIMITS (1536) to prevent tool truncation (#6177) NVIDIA NIM API (nvidia/* models) silently truncates the tool list to 128 (the default MAX_TOOLS_LIMIT) because nvidia is not in PROVIDER_TOOL_LIMITS. Tools beyond index 127 are dropped, causing agents to lose access to critical tools like task, read, or high-index MCP tools. Verified that NVIDIA NIM API supports up to 1536 tools by direct testing. End-to-end confirmed: 198 tools sent, model successfully called tools at indices 193, 195, and 197 (previously dropped by truncation to 128). Follows the same pattern as #5563 (grok-cli: 200), integrated in v3.8.43. --- open-sse/services/toolLimitDetector.ts | 1 + tests/unit/tool-limit-detector.test.ts | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/open-sse/services/toolLimitDetector.ts b/open-sse/services/toolLimitDetector.ts index 48969fcb12..5685f26e98 100644 --- a/open-sse/services/toolLimitDetector.ts +++ b/open-sse/services/toolLimitDetector.ts @@ -6,6 +6,7 @@ const DEFAULT_LIMIT = MAX_TOOLS_LIMIT; const PROVIDER_TOOL_LIMITS: Record = { "grok-cli": 200, + "nvidia": 1536, }; const _detectedLimitsSweep = setInterval(() => { diff --git a/tests/unit/tool-limit-detector.test.ts b/tests/unit/tool-limit-detector.test.ts index d1ce4a88fd..82e89323bd 100644 --- a/tests/unit/tool-limit-detector.test.ts +++ b/tests/unit/tool-limit-detector.test.ts @@ -69,6 +69,15 @@ describe("toolLimitDetector", () => { assert.strictEqual(getEffectiveToolLimit("grok-cli"), 200); }); + it("should return proactive limit for nvidia (1536) without any detection", () => { + assert.strictEqual(getEffectiveToolLimit("nvidia"), 1536); + }); + + it("should not override nvidia proactive limit with reactive detection", () => { + setDetectedToolLimit("nvidia", 100); + assert.strictEqual(getEffectiveToolLimit("nvidia"), 1536); + }); + it("should still return default (128) for unknown providers", () => { assert.strictEqual(getEffectiveToolLimit("some-new-provider"), 128); });