Skip to content

fix(pdf): keep a managed MinerU's error body out of client responses - #2087

Merged
wyuc merged 1 commit into
mainfrom
fix/mineru-error-body-server-only
Oct 29, 2026
Merged

wyuc merged 1 commit into
mainfrom
fix/mineru-error-body-server-only

Conversation

@wyuc

@wyuc wyuc commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

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-pdf returns error.message in its PARSE_FAILED response, 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 saw MinerU 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 reads MinerU API error (status) (or the existing missing-dependency text). The body still reaches the server log through the existing file_parse failed [status=…] line (≤500 chars). The too_many_pages refusal is unchanged.
  • Removed quoteMessage / the managed option and the 300-character constant; callers updated.
  • CHANGELOG: corrected the unreleased fix(materials): explain a PDF refused for too many pages instead of a bare 422 #2085 entry instead of adding a contradicting line.

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 exactly MinerU API error (500) and the logger receives the body.
  • tests/agent-runtime/material-extraction.test.ts: the stored failure message contains MinerU API error (500) and not the path.
  • Reverting the provider to its fix(materials): explain a PDF refused for too many pages instead of a bare 422 #2085 version, forcing quoting, or removing the log line each fails a test.
  • 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

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>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-29T06:43:42.559140Z 2c5703d PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@wyuc
wyuc merged commit ed564ec into main Oct 29, 2026
14 checks passed
@wyuc
wyuc deleted the fix/mineru-error-body-server-only branch October 29, 2026 09:52
@wyuc wyuc mentioned this pull request Oct 29, 2026
14 of 17 tasks
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.

1 participant