Repository navigation
🔌 feat: Require Isolated PDF and DOCX Extraction - #338
lia-by-librechat[bot] wants to merge 7 commits into
Conversation
|
Head for review: Opt-in Unix-socket extraction now serves selected PDF/DOCX through Checks: 254 focused socket/route/regression tests passed; real Python client → hardened processor PDF/DOCX test passed on this head; touched-file Black, compilation and diff checks passed. Local runtime is Python 3.12.3; processor/client qualification uses the shipped Python 3.13 image. CI is running. Existing dependency blocker: |
|
Head for fresh review: Follow-up combines the disconnect audit and binary-fixture fix:
Verification: 270 focused pytest tests passed; real Python client → hardened processor PDF/DOCX qualification passed; touched-file Black, Python compilation, |
|
Head: Independent exact-head review complete: no findings. Reviewer read the full diff and checked protocol, route/identity/page mapping, disconnect handling, rollback and cleanup in source. It did not rerun application/native-container tests. Local verification: 270 focused tests, including 8 realistic ASGI disconnect and 8 completion-race cases, plus real Python client → hardened PDF/DOCX processor qualification passed. Black, compilation, pip check and full base-to-head diff checks passed. CI Parent-audit findings fixed in this head: actual disconnect cancellation and binary fixture attributes. No rejected or outstanding findings. Whole suites/database integration were not run locally; processor qualification remains opt-in. Extraction is disabled by default. No service enabled or deployment performed. |
|
Head for fresh independent review: The two-file follow-up extends selected PDF/DOCX request ownership through caller preparation/storage/cleanup. Before: six real ASGI post-extraction disconnect cases across all three embedding routes still committed both new PDF chunks and returned success. After: preparation drains without mutation; batched AsyncPg drains started inserts then rolls back only its attempt, preserving older rows. Cleanup drains before return. Commit boundary is explicit: single-shot async or already-started sync storage finishes/drains and may retain committed data. Known-disconnected callers receive no success. Sync partial failure can retain committed rows; no unsafe file-wide undo. Disabled/unselected behavior is unchanged. Checks: 311 focused pytest tests passed on the unchanged patch; final Black, compilation, |
|
Head for fresh independent review: R4 (P2) fixed. Before: six real ASGI/frozen-wrapper/busy-executor cases returned 499 after cancelling queued attempt rollback, retaining the new rows and removing the upload. A live Python breakpoint confirmed the operation was already awaiting rollback when the wrapper cancelled it. After: selected cleanup becomes monotonic before producer shutdown, in-flight insert drain and rollback. Task-owned cleanup and worker/join/unlink drains defer repeated cancellation until completion. Added 22 controlled cases cover completed-batch/queued-rollback races, pending inserts, preparation and unlink; older rows survive and no caller return/upload removal occurs before required drain. Conservative single-shot/sync commit semantics and disabled/unselected behavior remain unchanged. Checks: 333 focused tests passed; final Black, compilation, Finding ledger:
|
|
Head: Independent exact-head review complete: no findings. Reviewer read the full diff and rechecked R1–R4. Isolated final-batch/queued-rollback and repeated-cancellation drain reproductions passed. It did not run pytest, real ASGI/AnyIO, the processor container or database integration. CI
No rejected or outstanding findings. Selected pre-storage cancellation prevents mutations; batched AsyncPg drains inserts before current-attempt rollback. Started single-shot/sync writes may remain committed, but known-disconnected callers receive no success. No unsafe file-wide undo. Disabled by default. No merge, enablement or deployment performed. |
|
Maintainer direction changed: migrated PDF/DOCX parsing must always use the isolated extraction service by default. Revision in progress: remove the enablement/format-subset opt-outs that leave local migrated parsers active; add the hardened processor and read-only caller socket wiring to standard Compose recipes. The current head and its clean review/CI cover the prior opt-in design. The new default will receive focused verification and a fresh exact-head review. Other formats remain a separate migration; no whole-parser-isolation claim or deployment performed. |
|
Head for fresh independent review: PDF/DOCX processing is now required, not opt-in. Enable/format-subset settings and the local PDF implementation are removed. Obsolete environment keys are rejected. All four routes use the service and full request lifecycle; absent socket fails closed without affecting plaintext. Other formats remain explicitly unmigrated. Both normal RAG Compose recipes include one shared hardened processor definition pinned to Code Interpreter Checks: 384 focused tests passed; 6 existing Pandoc-dependent cases skipped. Fresh current-head real client/default-Compose processor PDF/DOCX qualification passed, including engine security limits and nonroot/read-only socket access. Black, compilation, R1–R4 regression protections and PDF page/raw-text semantics are preserved. Conservative single-shot/started-sync writes may remain committed after disconnect; sync partial failures can retain rows rather than delete other attempts. Prior review/CI covered the old opt-in head, not this head. Parent coordinates fresh review. |
|
Head for fresh review: Fixes the known CI failure on Render failures now expose sanitized stderr rather than opaque CalledProcessError or captured model stdout. Added reverse-order and diagnostic regressions. Audited legacy upload tests: valid requests are plaintext; PDF filenames elsewhere exercise path validation. Required PDF/DOCX service behavior and R1–R4 protections are unchanged. Checks: 386 focused tests passed; 6 existing Pandoc-dependent cases skipped. Current-head actual default-Compose processor/client PDF/DOCX qualification passed, including engine security/resource settings and read-only socket access. Black, compilation, |
|
Head: Independent exact-head review complete: no findings. Reviewer read the full required-default diff, R1–R6, affected callers and pinned processor contract. Both normal recipes and both merge orders rendered correctly on Compose 5.6.0. Reviewer did not rerun Python runtime tests, Compose 2.38.2, the processor container or database integration. CI PDF/DOCX isolation is REQUIRED with omitted configuration. There is no enablement or format-subset opt-out, local PDF implementation, or synchronous migrated-loader bypass. Missing processor returns Prior findings R1–R4 remain fixed; requirement correction R5 removes the opt-in design; R6 fixes Compose 2.38.2 duplicate-security-option merging with atomic processor override. None rejected or outstanding. Earlier opt-in reviews do not cover this design; interrupted 434382d review is not counted as clean. Conservative started single-shot/sync storage may remain committed after disconnect, but known-disconnected callers receive no success. No unsafe file-wide undo. No merge or deployment performed. |
|
Head for fresh independent review: Required PDF/DOCX extraction now uses service-token-authenticated bounded HTTP, with verified HTTPS required remotely. Service authentication remains separate from caller authentication: failures return safe Local checks before publication: 505 focused tests passed, 6 existing Pandoc cases skipped; final-pinned real default-worker/client qualification passed provisioning/auth/PDF/DOCX/upload cancellation/two replicas/restart and the shipped gateway. Black, compilation, pip check and full diff checks passed. Publication-time exact-head reruns passed: 505 focused tests, 6 skips, and 1 real worker integration. All 5 Compose contract checks also passed with checksum-verified Compose 2.38.2; the standard run used 5.6.0. Qualification containers, volumes, networks and the temporary compatibility tool were removed. Exact-head CI R1–R6 remain fixed; their ledger is retained in the PR body. Existing conservative started-write/partial-sync limitations remain. Shared-host kernel risk remains; a separate credential-free VM with verified TLS is supported. Authenticated caller images and worker must be coordinated, not rolled out independently. No merge or deployment performed. Parent owns this exact-head consumer review; prior-head reviews are not claimed to cover it. |
|
Head |
|
@codex review the latest head, final review |
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. |
Summary
/text,/embed,/embed-uploadand/local/embed. No enable/format opt-out or local migrated-parser fallback. Caller policy, identity, zero-based PDF pages, chunking and storage remain RAG-owned.503 UNAVAILABLE, never end-user authentication failures. No reflected remote messages, URLs or credentials; no proxy, redirect, retry or insecure-TLS fallback.Default Deployment
Both normal Compose recipes share a processor build pinned to Code Interpreter
c7bfe421243c66d4d5d9c6e3d08d276586ac47bf. Nonrootextraction-inituses that build to atomically provision a persistent 64-lowercase-hex token: directory0755, file0444, no newline. Its healthcheck is disabled. The worker and callers mount credentials read-only; only init has a writable mount.The worker inherits the shipped native gateway ENTRYPOINT and gateway-protected authenticated healthcheck. It uses a private
internal: truenetwork, no host port or singleton container name, default Docker seccomp, nonroot/read-only execution, dropped capabilities and fixed CPU/memory/PID/tmpfs bounds. No app credentials, uploads, database configuration or storage mounts are supplied. Callers retain their default network plus the private extraction network. Atomic!overridecovers both shared services and both recipe merge orders. Replicas share credentials without singleton socket ownership.Configuration:
RAG_EXTRACTION_URL: defaults tohttp://extraction:8000. Remote endpoints require verified HTTPS using standard trust. Plain HTTP is restricted to that Compose endpoint and loopback. Origin only: no userinfo, query, fragment or non-root path.RAG_EXTRACTION_TOKEN_FILE: defaults to/run/extraction/token; bounded, nonblocking regular-file read, exactly 64 lowercase hex bytes. Read once per job, so client rotation takes effect on the next job; coordinate service-side rotation.RAG_EXTRACTION_DEADLINE_SECONDS: positive, at most 10. ObsoleteRAG_EXTRACTION_SOCKET,RAG_EXTRACTION_ENABLEDandRAG_EXTRACTION_FORMATSare rejected.Boundaries
PDF_EXTRACT_IMAGES=truerejects PDFs. DOCX supports body content, not full Docx2txt parity. Other formats remain unmigrated. Plaintext/raw-text policy is unchanged.Verification
pip checkand full base-to-head whitespace checks passed. Dependency files unchanged. Exact-head CIbuild-and-testpassed, including unit and integration steps: https://github.com/LibreChat-AI/rag-api/actions/runs/39962758266. Parent owns consumer review; no prior-head review is claimed for this head.Retained Finding Ledger
d155c6807d155c6807; bytes unchanged0c19824b3c9d5bc8a5434382d0e1eb1ccc17; atomic overrides retained for init and workerNo rejected or outstanding prior findings. Earlier clean reviews do not cover this HTTP head; parent coordinates its exact-head review.