Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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#14942
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

@usmanomer1
Copy link
Copy Markdown

@usmanomer1 usmanomer1 commented Feb 12, 2026

Summary

Fixes #13873

The assignAgent function in the HITL plugin runs setHumanAgent and maybeRespondText (the join message) concurrently in a single Promise.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.ts

Split the single Promise.all into two sequential steps:

  1. First, set the human agent on both downstream and upstream conversations (these two can safely run in parallel with each other)
  2. Then, send the join message and link the webchat user (these two can safely run in parallel with each other)

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

await Promise.all([
  downstreamCm.setHumanAgent(humanAgentUserId, humanAgentName),
  upstreamCm.setHumanAgent(humanAgentUserId, humanAgentName),
  upstreamCm.maybeRespondText(sessionConfig.onHumanAgentAssignedMessage, DEFAULT_HUMAN_AGENT_ASSIGNED_MESSAGE),
  tryLinkWebchatUser(props, { ... }),
])

After

await Promise.all([
  downstreamCm.setHumanAgent(humanAgentUserId, humanAgentName),
  upstreamCm.setHumanAgent(humanAgentUserId, humanAgentName),
])

await Promise.all([
  upstreamCm.maybeRespondText(sessionConfig.onHumanAgentAssignedMessage, DEFAULT_HUMAN_AGENT_ASSIGNED_MESSAGE),
  tryLinkWebchatUser(props, { ... }),
])

Notes

  • The HITL plugin builds successfully with this change
  • Backward compatible: no API or behavior changes beyond fixing the ordering
  • Parallelism is preserved where safe (both setHumanAgent calls run together, then both post-set operations run together)

…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>
@usmanomer1 usmanomer1 requested review from a team as code owners February 12, 2026 22:27
@SebastienPoitras SebastienPoitras requested review from a team and removed request for a team May 1, 2026 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HITL - Set humanAgent before sending join message

1 participant

Morty Proxy This is a proxified and sanitized view of the page, visit original site.