Two-stage fallback policy slot reset

I’m encountering an issue with the two-stage fallback policy. Slots are getting reset during the native action “action_revert_fallback_events” causing entities to be lost during the dialogue. We found some workarounds on the forums, however, they require a code change in the rasa core sdk library.

[https://github.com/RasaHQ/rasa/issues/3281](https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_RasaHQ_rasa_issues_3281&d=DwMFaQ&c=H50I6Bh8SW87d_bXfZP_8g&r=6VEExljb7Qf1nP9By5mnhVeaHaSM9SVkY8XX11JU3PQ&m=eIuN_HvKQQlXNOpDcUN9KedEyS_Ka-A2zYsyyBGnYUs&s=GyoW4VewZ0gUQoeWrfrBU-v-9fA0d64iQhVpuY13KEI&e=)

[https://forum.rasa.com/t/help-twostagefallbackpolicy-do-not-revert-slot-filling-after-affirmation/5607](https://urldefense.proofpoint.com/v2/url?u=https-3A__forum.rasa.com_t_help-2Dtwostagefallbackpolicy-2Ddo-2Dnot-2Drevert-2Dslot-2Dfilling-2Dafter-2Daffirmation_5607&d=DwMFaQ&c=H50I6Bh8SW87d_bXfZP_8g&r=6VEExljb7Qf1nP9By5mnhVeaHaSM9SVkY8XX11JU3PQ&m=eIuN_HvKQQlXNOpDcUN9KedEyS_Ka-A2zYsyyBGnYUs&s=JtYDtFwfncBL6E2cGF4WS6NqnVVRoNSxKcgpB-rkFOQ&e=)

Is there a workaround that would not require modification of the rasa core code?

Ex.

    
Chat History

 #    Bot                                                                                                                                                                           You
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 1    action_listen
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 2                                                                                                                                                                                     approve
                                                                                                                                                         intent: restart_vacation_request 0.20
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 3    action_default_ask_affirmation 1.00
      Sorry I do not understand that, could you rephrase?
      action_listen 1.00
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 4                                                             /approve_vacation_request{"requester": "John Doe", "range": "06/12/2019 - 06/12/2019", "person": "Jane Doe", "comment":""}
                                                                                                                                                         intent: approve_vacation_request 1.00
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 5    slot{"comment": ""}
      slot{"person": ["John Doe"]}
      slot{"range": "06/12/2019 - 06/12/2019"}
      slot{"requester": "Jane Doe"}
      action_revert_fallback_events 1.00
      rewind
      rewind
      action_listen
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 6   /approve_vacation_request{"requester": "Jane Doe", "range": "06/12/2019 - 06/12/2019", "person": "John Doe", "comment":""}
                                                                                                                                                         intent: approve_vacation_request 1.00
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 7    utter_confirm_approve 0.99
      Do you want to approve vacation for None? **<-- being set to None because slots were cleared during action_revert_fallback_events**

   Buttons:
      1: Approve
      (/confirmed_approval_vacation_request)
      2: Reject
      (/rejected_vacation_request)

Yes, the action_revert_fallback_events does exactly what it says it does – it undoes anything that was done before, because it assumes that it falls back because something went wrong, i.e. any slots set probably shouldn’t have been set.

I understand what you mean though – if the user rephrased, and that was taken with high confidence, the events of the previous (unclear) action should be reverted, but not the rephrased intent. So ideally it would look something like

      action_revert_fallback_events 1.00
      rewind
      slot{"comment": ""}
      slot{"person": ["John Doe"]}
      slot{"range": "06/12/2019 - 06/12/2019"}
      slot{"requester": "Jane Doe"}
      action_listen

Do you agree?

Yes, that is the ideal flow.

Is there any workaround for this?

Hm, it might be that we need to change the behavior. @Tobias_Wochinger can you check this out and tell me what you think?

Actually these should be set again when the intent is applied to the tracker. Which Rasa (core) version are you using?

Hm, it might be that we need to change the behavior. @Tobias_Wochinger can you check this out and tell me what you think?

Not entirely sure, whether I understand you two correctly.

action_revert_fallback_events reverts all events from the TwoStageFallbackPolicy and re-applies the rephrased user message. Slots from entities are also reset (or should be)

Right, but as you can see above, it seems to apply the rephrased user message before reverting, which gets it reverted:

slot{"comment": ""}
      slot{"person": ["John Doe"]}
      slot{"range": "06/12/2019 - 06/12/2019"}
      slot{"requester": "Jane Doe"}
      action_revert_fallback_events 1.00
      rewind
      rewind
      action_listen

Slots from entities are also reset (or should be)

Should the ones from the re-applied, rephrased (accepted with high confidence) input be reverted?

It is not reset.

See here for people experiencing the same issue:

@fishnyips This bug was fixed in newer rasa versions. Can you to use the latest version rasa 1.x ?

@Tobias_Wochinger I am using Rasa version 1.1.7 and I am still experiencing this issue.

This was actually an issue! Thanks for pointing this out! Fixing it in Fix twostage il by wochinge · Pull Request #4100 · RasaHQ/rasa · GitHub

Will be fixed in rasa 1.1.8 :slight_smile:

When should we expect the release for 1.1.8?

Tomorrow :slight_smile:

Thank you, Tobi