Skip to content

fix(platform): gate RAG queueing on a shared indexability allowlist - #1853

Merged
yannickmonney merged 2 commits into
mainfrom
fix/rag-indexability-allowlist
Jun 11, 2026
Merged

yannickmonney merged 2 commits into
mainfrom
fix/rag-indexability-allowlist

Conversation

@yannickmonney

Copy link
Copy Markdown
Contributor

What / why

Closes #1522.

Genuine .docx/.xlsx are supported end-to-end by the RAG indexer. The deterministic bug behind the "Index failed" reports is an allowlist gap: the platform accepts formats the RAG service rejects (legacy Office .doc/.xls/.ppt plus misc text extensions), force-queues them for indexing, and RAG's HTTP 400 lands as a permanent Index failed badge — which users read as broken Word/Excel support. (The original .docx/.xlsx reports most likely date to the embedding-credentials bug already fixed in #1476.)

Changes

  • Shared indexability allowlist. RAG_INDEXABLE_EXTENSIONS + isRagIndexableFile() in lib/shared/file-types.ts mirror RAG's SUPPORTED_EXTENSIONS. Both saveFileMetadata variants (chat upload + connectors/documents) only queue RAG indexing when the format is indexable; non-indexable files keep ragStatus undefined (the existing audio pattern), show no badge in the composer, show Not indexed in the Document Hub, and stay fully usable inline in chat (.xls is parsed by the platform-side Excel parser, text files are inlined).
  • RAG-side drift closed. SUPPORTED_EXTENSIONS in app/routers/documents.py is now derived from the extraction router's ALL_SUPPORTED_EXTENSIONS minus an explicit SENSITIVE_EXTENSIONS (.env, .log) exclusion — fixing the .tif drift (extractor-supported, route-rejected) while preserving the deliberate secret-bearing-format posture that test_document_helpers.py / test_secret_scanner.py enforce.
  • Two-way parity is test-enforced. test_extension_sync.py now imports the live Python set (instead of regex-on-source) and adds a reverse-parity test asserting RAG_INDEXABLE_EXTENSIONS equals RAG's set exactly, so the lists can never drift again.
  • Error fidelity. uploadFileToRag stores the upstream response detail (UpstreamHttpError.bodySnippet, already truncated + secret-scrubbed) in ragError instead of an unactionable "returned HTTP 400."; RAG's _sanitize_error falls back to the exception class name when str(exc) is empty so failures never surface as "Unknown error".
  • Error surfaced in chat. The Index failed badge in both chat composers now carries the stored ragError as a tooltip (title), matching the Document Hub which already shows the reason.
  • Stale-state cleanup. Re-uploading a non-indexable file clears ragStatus: 'failed'/ragError left by the pre-allowlist era, so stuck badges self-heal.
  • Docs. Corrected the supported-formats list on platform/knowledge/documents.md (en/de/fr) to match the pipeline (removed never-supported .odt/.rtf/.ods/.odp) and documented the new not-indexed behavior for out-of-list formats.

Decision-gate recommendations baked in

  • No badge for non-indexable attachments (plan-recommended): the composer falls through to the plain file-size row, exactly like audio uploads; the Hub shows Not indexed.
  • Sensitive text formats (.env, .log) deliberately stay unindexed — encoded as SENSITIVE_EXTENSIONS rather than silently re-enabled by the derivation.
  • Legacy Office formats stay inline-only (no .doc/.xls/.ppt conversion added to RAG); adding real legacy-Office support remains a possible follow-up issue.

Coordination

#1498's agent is migrating the xlsx dependency to the SheetJS CDN tarball in parallel; this PR deliberately does not touch the xlsx dependency or the platform-side Excel parse path beyond the queue gating.

Verification

Performed:

  • bun run check at the repo root — all 40 turbo tasks green (format, lint, typecheck, 71 921 platform tests incl. the new isRagIndexableFile / queue-gating cases).
  • cd services/rag && uv run pytest — 320 passed (incl. new reverse-parity, _sanitize_error fallback, and the updated secret-posture tests asserting on the imported set).
  • bun run --filter @tale/docs lint and bun run --filter @tale/docs test — green.

