UN-2888 [FIX] Add hook for setting default triad for invited users#1877
UN-2888 [FIX] Add hook for setting default triad for invited users#1877pk-zipstack wants to merge 6 commits intomainfrom
Conversation
Add setup_default_adapters_for_user() hook to AuthenticationService and call it from set_user_organization() when an invited user joins an existing organization. This allows the cloud plugin to set up default triad adapters (LLM, embedding, vector DB, x2text) for invited users, fixing silent failures in API deployment creation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (2)
Summary by CodeRabbit
WalkthroughController now calls Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes 🚥 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 |
|
| Filename | Overview |
|---|---|
| backend/account_v2/authentication_controller.py | Adds setup_default_adapters_for_user hook call in the else branch of set_user_organization for invited users joining an existing org; follows the same try/except+logging pattern as frictionless_onboarding. |
| backend/account_v2/authentication_service.py | Adds setup_default_adapters_for_user stub method raising MethodNotImplemented, consistent with the existing frictionless_onboarding plugin-hook pattern. |
| frontend/src/components/navigations/side-nav-bar/SideNavBar.jsx | Renames the settings menu label from "Default Triad" to "Default LLM Profile"; no functional change. |
| frontend/src/components/settings/default-triad/DefaultTriad.jsx | Renames the page heading to "Default LLM Profile", but two error message strings on lines 102 and 168 still reference the old "Default Triads" name. |
Sequence Diagram
sequenceDiagram
participant Client
participant AuthController as AuthenticationController
participant AuthService as AuthenticationService (base/cloud)
participant DB
Client->>AuthController: set_user_organization(request, org_id)
AuthController->>DB: create_tenant_user(org, user)
alt new_organization
AuthController->>AuthService: frictionless_onboarding(org, user)
AuthService-->>AuthController: OK / MethodNotImplemented (logged)
AuthController->>DB: create_initial_platform_key(user, org)
else existing org (invited user)
AuthController->>AuthService: setup_default_adapters_for_user(org, user)
AuthService-->>AuthController: OK / MethodNotImplemented (logged)
end
AuthController->>Client: HTTP 200 {is_new_org, user, organization}
Prompt To Fix All With AI
This is a comment left during a code review.
Path: frontend/src/components/settings/default-triad/DefaultTriad.jsx
Line: 102
Comment:
**Stale error message strings after rename**
The UI label was renamed to "Default LLM Profile" but the error message strings on lines 102 and 168 still reference "Default Triads", creating an inconsistency between what the page title says and what the user sees in error toasts/alerts.
```suggestion
setAlertDetails(handleException(err, "Failed to fetch Default LLM Profile"));
```
Same fix needed on line 168: `"Failed to update Default LLM Profile"`.
How can I resolve this? If you propose a fix, please make it concise.Reviews (6): Last reviewed commit: "[MISC] Rename Default Triad to Default L..." | Re-trigger Greptile
There was a problem hiding this comment.
🧹 Nitpick comments (1)
backend/account_v2/authentication_controller.py (1)
216-222: Consider adding a log message for consistency withfrictionless_onboarding.The
frictionless_onboardingexception handler at line 208 logs"frictionless_onboarding not implemented", but this handler silently passes. Adding a similar log message would improve debugging consistency for OSS deployments.♻️ Suggested change
else: try: self.auth_service.setup_default_adapters_for_user( organization=organization, user=user ) except MethodNotImplemented: - pass + logger.info("setup_default_adapters_for_user not implemented")🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@backend/account_v2/authentication_controller.py` around lines 216 - 222, The except block swallowing MethodNotImplemented for self.auth_service.setup_default_adapters_for_user should log a message like the frictionless_onboarding handler does; update the except MethodNotImplemented block in authentication_controller (around setup_default_adapters_for_user) to call the same logger used for frictionless_onboarding and emit a clear message such as "setup_default_adapters_for_user not implemented" and include minimal context (organization id/name and user id/email) to aid debugging.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@backend/account_v2/authentication_controller.py`:
- Around line 216-222: The except block swallowing MethodNotImplemented for
self.auth_service.setup_default_adapters_for_user should log a message like the
frictionless_onboarding handler does; update the except MethodNotImplemented
block in authentication_controller (around setup_default_adapters_for_user) to
call the same logger used for frictionless_onboarding and emit a clear message
such as "setup_default_adapters_for_user not implemented" and include minimal
context (organization id/name and user id/email) to aid debugging.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 708b08ff-27b6-4bb5-b5a2-12840cd88c63
📒 Files selected for processing (2)
backend/account_v2/authentication_controller.pybackend/account_v2/authentication_service.py
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> Signed-off-by: Praveen Kumar <praveen@zipstack.com>
| organization=organization, user=user | ||
| ) | ||
| except MethodNotImplemented: | ||
| logger.info("setup_default_adapters_for_user not implemented") |
There was a problem hiding this comment.
NIT: Make the log more useful by stating what happens as a result. You can mention that default adapters are not set for the user
Address review comment: log user email and explain that default adapters will not be set when the method is not implemented. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Update display label from "Default Triad" to "Default LLM Profile" in the page heading and side navigation menu. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Frontend Lint Report (Biome)✅ All checks passed! No linting or formatting issues found. |
Test ResultsSummary
Runner Tests - Full Report
SDK1 Tests - Full Report
|
|



What
setup_default_adapters_for_user()hook method toAuthenticationService(raisesMethodNotImplemented)set_user_organization()inAuthenticationControllerfor non-new organizations (invited user flow)Why
UserDefaultAdapterrecord is missingHow
setup_default_adapters_for_user()to the baseAuthenticationServicefollowing the same plugin pattern asfrictionless_onboarding()(raisesMethodNotImplementedin base, implemented in cloud)set_user_organization(), aftercreate_tenant_user(), the hook is called in theelsebranch (non-new org) with a try/except forMethodNotImplementedUserDefaultAdapterfor the invited userCan this PR break any existing features? If yes, please list possible items. If no, please explain why.
MethodNotImplementedin the base implementation, which is caught and silently ignored. This is the same pattern used byfrictionless_onboarding(). OSS deployments are unaffected.Database Migrations
Env Config
Related Issues or PRs
fix/set-default-triad-for-invited-userDependencies Versions
Notes on Testing
pluggable_apps/platform_admin/tests/test_set_default_adapters.pycovering:Checklist
🤖 Generated with Claude Code