Show a specific error when agent creation hits the application limit#10538
Conversation
The agent creation wizard showed the generic "Something went wrong" alert for every failure. When the backend rejects the creation because the organization's application limit is reached (HTTP 403 with scimType applicationLimitReached), show a dedicated limit-reached error message instead, following the pattern used by the add-user wizard for userLimitReached.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAgent creation now detects organization application-limit failures using a SCIM error type and displays a dedicated localized alert. The translation model, English text, and package changeset metadata are updated accordingly. ChangesAgent application limit error
🚥 Pre-merge checks | ✅ 6✅ Passed checks (6 passed)
✨ Finishing Touches🧪 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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #10538 +/- ##
=======================================
Coverage 72.85% 72.85%
=======================================
Files 470 470
Lines 71228 71236 +8
Branches 240 240
=======================================
+ Hits 51892 51900 +8
Misses 19225 19225
Partials 111 111
🚀 New features to boost your workflow:
|
pavinduLakshan
left a comment
There was a problem hiding this comment.
any reason why we didn't follow tier limit reached error handling done in other places for this fix?
| (error as AxiosError<{ scimType?: string }>)?.response; | ||
|
|
||
| if (errorResponse?.status === 403 | ||
| && errorResponse?.data?.scimType === AGENT_APP_LIMIT_REACHED_SCIM_TYPE) { |
There was a problem hiding this comment.
any reason why we can't check for the error code instead of checking the scimType, as we have done in other places? checking the scimType for this kind of error looks odd, IMO.
identity-apps/features/admin.roles.v2/pages/create-role-wizard.tsx
Lines 156 to 157 in 8387948
There was a problem hiding this comment.
Agent creation goes through the SCIM2 API (POST /scim2/Agents), not an internal server REST API. SCIM error responses only carry status, scimType, and detail — there is no code attribute in the payload, so an error-code check isn't possible here. scimType is SCIM's machine-readable error slot.
The role wizard example calls the Roles REST API, which does return a code field — a different API contract. For SCIM flows, this follows the existing precedent in this repo: the add-user wizard checks scimType === "userLimitReached" for the user creation limit (features/admin.users.v1/components/wizard/add-user-wizard.tsx). The backend counterpart (wso2-extensions/identity-inbound-provisioning-scim2#799) mirrors that existing userLimitReached mapping with applicationLimitReached.
The If the UX preference is the tier-limit modal instead of an alert, happy to switch — the detection logic stays the same. |
Co-authored-by: Pavindu Lakshan <pavindulakshan@gmail.com>
Purpose
The agent creation wizard shows the generic "Something went wrong" / "Creating agent failed" alert for every failure — the
catchblock inadd-agent-wizard.tsxdiscards the error response entirely.When a user-serving agent cannot be created because the organization has reached its allowed application limit, the backend (with the related backend PRs) now returns HTTP 403 with
scimType: applicationLimitReached. This PR makes the wizard detect that case and show a dedicated message: "Application limit reached — Agent application creation failed. Maximum application limit reached." All other failures keep the existing generic alert.This follows the same pattern the add-user wizard uses for
userLimitReached(403 +scimTypecheck).Related Issues
Related PRs
scimType: applicationLimitReached)Checklist
Security checks