Manual verification required (needs a running stack / the reporter's deployment):

  • Upload .docx/.xlsx in chat → "Indexed"; upload .doc/.xls → no badge, spreadsheet content still usable in chat; stop the rag container and upload a .docx → badge appears with the failure reason visible on hover.
  • Reporter's environment: SELECT filename, status, error FROM private_knowledge.documents WHERE status='failed' ORDER BY updated_at DESC LIMIT 5; to confirm no residual .docx/.xlsx failure exists post-fix(rag): use correct provider credentials and support local dev config sync #1476 (if errors show embedding-auth, it is a deployment/provider-config issue, not code).

Known limitation (follow-up candidate): the Document Hub Index retry button on a non-indexable file will still 400 → failed; with the improved ragError the dialog now shows the real reason. retryRagIndexing could early-return using the same helper.

Pre-PR checklist

  • Ran bun run check (format, lint, typecheck, all tests).
  • No hand-rolled skeletons or magic h-[…] on skeletons — N/A (no loading states touched).
  • Updated services/platform/messages/{en,de,fr}.json — N/A (no new keys; tooltip shows the raw stored error, existing indexingFailed label reused).
  • Updated /docs/{en,de,fr}/ for every user-visible change.
  • Every touched docs page has a real opening and closing (pre-existing page; openings/closings unchanged and passing the docs tests).
  • Ran bun run --filter @tale/docs lint and bun run --filter @tale/docs test.
  • Updated README.md, README.de.md, README.fr.md — N/A.

Chat and connector uploads queued every non-audio file for RAG indexing,
including formats the RAG service deterministically rejects with HTTP 400
(legacy Office .doc/.xls/.ppt, misc text extensions) — surfacing as a
permanent "Index failed" badge that users read as broken DOCX/XLSX
support. Non-indexable formats now skip the queue entirely (the audio
pattern: ragStatus stays undefined) and remain usable inline in chat.

- add RAG_INDEXABLE_EXTENSIONS + isRagIndexableFile to lib/shared/file-types
  as the platform-side mirror of RAG's allowlist
- derive RAG's SUPPORTED_EXTENSIONS from the extraction router's capability
  set minus an explicit SENSITIVE_EXTENSIONS (.env/.log) exclusion, fixing
  the .tif drift while preserving the secret-bearing-format posture
- enforce two-way parity in test_extension_sync.py (new reverse-parity test)
- store the RAG response detail (UpstreamHttpError.bodySnippet, already
  secret-scrubbed) in ragError instead of a bare "returned HTTP 400."
- fall back to the exception class name in _sanitize_error so failures
  never land as an empty error string
- surface ragError as a tooltip on the chat "Index failed" badge
- clear stale failed RAG state when a non-indexable file is re-uploaded
- update the Documents docs format list (en/de/fr) to match the pipeline
@coderabbitai

coderabbitai Bot commented Jun 10, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@yannickmonney, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 44 minutes and 46 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more credits in the billing tab to continue.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 4f807ae2-4163-406c-987c-2d4d066e7f8b

📥 Commits

Reviewing files that changed from the base of the PR and between 5d6a2c3 and b795576.

📒 Files selected for processing (16)
  • docs/de/platform/knowledge/documents.md
  • docs/en/platform/knowledge/documents.md
  • docs/fr/platform/knowledge/documents.md
  • services/platform/app/features/automations/components/automation-assistant/chat-input.tsx
  • services/platform/app/features/chat/components/chat-input.tsx
  • services/platform/convex/file_metadata/internal_actions.ts
  • services/platform/convex/file_metadata/internal_mutations.test.ts
  • services/platform/convex/file_metadata/internal_mutations.ts
  • services/platform/convex/file_metadata/mutations.test.ts
  • services/platform/convex/file_metadata/mutations.ts
  • services/platform/lib/shared/file-types.test.ts
  • services/platform/lib/shared/file-types.ts
  • services/rag/app/routers/documents.py
  • services/rag/tests/test_background_ingest.py
  • services/rag/tests/test_extension_sync.py
  • services/rag/tests/test_secret_scanner.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/rag-indexability-allowlist

Warning

Billing warning: we have not been able to collect payment for this subscription for more than 72 hours. Please update the payment method or pay any pending invoices in Billing to avoid service interruption.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@yannickmonney
yannickmonney merged commit f4dc298 into main Jun 11, 2026
49 of 50 checks passed
@yannickmonney
yannickmonney deleted the fix/rag-indexability-allowlist branch June 11, 2026 08:09
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.

Bug: File Upload Shows “Index Failed” for Supported Formats (DOCX, XLSX)

1 participant