Skip to content

Fix request-level workspace routing - #2932

Closed
Pioneer-Weirdo wants to merge 3 commits into
HKUDS:mainfrom
Pioneer-Weirdo:fix/request-workspace-routing
Closed

Pioneer-Weirdo wants to merge 3 commits into
HKUDS:mainfrom
Pioneer-Weirdo:fix/request-workspace-routing

Conversation

@Pioneer-Weirdo

Copy link
Copy Markdown

Summary

  • route query, document, graph, and Ollama API requests through a workspace-aware LightRAG registry
  • add /workspaces inventory for runtime inspection and make /health initialize/report the active workspace consistently
  • avoid mutating a shared rag.workspace in-place by lazily creating one LightRAG instance per workspace

Problem

LIGHTRAG-WORKSPACE was parsed by the server, but only /health used it. Query and write routes still operated on the single startup rag instance, so request-level workspace isolation did not actually work.

Changes

  • add get_rag_for_workspace(...) and per-workspace DocumentManager resolution in lightrag_server.py
  • pass workspace resolvers into query/document/graph routers and OllamaAPI
  • update handlers to accept Request and resolve the active workspace-specific LightRAG before serving the request
  • finalize all initialized workspace instances on shutdown
  • expose /workspaces to inspect known workspaces discovered from config, registries, and storage directories

Verification

  • python -m py_compile lightrag/api/lightrag_server.py lightrag/api/routers/query_routes.py lightrag/api/routers/document_routes.py lightrag/api/routers/graph_routes.py lightrag/api/routers/ollama_api.py
  • runtime A/B workspace probe against a patched LightRAG container confirmed:
    • writing token A to workspace A is only visible in workspace A
    • writing token B to workspace B is only visible in workspace B

@github-actions

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@github-actions github-actions Bot added the Stale label Jul 12, 2026
@github-actions

Copy link
Copy Markdown

This pull request has been automatically closed because it has not had recent activity.

@github-actions github-actions Bot closed this Jul 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant