Skip to content

fix: sync and index MDX documentation in knowledge bases - #2556

Merged
pancacake merged 1 commit into
HKUDS:devfrom
markjoin123:cursor/fix-mdx-github-source-85d8
Nov 15, 2026
Merged

pancacake merged 1 commit into
HKUDS:devfrom
markjoin123:cursor/fix-mdx-github-source-85d8

Conversation

@markjoin123

Copy link
Copy Markdown
Contributor

Summary

Fixes #2552

Adding a GitHub documentation source whose glob is *.mdx finished with last_sync_status: success and files_synced: 0. Nothing was written under the knowledge base raw/ directory, so Re-index failed with ValueError: KB '...' has no source files in raw/ to reindex.

The sync filter only kept .md and .markdown, so every .mdx path was dropped before download. Re-index also ignores files whose extension is not in FileTypeRouter, so an .mdx file placed in raw/ directly was skipped as well.

.mdx is now treated as text next to Markdown:

  • GitHub source sync downloads it when the configured glob matches.
  • Knowledge-base discovery, upload, and indexing accept it and read it as text. JSX component tags stay in the body.
  • The chat attachment list that mirrors the text-extension set accepts it too.

The default GitHub glob stays *.md, so existing sources do not start pulling .mdx files. PageIndex's extension list is unchanged, because it mirrors the formats that provider's document API accepts.

This change was AI-assisted and was reviewed and tested.

Test plan

  • python3 -m pytest tests/services/test_github_source_mdx.py tests/services/rag/test_file_routing.py tests/utils/test_document_extractor.py::TestIsDocumentExtension (54 passed). The new test syncs docs/ with glob *.mdx, writes the file under raw/, and checks that an .mdx-only raw directory is eligible for re-index.
  • Related GitHub-source, document-extractor, and document-validator tests: 75 passed, 1 skipped.
  • python3 -m ruff check and python3 -m ruff format --check on the changed Python files.
  • python3 -m pre_commit run --files on the changed files (hygiene, ruff, prettier, bandit, mypy).
  • web/tests/doc-attachments.test.ts (15 passed), including .mdx classification.

GitHub source sync kept only .md and .markdown, so a docs glob of *.mdx
reported success with zero files and left raw/ empty. Re-index then failed
because no supported source files were present. Treat .mdx as text next to
Markdown in the sync filter, the knowledge-base file router, and the chat
attachment list that mirrors it.

Fixes HKUDS#2552
@pancacake
pancacake merged commit 21e9878 into HKUDS:dev Nov 15, 2026
23 checks passed
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.

2 participants