mirror of
https://github.com/open-webui/open-webui.git
synced 2026-09-28 01:31:28 +00:00
Address PR review findings 1 & 2 on the detection heuristic:
The previous gate relied solely on `inspect.getsource()` matching
the substring `self._connection.stop`. Two failure modes:
1. Source-unavailable builds — zipped distributions, pyc-only
installs, frozen runtimes — return OSError from
`inspect.getsource`, so the gate silently skipped patching and
the multi-page `terminate_force_close() not implemented`
tracebacks reappeared. Hard-to-diagnose because startup looks
successful.
2. Brittle text matching — minor upstream formatting changes to
the same buggy logic could bypass the substring check.
Factor the detection into `_looks_buggy(original)` with two signals
in order of preference:
* Source text inspection (precise, obvious).
* Bytecode `co_names` inspection — works on every CPython build
exposing `__code__`. Any function that does
`self._connection.stop` puts both `_connection` and `stop`
into `co_names`, regardless of whitespace or refactoring.
If neither inspection succeeds, patch defensively: the user
explicitly reported the noisy ERROR behaviour, so a
possibly-redundant shim beats silently restoring it.
Per user direction the third reviewer suggestion (regression test
coverage) is not added in this PR.
https://claude.ai/code/session_01JSr4NZSskEUQvoJnavVXh8
|
||
|---|---|---|
| .. | ||
| data | ||
| open_webui | ||
| .dockerignore | ||
| .gitignore | ||
| dev.sh | ||
| requirements-min.txt | ||
| requirements.txt | ||
| start.sh | ||
| start_windows.bat | ||