Skip to content

fix: variable shadowing in middleware#22145

Closed
EntropyYue wants to merge 1 commit intoopen-webui:devfrom
EventHorizon-AI:fix/var-shadowing
Closed

fix: variable shadowing in middleware#22145
EntropyYue wants to merge 1 commit intoopen-webui:devfrom
EventHorizon-AI:fix/var-shadowing

Conversation

@EntropyYue
Copy link
Contributor

Changelog Entry

Description

  • There is a variable shadowing issue: since a variable with the same name already exists in the function's input, the reasoning block incorrectly sets done to true at the beginning.

Fixed

  • Fixed variable shadowing in middleware

Contributor License Agreement

By submitting this pull request, I confirm that I have read and fully agree to the Contributor License Agreement (CLA), 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.

@pr-validator-bot
Copy link

👋 Welcome and Thank You for Contributing!

We appreciate you taking the time to submit a pull request to Open WebUI!

⚠️ Important: Testing Requirements

We've recently seen an increase in PRs that have significant issues:

  • PRs that don't actually fix the bug they claim to fix
  • PRs that don't implement the feature they describe
  • PRs that break existing functionality
  • PRs that are clearly AI-generated without proper testing being done by the author
  • PRs that simply don't work as intended

These untested PRs consume significant time from maintainers and volunteer contributors who review and test PRs in their free time.
Time that could be spent testing other PRs or improving Open WebUI in other ways.

Before marking your PR as "Ready for Review":

Please explicitly confirm:

  1. ✅ You have personally tested ALL changes in this PR
  2. How you tested it (specific steps you took to verify it works)
  3. Visual evidence where applicable (screenshots or videos showing the feature/fix working) - if applicable to your specific PR

If you're not certain your PR works exactly as intended, please leave it in DRAFT mode until you've thoroughly tested it.

Thank you for helping us maintain quality and respecting the time of our community! 🙏

@pr-validator-bot
Copy link

⚠️ Warning: Possible Non-Atomic / Scope Creep PR Detected

Your PR was subjected to automated review by AI to determine if it could fall under Open WebUI's non-atomicity ruleset or scope creep.

This PR appears to contain multiple unrelated changes that could be split into separate pull requests.

🔍 AI Analysis Summary

Primary Intent: Variable renaming to fix potential shadowing in serialize_output function

Secondary Changes Detected:

  • None identified
📝 Detailed Analysis and Full Report (click to expand)

This PR makes a pure variable renaming refactor: changing loop variable 'output' to 'out' to avoid shadowing the outer 'output' parameter. While this is a single file change, it qualifies as a 'Pre-factor' refactoring that could have been merged independently. The change has no dependency on any feature work and could have been submitted as a standalone code cleanup PR. Since can_be_split is true (this refactor could exist as its own PR), the PR is NOT atomic according to the strict enforcement rules, even though no feature is being bundled.

Why Atomic PRs With Narrow Scopes Matter

Atomic PRs (single-purpose PRs) are:

  • Easier to review - Reviewers can focus on one thing at a time
  • Easier to test - Each change can be verified independently
  • Easier to revert - If something breaks, we can revert just the problematic change
  • Faster to merge - Smaller, focused PRs get reviewed and merged quicker

What Makes a PR Atomic / Narrow in Scope?

An atomic PR should contain one semantic change:

  • ✅ Just one bug fix (even if it touches multiple files)
  • ✅ Just one feature (even if it requires changes across multiple files)
  • ✅ Just i18n/translation updates
  • ✅ Just documentation updates
  • ✅ Just refactoring of one specific thing
  • ✅ Just one performance improvement

What To Do

This is an automated analysis. If you believe this assessment is incorrect and your PR is actually atomic (all changes serve one unified purpose), please explain in a comment below.

Consider splitting this PR into separate, focused pull requests. Each PR should address one specific thing.

For example, if you have a bug fix and a new feature, submit them as two separate PRs.

@tjbck
Copy link
Contributor

tjbck commented Mar 2, 2026

64957db

@tjbck tjbck closed this Mar 2, 2026
@EntropyYue EntropyYue deleted the fix/var-shadowing branch March 3, 2026 08:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants