[PR #23588] [CLOSED] fix: guard circular tool server schemas #27268

Closed
opened 2026-04-20 06:58:08 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/23588
Author: @grtninja
Created: 4/11/2026
Status: Closed

Base: devHead: codex/issue-23543-openapi-cycle


📝 Commits (1)

  • d619046 fix: guard circular tool server schemas

📊 Changes

2 files changed (+92 additions, -5 deletions)

View changed files

backend/open_webui/test/util/test_tools.py (+75 -0)
📝 backend/open_webui/utils/tools.py (+17 -5)

📄 Description

Pull Request Checklist

Note to first-time contributors: Please open a discussion post in Discussions to discuss your idea/fix with the community before creating a pull request, and describe your changes before submitting a pull request.

This is to ensure large feature PRs are discussed with the community first, before starting work on it. If the community does not want this feature or it is not relevant for Open WebUI as a project, it can be identified in the discussion before working on the feature and submitting the PR.

Before submitting, make sure you've checked the following:

  • Target branch: Verify that the pull request targets the dev branch. PRs targeting main will be immediately closed.
  • Description: Provide a concise description of the changes made in this pull request down below.
  • Changelog: Ensure a changelog entry following the format of Keep a Changelog is added at the bottom of the PR description.
  • Documentation: No docs repo update included in this PR; this is a backend utility fix with focused regression coverage only.
  • Dependencies: No new or upgraded dependencies were added.
  • Testing: I manually ran the targeted validation steps listed below for this backend fix.
  • Agentic AI Code: This PR was agent-assisted; leaving this unchecked for maintainers to evaluate alongside the recorded manual validation notes.
  • Code review: I performed a focused self-review of the touched utility and regression-test surfaces.
  • Design & Architecture: This keeps the fix local to the schema-conversion path and avoids new settings or wider behavior changes.
  • Git Hygiene: This branch was rebased onto dev and keeps the change atomic.
  • Title Prefix: The PR title uses the fix: prefix.

Changelog Entry

Description

  • Guard circular OpenAPI request-schema expansion in tool-server conversion and keep one failing server from taking down the entire /api/v1/tools response.

Added

  • Focused regression coverage for circular request-body $ref handling and per-server conversion isolation.

Changed

  • Tool-server schema resolution now short-circuits repeated $ref expansion instead of recursing indefinitely.

Deprecated

  • None.

Removed

  • None.

Fixed

  • Fixes #23543 by preventing recursive request schemas from causing RecursionError during tool-server OpenAPI conversion.
  • Prevents a single bad tool-server spec from aborting the whole tool-server list conversion pass.

Security

  • Improves availability and fault isolation for externally supplied tool-server OpenAPI specs by bounding recursive schema expansion.

Breaking Changes

  • BREAKING CHANGE: None.

Additional Information

  • Touched files:
    • backend/open_webui/utils/tools.py
    • backend/open_webui/test/util/test_tools.py
  • Validation performed:
    • python -m py_compile backend/open_webui/utils/tools.py backend/open_webui/test/util/test_tools.py
    • Targeted source-level smoke to confirm circular request schemas are bounded and that one failed tool-server conversion no longer prevents healthy servers from being listed
  • No new settings, dependencies, or user-facing UI changes.

Screenshots or Videos

  • Not applicable for this backend utility fix.

Contributor License Agreement

Note

Deleting the CLA section will lead to immediate closure of your PR and it will not be merged in.


🔄 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/open-webui/open-webui/pull/23588 **Author:** [@grtninja](https://github.com/grtninja) **Created:** 4/11/2026 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `codex/issue-23543-openapi-cycle` --- ### 📝 Commits (1) - [`d619046`](https://github.com/open-webui/open-webui/commit/d619046897e9bfc501b4524380cf3b9559bab46b) fix: guard circular tool server schemas ### 📊 Changes **2 files changed** (+92 additions, -5 deletions) <details> <summary>View changed files</summary> ➕ `backend/open_webui/test/util/test_tools.py` (+75 -0) 📝 `backend/open_webui/utils/tools.py` (+17 -5) </details> ### 📄 Description <!-- ⚠️ CRITICAL CHECKS FOR CONTRIBUTORS (READ, DON'T DELETE) ⚠️ 1. Target the `dev` branch. PRs targeting `main` will be automatically closed. 2. Do NOT delete the CLA section at the bottom. It is required for the bot to accept your PR. --> # Pull Request Checklist ### Note to first-time contributors: Please open a discussion post in [Discussions](https://github.com/open-webui/open-webui/discussions) to discuss your idea/fix with the community before creating a pull request, and describe your changes before submitting a pull request. This is to ensure large feature PRs are discussed with the community first, before starting work on it. If the community does not want this feature or it is not relevant for Open WebUI as a project, it can be identified in the discussion before working on the feature and submitting the PR. **Before submitting, make sure you've checked the following:** - [x] **Target branch:** Verify that the pull request targets the `dev` branch. **PRs targeting `main` will be immediately closed.** - [x] **Description:** Provide a concise description of the changes made in this pull request down below. - [x] **Changelog:** Ensure a changelog entry following the format of [Keep a Changelog](https://keepachangelog.com/) is added at the bottom of the PR description. - [ ] **Documentation:** No docs repo update included in this PR; this is a backend utility fix with focused regression coverage only. - [x] **Dependencies:** No new or upgraded dependencies were added. - [x] **Testing:** I manually ran the targeted validation steps listed below for this backend fix. - [ ] **Agentic AI Code:** This PR was agent-assisted; leaving this unchecked for maintainers to evaluate alongside the recorded manual validation notes. - [x] **Code review:** I performed a focused self-review of the touched utility and regression-test surfaces. - [x] **Design & Architecture:** This keeps the fix local to the schema-conversion path and avoids new settings or wider behavior changes. - [x] **Git Hygiene:** This branch was rebased onto `dev` and keeps the change atomic. - [x] **Title Prefix:** The PR title uses the `fix:` prefix. # Changelog Entry ### Description - Guard circular OpenAPI request-schema expansion in tool-server conversion and keep one failing server from taking down the entire `/api/v1/tools` response. ### Added - Focused regression coverage for circular request-body `$ref` handling and per-server conversion isolation. ### Changed - Tool-server schema resolution now short-circuits repeated `$ref` expansion instead of recursing indefinitely. ### Deprecated - None. ### Removed - None. ### Fixed - Fixes #23543 by preventing recursive request schemas from causing `RecursionError` during tool-server OpenAPI conversion. - Prevents a single bad tool-server spec from aborting the whole tool-server list conversion pass. ### Security - Improves availability and fault isolation for externally supplied tool-server OpenAPI specs by bounding recursive schema expansion. ### Breaking Changes - **BREAKING CHANGE**: None. --- ### Additional Information - Touched files: - `backend/open_webui/utils/tools.py` - `backend/open_webui/test/util/test_tools.py` - Validation performed: - `python -m py_compile backend/open_webui/utils/tools.py backend/open_webui/test/util/test_tools.py` - Targeted source-level smoke to confirm circular request schemas are bounded and that one failed tool-server conversion no longer prevents healthy servers from being listed - No new settings, dependencies, or user-facing UI changes. ### Screenshots or Videos - Not applicable for this backend utility fix. ### Contributor License Agreement <!-- 🚨 DO NOT DELETE THE TEXT BELOW 🚨 Keep the "Contributor License Agreement" confirmation text intact. Deleting it will trigger the CLA-Bot to INVALIDATE your PR. Your PR will NOT be reviewed or merged until you check the box below confirming that you have read and agree to the terms of the CLA. --> - [x] By submitting this pull request, I confirm that I have read and fully agree to the [Contributor License Agreement (CLA)](https://github.com/open-webui/open-webui/blob/main/CONTRIBUTOR_LICENSE_AGREEMENT), and I am providing my contributions under its terms. > [!NOTE] > Deleting the CLA section will lead to immediate closure of your PR and it will not be merged in. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-20 06:58:08 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#27268