9router/src/app/api/v1/models
Omar Nahhas Sanchez 838d9a7a04
fix: add 5s timeout to fetchCompatibleModelIds and skip upstream connections (#541)
The fetchCompatibleModelIds() function had no timeout on its fetch() call,
causing /v1/models to hang indefinitely when an openai-compatible provider
was unreachable or slow to respond.

Additionally, upstream/cross-instance connections (provider IDs containing
a UUID suffix like openai-compatible-chat-XXXXXXXX) would trigger recursive
/models fetches between instances, creating infinite loops.

Fixes:
- Add AbortController with 5-second timeout to the fetch() call
- Skip dynamic model fetching for upstream/cross-instance connections
  (detected by UUID suffix pattern in provider ID)
- Existing try/catch already handles abort errors gracefully

Co-authored-by: Agent Zero <agent@agent-zero.local>
2026-04-10 10:30:07 +07:00
..
route.js fix: add 5s timeout to fetchCompatibleModelIds and skip upstream connections (#541) 2026-04-10 10:30:07 +07:00