Skip to content

fix(knowledge): report connected WeKnora and MarginNote 4 KBs as remote, not missing - #3274

Open
XAE-A-Xii wants to merge 1 commit into
HKUDS:devfrom
XAE-A-Xii:fix/kb-manifest-remote-types
Open

XAE-A-Xii wants to merge 1 commit into
HKUDS:devfrom
XAE-A-Xii:fix/kb-manifest-remote-types

Conversation

@XAE-A-Xii

Copy link
Copy Markdown

Description

Connected WeKnora and MarginNote 4 knowledge bases were reported as a missing folder. _NON_DOCUMENT_KB_TYPES (deeptutor/knowledge/manifest.py) lists lightrag_server, ima and kiwix but not weknora or marginnote4, although kb_types.py documents both as having no local documents ("No path on disk" for MarginNote 4; WeKnora "owns both indexing and document management"). Their manifest therefore fell through to kb_dir/raw, which never exists:

>>> build_manifest(name="kb", kb_dir=tmp, entry={"type": "weknora"}).unavailable
'missing'        # 'remote' for kiwix / lightrag_server / ima

The system-prompt manifest and kb_files then tell the model: "Its document folder cannot be read right now — it may still be under construction, or be an external folder that has moved". That's wrong for a KB hosted elsewhere, and it invites the model to tell the user something is broken.

Both types now map to UNAVAILABLE_REMOTE ("Hosted on a remote server; its document list cannot be read."), like the other connected types.

For MarginNote 4, the library is synced from the user's MarginNote app and browsed through the MarginNote capability's own tools, so "remote" is the closest existing code, while agent ("A connected agent") would be wrong. If you'd prefer a dedicated code for it, I'm happy to add one.

Related Issues

  • None filed; this is a small, self-contained fix.

Module(s) Affected

  • agents
  • api
  • config
  • core
  • knowledge
  • logging
  • services
  • tools
  • utils
  • web (Frontend)
  • docs (Documentation)
  • scripts
  • tests
  • Other: ...

Checklist

  • This PR targets dev (not main — see the base-branch selector above).
  • I have read and followed the contribution guidelines.
  • My code follows the project's coding standards.
  • I have run pre-commit run --all-files and fixed any issues.
  • I have added relevant tests for my changes.
  • I have updated the documentation (if necessary). (Not needed.)
  • My changes do not introduce any new security vulnerabilities.

Additional Notes

tests/knowledge/test_manifest.py adds test_connected_kb_without_local_documents_is_remote_not_missing, parametrized over every connected type without local documents: lightrag_server, ima, kiwix, weknora and marginnote4. It asserts unavailable == "remote" and document_root(...) is None.

Before the fix: 2 failed (weknora, marginnote4), 3 passed. After:

$ python -m pytest tests/knowledge tests/tools/test_kb_files_tool.py tests/api/test_marginnote4_router.py tests/capabilities/marginnote4 -q --ignore=tests/knowledge/test_linked_folder_sync.py
1 failed, 306 passed

The one failure (test_indexing_run.py::test_readiness_is_local_and_cancel_requires_writable_owned_task) and the collection errors in tests/knowledge/test_linked_folder_sync.py and tests/api/test_knowledge_router.py all need data/user/settings/main.yaml, which only exists in a configured install. They fail the same way on dev without this change.

The only other document_root caller, multi_user/knowledge_access.py:433, already returns None when the root is missing or not a directory, so its behavior for these types is unchanged.

pre-commit run --files on both changed files passes every hook. --all-files fails mypy on dev itself in deeptutor/services/embedding/adapters/volcengine.py, from #1015, which this PR doesn't touch.

🤖 Generated with Claude Code

@github-actions github-actions Bot added backend Python runtime, capabilities, tools, API & CLI bug Something isn't working labels Dec 5, 2026
…te, not missing

`_NON_DOCUMENT_KB_TYPES` listed lightrag_server, ima and kiwix but not
weknora or marginnote4, although kb_types documents both as having no
path on disk. Their manifest therefore fell through to `kb_dir/raw`,
which never exists, and was reported as UNAVAILABLE_MISSING: the
system-prompt manifest and kb_files told the model the KB "may still
be under construction, or be an external folder that has moved"
instead of that it is hosted elsewhere.

Both types now map to UNAVAILABLE_REMOTE, like the other connected
types. A parametrized test covers every connected type without local
documents.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@XAE-A-Xii
XAE-A-Xii force-pushed the fix/kb-manifest-remote-types branch from 0e1fa1f to bbe7e2c Compare December 5, 2026 12:15

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Python runtime, capabilities, tools, API & CLI bug Something isn't working

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant