Repository navigation
fix(pdf): keep a managed MinerU's error body out of client responses - #2087
Merged
Merged
Conversation
Since the too-many-pages change, a server-managed self-hosted MinerU's failed response had its message (up to 300 characters) quoted into the thrown error. That message is returned by /api/parse-pdf and stored as the extraction failure, so a deployment's own MinerU could show its paths or configuration details to the browser. Every non-refusal failure is now reported by status only, whoever configured the service; the bounded body stays in the server log. The too_many_pages refusal is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
14 of 17 tasks
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.
Follow-up to #2085.
Summary
#2085 kept up to 300 characters of a failed MinerU response body in the thrown error when the deployment itself configured the MinerU URL.
/api/parse-pdfreturnserror.messagein itsPARSE_FAILEDresponse, and the classic extraction failure lines reuse the same message, so a self-hosted service's internal details (paths, configuration hints, diagnostics) could reach the browser. Before #2085 clients only sawMinerU API error (status); the existing "does not echo an error body" test only covered a caller-supplied URL.Changes
lib/pdf/pdf-providers.ts: the thrown error no longer quotes the body for any MinerU (managed or not); a non-refusal failure readsMinerU API error (status)(or the existing missing-dependency text). The body still reaches the server log through the existingfile_parse failed [status=…]line (≤500 chars). Thetoo_many_pagesrefusal is unchanged.quoteMessage/ themanagedoption and the 300-character constant; callers updated.Verification
tests/api/parse-pdf-self-hosted-mineru.test.ts: a managed MinerU answering 500 with a body naming an internal path → the response is exactlyMinerU API error (500)and the logger receives the body.tests/agent-runtime/material-extraction.test.ts: the stored failure message containsMinerU API error (500)and not the path.tests/api,tests/document,tests/server/material*,tests/agent-runtime/material*, owner-extraction: 666 passed;tsc --noEmit, ESLint and Prettier clean.🤖 Generated with Claude Code