[BUG] Auto-assigning bot to livechat feature should check the availability of the bot agent

Open
#16,816 5 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
42/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
typescript
Domain
backend

Research direction

Start with the live-chat room creation flow and the auto-assignment logic for bot agents, then trace how bot availability is determined after the authentication token expires. Reproduce the 24-hour session-timeout scenario described in the issue; done when a logged-out bot agent is not assigned to a new live-chat room.

Written by the indexing model from the issue text.

Description

Description:

Due to the security issue, we set up session timeout to be 1 day for our Rocket.Chat instance. This leads to the situation that our bot adapter will be logged out after every 24 hours. However, when the guest attempt to create a new live-chat room, the bot agent is still auto-assigned to the live-chat room although it has been logged out. Therefore, the bot agent will not respond to any message from the live-chat guest.

Steps to reproduce:
  1. Setup "Login Expiration in Days" to be 1 and enable "Forget User Session on Window Close" in Accounts settings.
  2. Run the bot adapter --> bot adapter get logged in.
  3. After 24 hours, the bot adapter is logged out due to session timeout. (its authentication token got expired)
  4. A guest attempt to create a new live-chat room --> the bot agent is still auto-assigned to the live-chat but will not respond anything because the bot adapter got logged out.
Expected behavior:

Rocket.Chat does not auto-assign unavailable bot agents to the live-chat room.

Actual behavior:

Even the bot adapter is logged out due to the session timeout, the live-chat room is still auto-assigned to the bot agent. Therefore there is no response from the bot adapter.

Server Setup Information:
  • Version of Rocket.Chat Server: 2.2.0
  • Operating System: Windows 10
  • Deployment Method: docker
  • Number of Running Instances: 1
  • DB Replicaset Oplog:
  • NodeJS Version: v10.16.3
  • MongoDB Version:
Dominant language
TypeScript
Stars
46.1k
Forks
13.9k
Avg merge
3d 3h
Merged PRs (30d)
130

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from RocketChat/Rocket.Chat

All issues in RocketChat/Rocket.Chat

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.