question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

dcr: BotStateManager should be split into separate ConversationState and UserState middleware

See original GitHub issue

Currently we have a single BotStateManager middleware that’s responsible for reading & writing both conversation state and user state. I’d like to propose that we replace this with two separate pieces of middleware that have logic for managing conversation state and user state independently. The reasoning for that is:

  • You may want to use one but not the other and while we have config switches to turn off either piece of state it would be clearer if they were separate middleware.
  • You may want to use a RedisStorage provider for storing conversation state and a separate AzureTableStorage provider for user state. Again, we can handle this through configuration but it’s cleaner if they’re separate middleware.
  • Tracking conversation state needs slightly different semantics then tracking user state. This is the bigger reason for separating the two. With conversation state if you see an “endOfConversation” activity sent or received you should delete the current conversation state. This is needed to prevent Conrtana skills from getting into a stuck state but is generally just a good way to help your bot avoid stuck states.
  • Key value storage is fine for tracking conversation state but user state is probably better tracked as a graph so in production systems it seems likely that you’d rarely want our key-value based user state manager.

The con to splitting these up is that should you want to run both you now have to read them in series. I have another proposal to create a ParallelMiddlewareSet which would address that as there are plenty of other things you’d want to do in parallel in a production bot.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
Steveniccommented, Feb 20, 2018

@cleemullins is rocking 😃 I have some catching up to do… lol

0reactions
cleemullinscommented, Feb 22, 2018

Closing, since PR #159 is merged.

Read more comments on GitHub >

github_iconTop Results From Across the Web

dcr: BotStateManager should be split into separate ...
Currently we have a single BotStateManager middleware that's responsible for reading & writing both conversation state and user state.
Read more >
How to store UserState and ConversationState in Azure ...
ConversationState and UserState are no longer middleware and no longer generic (e.g. don't have type arguments).
Read more >
Managing state in Bot Framework SDK - Bot Service
Both user and conversation state are scoped by channel. The same person using different channels to access your bot appears as different ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found