fix(okta): describe each user param the way its endpoint accepts it - #7307
Conversation
Okta's Management API spec uses two distinct user path parameters. `pathId`
("An ID, login, or login shortname ... of an existing Okta user") backs
`/api/v1/users/{id}` and every `/api/v1/users/{id}/lifecycle/*` operation.
`pathUserId` and `pathAppUserId` ("ID of an existing Okta user") back the
factors, roles, sessions, and membership paths.
Every Okta `userId` param is `user-or-llm`, so its description is the only
thing a model reads before choosing what to pass. Eight tools on `pathUserId`
endpoints advertised "User ID or login", so a model that supplied an email got
a 404; `delete_user` sits on a `pathId` endpoint but promised an ID only, so a
model resolved an ID it never needed.
Tightened: assign_user_role, list_user_roles, remove_user_role, enroll_factor,
list_factors, get_factor, reset_factor, clear_user_sessions.
Loosened: delete_user.
A registry-derived test classifies each Okta tool by the path its own `url`
builder produces, so a future tool is covered without a hardcoded list.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
@cubic review |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
Greptile SummaryThe PR aligns model-visible Okta
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| apps/sim/tools/okta/user_path_descriptions.test.ts | Adds registry-derived checks that Okta user parameter descriptions match the URL shape generated by each tool. |
| apps/sim/tools/okta/delete_user.ts | Documents that the delete-user endpoint accepts either an Okta user ID or login. |
| apps/sim/tools/okta/assign_user_role.ts | Corrects the role-assignment user parameter to require an Okta user ID rather than a login. |
| apps/sim/tools/okta/clear_user_sessions.ts | Corrects the session-revocation user parameter to require an Okta user ID. |
| apps/sim/tools/generated/tool-metadata.ts | Regenerates serialized tool metadata to propagate the corrected Okta parameter descriptions. |
| apps/docs/content/docs/integrations/okta.mdx | Updates generated Okta integration documentation to match the corrected tool contracts. |
Reviews (2): Last reviewed commit: "Merge remote-tracking branch 'origin/sta..." | Re-trigger Greptile
There was a problem hiding this comment.
All reported issues were addressed across 12 files
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
# Conflicts: # apps/sim/tools/generated/tool-metadata.ts
|
@cubic review |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
Summary
Nine Okta tools described their user path parameter inaccurately. These params are
user-or-llm, so the description is literally what the model reads before choosing what to pass — an inaccurate one produces a 404 on a well-formed call.Okta's spec defines exactly two user path parameters, and the distinction is the whole bug:
pathId({id})/users/{id}and every/users/{id}/lifecycle/*pathUserId({userId})/users/{userId}/factors,/roles,/sessionsOver-promising — tightened (8 tools)
All on
pathUserId, all previously advertising "User ID or login". A model reading that passes an email and gets a 404:assign_user_role,list_user_roles,remove_user_role,enroll_factor,list_factors,get_factor,reset_factor,clear_user_sessions— now "Okta user ID (not a login or email) …".Under-promising — loosened (1 tool)
delete_usercallsDELETE /api/v1/users/{id}, which is login-capable, but said "User ID to delete". Now "User ID or login (email) to delete".What this PR does not change
Description text only. No param name, tool id, URL,
requiredflag orvisibilitywas touched.Eight tools that looked wrong and are not.
suspend_user,unsuspend_user,reset_password,update_user,activate_user,get_user,deactivate_userandreset_all_factorsall build/users/{id}or/users/{id}/lifecycle/*—pathId, genuinely login-capable — so "User ID or login" was already accurate on every one. Tightening them would have introduced the bug. The trap is that several of them name their TypeScript paramuserId, which makes them read as ID-only while the path they build is{id}.Testing
apps/sim/tools/okta/user_path_descriptions.test.ts— derives everything from the real registry rather than a hardcoded list. For each Okta tool carrying auserIdparam it runs the tool's own URL builder with a sentinel and classifies by the produced pathname against^/api/v1/users/<sentinel>(/lifecycle/[^/]+)?$, then asserts the description advertises a login iff the path is login-capable. A future Okta tool is covered with no edit.One subtlety the test has to handle: a naive "contains the word login" detector reports
truefor "not a login or email", which would have forced dropping the explicit warning. The detector strips negated clauses first, so the warning an ID-only tool carries doesn't read as the promise it exists to deny.Verified red-first per description, not as a batch: each of the nine reverted individually turned exactly one named test red and no others. 121 tests pass across
tools/okta.bun run lint,type-check,check:audits(39 audits),tool-metadata:check,docs:checkandcheck-block-registry.ts origin/stagingall pass. Regenerated artifacts committed.Endpoint coverage was verified as part of this: all 44 tool URL+method pairs diffed against the spec's path/method table — zero missing paths, zero method mismatches.
Deferred
The block's UI carries the same drift and cannot be fixed without a back-compat decision.
blocks/blocks/okta.tsuses one shareduserIdsubBlock across 21 operations — 9 login-capable, 12 ID-only — withplaceholder: 'User ID or login (email)'. The model path is now correct; a human picking Enroll Factor still reads "login (email)". Splitting it means new subBlock ids, which is exactly what the stability check guards and would orphan saved values. Options are to neutralize the placeholder to "User ID" (accurate for all 21, loses the login hint on 9) or leave it. Wanted a decision rather than a unilateral change.Login resolution was considered and not implemented.
clear_user_sessionsis the one tool that would earn aGET /users/{login}pre-flight — offboarding is where the caller has an email and nothing else — but it costs a round trip, needs a read scope the tool may not otherwise hold, and inherits the ambiguity Okta itself warns about for shortnames and logins containing/.Type of Change
Checklist