fix(plugins/hitl): set human agent before sending join message#14942
Open
usmanomer1 wants to merge 1 commit intobotpress:masterbotpress/botpress:masterfrom
usmanomer1:fix/hitl-set-agent-before-join-messageusmanomer1/botpress:fix/hitl-set-agent-before-join-messageCopy head branch name to clipboard
Open
fix(plugins/hitl): set human agent before sending join message#14942usmanomer1 wants to merge 1 commit intobotpress:masterbotpress/botpress:masterfrom usmanomer1:fix/hitl-set-agent-before-join-messageusmanomer1/botpress:fix/hitl-set-agent-before-join-messageCopy head branch name to clipboard
usmanomer1 wants to merge 1 commit intobotpress:masterbotpress/botpress:masterfrom
usmanomer1:fix/hitl-set-agent-before-join-messageusmanomer1/botpress:fix/hitl-set-agent-before-join-messageCopy head branch name to clipboard
Conversation
…ess#13873) The assignAgent function ran setHumanAgent and the join message response in a single Promise.all, meaning the agent name might not be set on the conversation when the join message is delivered. This caused the agent name to appear blank or as an unresolved template variable. Split the Promise.all into two sequential steps: first set the human agent on both conversations, then send the join message and link the webchat user. Co-authored-by: Cursor <cursoragent@cursor.com>
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.
Summary
Fixes #13873
The
assignAgentfunction in the HITL plugin runssetHumanAgentandmaybeRespondText(the join message) concurrently in a singlePromise.all. This means the join message can be sent before the human agent name is set on the conversation tags, causing the agent name to appear blank or as an unresolved template variable for the end user.Changes
plugins/hitl/src/hooks/operations.tsSplit the single
Promise.allinto two sequential steps:This ensures the agent info is available on the conversation before the join message is delivered, while still preserving parallelism where the ordering does not matter.
Before
After
Notes
setHumanAgentcalls run together, then both post-set operations run together)