[GH-ISSUE #24] Directory structure flattens into KB _root despite OWUI 0.9.6 supporting nested directories #16

Open
opened 2026-10-18 21:13:31 +00:00 by bsakaguchi · 1 comment
Owner

Originally created by @dvystrcil on GitHub (Jun 4, 2026).
Original GitHub issue: https://github.com/open-webui/oikb/issues/24

Summary

When syncing a GitHub source whose tree has subdirectories (e.g. wiki/homelab/, wiki/one-ring/, wiki/fiction/), oikb uploads all files into the Knowledge Base's _root directory instead of mirroring the source's structure.

Repro

  1. Create an OWUI Knowledge Base

  2. Configure an oikb source against a GitHub repo with nested directories:

    sources:
      - name: wiki-readonly
        source: github:owner/llm-wiki
        kb-id: <id>
        path: wiki/
    
  3. Run sync against a repo whose wiki/ tree contains:

    wiki/
    ├── homelab/...
    ├── one-ring/entities/...
    ├── fiction/...
    ├── templates/...
    ├── index.md
    └── log.md
    

Observed

All files land in OWUI's KB _root:

KB attached files total: 86
by top-level folder:
  _root: 86

OWUI's GET /api/v1/knowledge/{kb_id}/dirs returns one directory created by oikb (the dirs/create call is visible in the daemon's request log), but the file→directory association doesn't follow.

Expected

The KB should mirror the source structure:

by top-level folder:
  homelab: 12
  one-ring: 42
  fiction: 25
  templates: 4
  _root: 3

This matters for the ENABLE_KB_EXEC filesystem tool (added in OWUI 0.9.6) — once enabled, the LLM can run ls one-ring/entities/ to get a focused subset rather than ls returning 86 files in one bucket. Flattening defeats that.

Logs

I see one POST /api/v1/knowledge/{kb_id}/dirs/create call early in the sync, then 86 POST /api/v1/files/ calls — but no per-file directory-attach calls. Possibly missing a directory_id field in the file-attach payload?

Environment

  • oikb v0.3.5
  • Open WebUI v0.9.6 (the version that introduced knowledge_directory table + ENABLE_KB_EXEC filesystem tool)
  • Source: GitHub repo with 86 markdown files across 4 top-level subdirectories

Happy to help with a PR if pointed at the right place in the codebase — the file→directory association is presumably in the upload/sync diff handler.

Originally created by @dvystrcil on GitHub (Jun 4, 2026). Original GitHub issue: https://github.com/open-webui/oikb/issues/24 ## Summary When syncing a GitHub source whose tree has subdirectories (e.g. `wiki/homelab/`, `wiki/one-ring/`, `wiki/fiction/`), oikb uploads all files into the Knowledge Base's `_root` directory instead of mirroring the source's structure. ## Repro 1. Create an OWUI Knowledge Base 2. Configure an oikb source against a GitHub repo with nested directories: ```yaml sources: - name: wiki-readonly source: github:owner/llm-wiki kb-id: <id> path: wiki/ ``` 3. Run sync against a repo whose `wiki/` tree contains: ``` wiki/ ├── homelab/... ├── one-ring/entities/... ├── fiction/... ├── templates/... ├── index.md └── log.md ``` ## Observed All files land in OWUI's KB `_root`: ``` KB attached files total: 86 by top-level folder: _root: 86 ``` OWUI's `GET /api/v1/knowledge/{kb_id}/dirs` returns one directory created by oikb (the `dirs/create` call is visible in the daemon's request log), but the file→directory association doesn't follow. ## Expected The KB should mirror the source structure: ``` by top-level folder: homelab: 12 one-ring: 42 fiction: 25 templates: 4 _root: 3 ``` This matters for the `ENABLE_KB_EXEC` filesystem tool (added in OWUI 0.9.6) — once enabled, the LLM can run `ls one-ring/entities/` to get a focused subset rather than `ls` returning 86 files in one bucket. Flattening defeats that. ## Logs I see one `POST /api/v1/knowledge/{kb_id}/dirs/create` call early in the sync, then 86 `POST /api/v1/files/` calls — but no per-file directory-attach calls. Possibly missing a `directory_id` field in the file-attach payload? ## Environment - oikb v0.3.5 - Open WebUI v0.9.6 (the version that introduced `knowledge_directory` table + `ENABLE_KB_EXEC` filesystem tool) - Source: GitHub repo with 86 markdown files across 4 top-level subdirectories Happy to help with a PR if pointed at the right place in the codebase — the file→directory association is presumably in the upload/sync diff handler.
Author
Owner

@aprudnev commented on GitHub (Jun 5, 2026):

Interesting but when I sync local (network actually) directories OIKB creates directory structure.. SO maybe this bug was for wiki only.

Thanks for ENABLE_KB_EXEC information.

<!-- gh-comment-id:4635383234 --> @aprudnev commented on GitHub (Jun 5, 2026): Interesting but when I sync local (network actually) directories OIKB creates directory structure.. SO maybe this bug was for wiki only. Thanks for ENABLE_KB_EXEC information.
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
open-webui/oikb#16
No description provided.