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.

Inconsistency about whether resuming a prompt should count as a retry

See original GitHub issue

Version

master branch

Describe the bug

In Prompt.cs, ResumeDialogAsync calls RepromptDialogAsync which calls OnPromptAsync with isRetry set to false:

public override async Task RepromptDialogAsync(ITurnContext turnContext, DialogInstance instance, CancellationToken cancellationToken = default(CancellationToken))
{
    var state = (IDictionary<string, object>)instance.State[PersistedState];
    var options = (PromptOptions)instance.State[PersistedOptions];
    await OnPromptAsync(turnContext, state, options, false, cancellationToken).ConfigureAwait(false);
}

However, in ActivityPrompt.cs, RepromptDialogAsync calls OnPromptAsync with isRetry set to true:

public override async Task RepromptDialogAsync(ITurnContext turnContext, DialogInstance instance, CancellationToken cancellationToken = default(CancellationToken))
{
    var state = (IDictionary<string, object>)instance.State[PersistedState];
    var options = (PromptOptions)instance.State[PersistedOptions];
    await OnPromptAsync(turnContext, state, options, true, cancellationToken).ConfigureAwait(false);
}

I know it’s a rare case when a prompt would be resumed, but in such a case should the retry prompt be used or not?

[bug]

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
Zerrythcommented, Aug 26, 2019

I made that change to RepromptDialogAsync(), specifically with the feedback from Gabo after he reviewed the PR to add isRetry onto ActivityPrompt.OnPromptAsync(), which you can see in the history here.

It’s specifically counting as a retry when re-prompting a user, so logically it made sense that it would go towards a retry count, and also aligned it in parity with JS (retries were completely missing from C# ActivityPrompt prior to the PR linked).

  • Additionally, the ActivityPrompt class was just admittedly “weird” in comparison to the other “Prompts”, as it is in Microsoft.Bot.Builder.Dialogs namespace and does not derive from Prompt class, but instead directly from Dialog.
  • Furthermore, deriving directly from Dialog, it’s the only one you’ll see that overrides the Dialog.RepromptDialogAsync() method

I know it’s a rare case when a prompt would be resumed

  • Given that it is re-prompting the user, I still agree with Gabo’s feedback and think that it should in fact count as a retry
    • It’s not simply just a “resume” on a prompt, implying it might’ve gone away to take care of something else first, before continuing where it had left off
    • Although it is called by ResumeDialogAsync()
      • Hmm…but the class is abstract, so ultimately user could override their ResumeDialogAsync() to call RepromptDialogAsync() how they’d prefer
      • Admittedly I do see the oddness this brings when Resume calls Reprompt
  • That, and to remain in parity with what we had in the other language SDKS.

Thoughts, @gabog ?

0reactions
v-kydelacommented, Nov 12, 2020

Here’s a real-world example of a prompt being resumed: https://stackoverflow.com/questions/64765378/textprompt-reprompts-after-interruption

Read more comments on GitHub >

github_iconTop Results From Across the Web

The environment is inconsistent, please check the package ...
For my setup, I need to specify the channel otherwise it would not work. After running the command in the terminal, I was...
Read more >
Limited Retries: A Need For Speed Unbound Documentary ...
I think the limited retries are good when it's a case of "should you retry for first or accept third" or if you...
Read more >
How setting the parameter "Maximum number of retries" to a ...
In case the value set in maximum number of retries is more than 5, there can be consequences resulting in slow performance in...
Read more >
Flaky tests | GitLab
It's a test that sometimes fails, but if you retry it enough times, it passes, eventually. What are the potential cause for a...
Read more >
Transaction Retry Count - TechDocs - Broadcom Inc.
TRANSACTION RETRY COUNT is a special attribute that can be used in the PAD logic ... It lets an action diagram determine if...
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