microsoft / botframework-solutions

Welcome to the Bot Framework Solutions repository which is the home for a set of templates and solutions to help build advanced conversational experiences using Azure Bot Service and Bot Framework. Microsoft Bot Framework is a comprehensive framework for building enterprise-grade conversational AI experiences.
https://aka.ms/bfsolutionsdocs
MIT License
1.05k stars 529 forks source link

Proactive State document not updated #3610

Closed manish-95 closed 4 years ago

manish-95 commented 4 years ago

What project is affected?

BotFramework Solutions VA Template(v1.0.1), BotBuilder 4.9.3

What language is this in?

C#

What happens?

The Proactive state document in Cosmos DB does not get immediately updated with the latest conversation details. Due to this, any proactive notifications are not sent to the right conversation. I face this issue when I connect through WebChat, bot in my application, as well as when I access the bot through the "Test in WebChat option" on Azure. Instead, the details are only updated once I invoke a skill dialog. On the Bot Framework Emulator however , there is an immediate update of the conversation details in the ProactiveState document.

In the new VA template, the CosmosDbStorage class has been replaced by CosmosDbPartitionedStorage class, and BotSettings now takes CosmosDbPartitionedStorageOptions as opposed to CosmosDbStorageOptions in older versions. Could this be causing an issue?

What are the steps to reproduce this issue?

  1. Set up Proactive Notifications handling from here
  2. Start a new conversation with the VA.
  3. Query the ProactiveState document in CosmosDB.
  4. The conversation ID entry for the given userID has an older value as compared to the current conversationId when tested from WebChat, but has updated value if tested from Emulator.

What were you expecting to happen?

The Proactive state document must be updated as soon as a new conversation is started, to the latest conversation details.

manish-95 commented 4 years ago

On further exmination of the Microsoft.Bot.Solutions.Proactive versions used by Beta0.8 and 1.0.1 versions, I see that in 0.8, the user role is checked by using if (activity.From.Properties["role"].ToString().Equals("user", StringComparison.InvariantCultureIgnoreCase)) , whereas in 1.0.1, the same is checked for using if (!string.IsNullOrEmpty(activity.From.Role) && activity.From.Role.Equals("user", StringComparison.InvariantCultureIgnoreCase)). While using WebChat, the Role property is passed as null, hence the ProactiveState document does not get updated.

However, while using emulator, the property of Role is set, and hence the ProactiveState document is updated

peterinnesmsft commented 4 years ago

@ryanlengel @lzc850612 could you take a look and do an initial pass of this issue?

peterinnesmsft commented 4 years ago

@manish-95 we have a similarly reported issue around this. @lzc850612 is engaging with our SDK team members there to determine next steps, so I recommend referring to that for updates in the meantime. Once we have alignment on approach, we can handle driving an appropriate resolution for this issue as well.

Issue in question where updates are located: #3614

manish-95 commented 4 years ago

@peterinnesmsft , I had initially reported that issue on the WebChat Github page, but it seems it transferred to this same repo/team. I will follow-up for any updates on this with the issue mentioned. Thank you! :)

peterinnesmsft commented 4 years ago

@manish-95, @lzc850612 has checked in a PR related to this which we believe should help address this issue. We will work on actively pushing new releases in the next week or two. In the meantime, can you please take a look and work with him to see if this helps resolve your issue? Thanks!

github-actions[bot] commented 4 years ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days

github-actions[bot] commented 4 years ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days

mrivera-ms commented 4 years ago

@peterinnesmsft, is this resolved? Can it be closed?

axelsrz commented 4 years ago

Closing due to inactivity