test: fix flaky legacy-layout agent create NUT (Bot User race) - #358
Draft
nico-pappagianis wants to merge 1 commit into
Draft
test: fix flaky legacy-layout agent create NUT (Bot User race)#358nico-pappagianis wants to merge 1 commit into
agent create NUT (Bot User race)#358nico-pappagianis wants to merge 1 commit into
Conversation
The legacy-layout 'agent create' NUT omitted agentSettings.userId, so core auto-created the licensed Bot User in the same transaction as the BotDefinition save. The pre-save validation trigger intermittently could not see the fresh license/permset assignment, failing with 'User doesn't have access to agent.' Pass the userId of the Bot User already provisioned (and waited on) in the describe's before hook, matching the sibling spec-create test, so core reuses an already-committed user instead of racing on a new one.
|
This PR lacks any commits of the 'fix' or 'feat' type, and therefore will not trigger a release. To silence all further warnings, react to this warning comment (or any other) with the 👀 emoji. NOTE: If your repo uses squash commits, make sure to add the appropriate conventional commit prefix (e.g., 'fix:', 'feat:', 'chore:', etc) in the squash commit message. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The
agent create > should retrieve the legacy Bot / GenAiPlanner layout ...NUT (test/nuts/agent.nut.ts) fails intermittently, pod-dependent, with:Root cause
The
customeragentType maps to core'sEinsteinServiceAgent, which requires a Bot User holding the Digital Agent license +AgentforceServiceAgentUserpermset. WhenAgent.createis called with noagentSettings.userId, core auto-creates that Bot User in the same transaction as the BotDefinition save; the pre-save validation trigger intermittently cannot see the just-created license/permset assignment and rejects with "User doesn't have access to agent."The describe's
beforehook already pre-provisions a Bot User, assigns the permset, and waits for the assignment to commit (waitForPermSetAssignment), storing it inbotUserId. The siblingshould create an agent from a spectest already passesuserId: botUserId; this legacy test never got the same fix.Fix
Pass
userId: botUserIdin the legacy test'sagentSettingsso core reuses the already-committed user instead of racing on a fresh one.Testing
yarn tsc -bpasses.Test-only change; no runtime code touched.