From 999dc26891deb28f2db91a4ce7ea9cb2bc6fec6c Mon Sep 17 00:00:00 2001 From: Danny Avila Date: Mon, 31 Aug 2026 10:35:35 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20Keep=20the=20system=20def?= =?UTF-8?q?ault=20when=20the=20upload=20provider=20is=20unresolved?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit An upload reports the agents endpoint when the agent's real provider cannot be resolved, as for ephemeral agents with no persisted record. Judging capability from that container downgraded PDF, audio, and video to text even where the actual provider delivers them natively. An unresolved provider now keeps the system default rather than being treated as incapable. --- .../data-provider/src/resolve-llm-delivery-path.spec.ts | 9 +++++++++ packages/data-provider/src/resolve-llm-delivery-path.ts | 7 ++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/packages/data-provider/src/resolve-llm-delivery-path.spec.ts b/packages/data-provider/src/resolve-llm-delivery-path.spec.ts index 5d316578f5..09999f8bf0 100644 --- a/packages/data-provider/src/resolve-llm-delivery-path.spec.ts +++ b/packages/data-provider/src/resolve-llm-delivery-path.spec.ts @@ -189,6 +189,15 @@ describe('resolveDefaultLLMDeliveryPath', () => { ); }); + it('keeps the system default when the provider is unresolved (agents container)', () => { + expect(resolveDefaultLLMDeliveryPath('audio/mpeg', undefined, undefined, 'agents')).toBe( + 'provider', + ); + expect(resolveDefaultLLMDeliveryPath('application/pdf', undefined, undefined, 'agents')).toBe( + 'provider', + ); + }); + it('should export SYSTEM_LLM_DELIVERY_DEFAULTS with correct shape', () => { expect(SYSTEM_LLM_DELIVERY_DEFAULTS.fallback).toBe('text'); expect(SYSTEM_LLM_DELIVERY_DEFAULTS.overrides).toEqual({ diff --git a/packages/data-provider/src/resolve-llm-delivery-path.ts b/packages/data-provider/src/resolve-llm-delivery-path.ts index f6e9ebb597..02392182d6 100644 --- a/packages/data-provider/src/resolve-llm-delivery-path.ts +++ b/packages/data-provider/src/resolve-llm-delivery-path.ts @@ -70,7 +70,12 @@ export function resolveDefaultLLMDeliveryPath( /** Only the system default is capability-gated: an explicit config above is the * admin's decision. A known endpoint that cannot encode documents or media would * otherwise accept the upload and hand the model nothing at all. */ - if (systemDefault === 'provider' && endpoint != null && !isProviderCapable(mimeType, endpoint)) { + /** `agents` is a container, not a provider: it is what an upload reports when the + * agent's real provider could not be resolved, as for ephemeral agents. Judging + * capability from it would downgrade media the actual provider can deliver, so an + * unresolved provider keeps the system default. */ + const providerKnown = endpoint != null && endpoint !== EModelEndpoint.agents; + if (systemDefault === 'provider' && providerKnown && !isProviderCapable(mimeType, endpoint)) { return 'text'; }