Repository navigation
fix(readiness): fail closed when the MinerU model cache root is unreadable - #2161
Open
alphaliujin wants to merge 1 commit into
Open
alphaliujin wants to merge 1 commit into
alphaliujin wants to merge 1 commit into
Conversation
The container backend runs as the unprivileged deeptutor user while supervisor leaves HOME pointing at root's home. mineru_models_ready() probed <HOME>/.cache/modelscope/hub/models outside its try/except, so the PermissionError propagated into build_settings_readiness(), which maps any exception to parser_probe_failed and shows no cause in the UI. - mineru_models_ready(): treat an unreadable/absent cache root as "cannot confirm" and return False (models_missing) instead of raising. - build_settings_readiness(): log the parser probe exception with a traceback before recording parser_probe_failed. - Dockerfile: create /home/deeptutor and set HOME for the backend and frontend supervisor programs, so profile data resolves under the service user. - Add a regression test for the unreadable-cache-root case.
13 tasks done
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On container deployments the backend runs as the unprivileged
deeptutoruser (supervisoruser=deeptutor), butHOMEis inherited from supervisord, which runs as root.mineru_models_ready()therefore probes/root/.cache/modelscope/hub/models, and calls.is_dir()outside itstry/except:build_settings_readiness()catches every exception and records the row asparser_probe_failed, so Settings → Document Parsing shows MinerU as misconfigured with no actionable cause — while MinerU parsing itself works.Changes
mineru_models_ready(): resolve the cache roots inside the guarded block and treat an unreadable/absent home as “cannot confirm”, returningFalse(models_missing). This matches the function's documented fail-closed contract instead of letting aPermissionErrorescape.build_settings_readiness(): log the probe exception with a traceback before recordingparser_probe_failed, so future probe failures are diagnosable./home/deeptutorand setHOME="/home/deeptutor"for both supervisor programs. This is the root cause; the other two changes keep the failure mode safe for existing images and non-container installs.False) and a readable cache (returnsTrue).Verification
HOME=/root, the probe raisedPermissionErrorand the API reportedparser.mineru misconfigured / parser_probe_failed.False, and a populated cache still returnsTrue(manual test in the 1.7.0 container, all other dependencies identical).HOME=/home/deeptutorreportsmineru_models_ready() == True, andparser.minerureadiness isenabled_verified.