fix: use run-mode-aware admin client for init_index instead of the end-user JWT client#1818
Conversation
…d-user JWT client In SaaS with IBM auth, _ensure_index_exists built the OpenSearch client from the end-user's JWT. That identity can search/write documents but lacks index-admin privileges on managed OpenSearch, so the first admin call in init_index (HEAD /<index> via indices.exists) failed with TransportError(500, '') and connector sync returned 500. Add Clients.create_index_admin_opensearch_client, mirroring the onboarding client selection: saas -> platform service token (user-JWT fallback for legacy deployments without OPENRAG_SERVICE_TOKEN), on_prem/oss -> OpenSearch basic auth. Use it in _ensure_index_exists (fixes connector sync, traditional uploads, and router ingest in one place) and fold the onboarding block in settings/endpoints.py onto the shared helper.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
WalkthroughThis PR centralizes OpenSearch admin client selection logic into a single ChangesOpenSearch Admin Client Centralization
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
ricofurtado
left a comment
There was a problem hiding this comment.
Liked the centralized OpenSearch admin client selection logic
In SaaS with IBM auth, _ensure_index_exists built the OpenSearch client from the end-user's JWT. That identity can search/write documents but lacks index-admin privileges on managed OpenSearch, so the first admin call in init_index (HEAD / via indices.exists) failed with TransportError(500, '') and connector sync returned 500.
Add Clients.create_index_admin_opensearch_client, mirroring the onboarding client selection: saas -> platform service token (user-JWT fallback for legacy deployments without OPENRAG_SERVICE_TOKEN), on_prem/oss -> OpenSearch basic auth. Use it in _ensure_index_exists (fixes connector sync, traditional uploads, and router ingest in one place) and fold the onboarding block in settings/endpoints.py onto the shared helper.
Summary by CodeRabbit
Chores
Tests