Bug causing custom fallback action to run multiple times

Got a straightforward actions setup here:

from rasa_sdk import Action
from rasa_sdk.events import UserUtteranceReverted


class ActionDefaultFallback(Action):
    """Executes the fallback action and goes back to the previous state
    of the dialogue"""

    def name(self):
        return "action_fallback"

    async def run(
        self,
        dispatcher,
        tracker,
        domain,
    ):
        print("falling back")
        dispatcher.utter_message(text="falling back!")
# Configuration for Rasa NLU.
# https://rasa.com/docs/rasa/nlu/components/
language: en

pipeline:

policies:
  - name: RulePolicy
    core_fallback_threshold: 0.4
    core_fallback_action_name: "action_fallback"
    enable_fallback_prediction: True

session_config:
  session_expiration_time: 60
  carry_over_slots_to_new_session: true
intents:
- greet
- goodbye
- affirm
- deny
- mood_great
- mood_unhappy
- bot_challenge
responses:
  utter_greet:
  - text: Hey! How are you?
  utter_cheer_up:
  - image: https://i.imgur.com/nGF1K8f.jpg
    text: 'Here is something to cheer you up:'
  utter_did_that_help:
  - text: Did that help you?
  utter_happy:
  - text: Great, carry on!
  utter_goodbye:
  - text: Bye
  utter_iamabot:
  - text: I am a bot, powered by Rasa.
actions:
- action_fallback

but the fallback action runs multiple times. Is this a bug?

Hi @fandy,

I am not quite sure but did you try to add a return statement in your ActionDefaultFallback like:

async def run(
    self,
    dispatcher,
    tracker,
    domain,
):
    print("falling back")
    dispatcher.utter_message(text="falling back!")
    return []

In addition - would it be possible to post your rules and stories?

Kind regards
Julian

Hi @JulianGerhard, thanks for the suggestion but I’m still getting the same multiple responses.

Here are my rules:

version: "2.0"
rules:
- rule: Hello
  steps:
  - intent: greet
  - action: utter_greet
- rule: Goodbye
  steps:
  - intent: goodbye
  - action: utter_goodbye

stories:

version: "2.0"

stories:
- story: greet
  steps:
  - intent: greet
  - action: utter_greet
- story: goodbye
  steps:
  - intent: goodbye
  - action: utter_goodbye

Hi @fandy,

ok - I see. Then I’d recommend you to do the following:

Start your action server with rasa run actions -vv and your bot with rasa shell -vv and reproduce the above mentioned scenario. Afterwards, please post all the verbose bot output here such that we can analyze what the bot decided to execute.

Kind regards
Julian

@JulianGerhard Here are the logs: action server logs.sh · GitHub

It seems like the rasa x server is in some kind of infinite loop. This seems not normal for Rasa X/ when it’s idle:

Could it have something to do with enabling the tracker store? I have it connected to postgres with the correct credentials.

Hi @fandy,

indeed that is strange. Did you try to uncomment the Tracker Store in your .yml file and restart everything afterwards?

Kind regards
Julian

1 Like

@JulianGerhard Yes it seems to be the same issue with the tracker commented out. Here’s the logs when the server starts:

source /Users/fang/Projects/avatar/venv/bin/activate
➜  avatar git:(main) ✗ source /Users/fang/Projects/avatar/venv/bin/activate
(venv) ➜  avatar git:(main) ✗ rasa x --enable-api 
warning: inexact rename detection was skipped due to too many files.
warning: you may want to set your diff.renameLimit variable to at least 27952 and retry the command.
warning: inexact rename detection was skipped due to too many files.
warning: you may want to set your diff.renameLimit variable to at least 27952 and retry the command.
warning: inexact rename detection was skipped due to too many files.
warning: you may want to set your diff.renameLimit variable to at least 27952 and retry the command.
Starting Rasa X in local mode... 🚀
/Users/fang/Projects/avatar/venv/lib/python3.6/site-packages/rasa/shared/utils/io.py:93: UserWarning: Issue found in '/var/folders/r_/stydk2lj1f71lq5wjf4dq69m0000gn/T/tmp4dn9elaz': 
Found intent 'mood_unhappy' in stories which is not part of the domain.
  More info at https://rasa.com/docs/rasa/stories
/Users/fang/Projects/avatar/venv/lib/python3.6/site-packages/rasa/shared/utils/io.py:93: UserWarning: Issue found in '/var/folders/r_/stydk2lj1f71lq5wjf4dq69m0000gn/T/tmp4dn9elaz': 
Found intent 'bot_challenge' in stories which is not part of the domain.
  More info at https://rasa.com/docs/rasa/stories
warning: inexact rename detection was skipped due to too many files.
warning: you may want to set your diff.renameLimit variable to at least 27952 and retry the command.
warning: inexact rename detection was skipped due to too many files.
warning: you may want to set your diff.renameLimit variable to at least 27952 and retry the command.
warning: inexact rename detection was skipped due to too many files.
warning: you may want to set your diff.renameLimit variable to at least 27952 and retry the command.
[2020-12-29 08:19:09 -0500] [8062] [INFO] Goin' Fast @ http://0.0.0.0:5002
2020-12-29 08:19:09 INFO     sanic.root  - Goin' Fast @ http://0.0.0.0:5002

The server is running at http://localhost:5002/login?username=me&password=Tda5ITuKS4zB

[2020-12-29 08:19:09 -0500] [8062] [INFO] Starting worker [8062]
2020-12-29 08:19:09 INFO     sanic.root  - Starting worker [8062]
/Users/fang/Projects/avatar/venv/lib/python3.6/site-packages/rasa/shared/utils/io.py:93: UserWarning: Interpreter parsed an intent 'affirm' which is not defined in the domain. Please make sure all intents are listed in the domain.
  More info at https://rasa.com/docs/rasa/domain
2020-12-29 08:47:28 WARNING  rasa.core.processor  - Circuit breaker tripped. Stopped predicting more actions for sender 'aa35d1d585e04fc89fcfa17481b3b39f'.
^CStopping event service.
[2020-12-29 08:47:49 -0500] [8062] [INFO] Stopping worker [8062]
2020-12-29 08:47:49 INFO     sanic.root  - Stopping worker [8062]
/Users/fang/Projects/avatar/venv/lib/python3.6/site-packages/rasa/core/run.py:312: FutureWarning: The method 'EventBroker.close was changed to be asynchronous. Please adapt your custom event broker accordingly. Support for synchronous implementations will be removed in Rasa Open Source 3.0.0.
  f"The method '{EventBroker.__name__}.{EventBroker.close.__name__} was "
/Users/fang/Projects/avatar/venv/lib/python3.6/site-packages/rasa/core/run.py:317: RuntimeWarning: coroutine 'EventBroker.close' was never awaited
  event_broker.close()
[2020-12-29 08:47:49 -0500] [8062] [INFO] Server Stopped
2020-12-29 08:47:49 INFO     sanic.root  - Server Stopped
^C^C
(venv) ➜  rasa x --enable-api
warning: inexact rename detection was skipped due to too many files.
warning: you may want to set your diff.renameLimit variable to at least 27952 and retry the command.
warning: inexact rename detection was skipped due to too many files.
warning: you may want to set your diff.renameLimit variable to at least 27952 and retry the command.
warning: inexact rename detection was skipped due to too many files.
warning: you may want to set your diff.renameLimit variable to at least 27952 and retry the command.
Starting Rasa X in local mode... 🚀
/Users/fang/Projects/avatar/venv/lib/python3.6/site-packages/rasa/shared/utils/io.py:93: UserWarning: Issue found in '/var/folders/r_/stydk2lj1f71lq5wjf4dq69m0000gn/T/tmppiw2mkyh': 
Found intent 'mood_unhappy' in stories which is not part of the domain.
  More info at https://rasa.com/docs/rasa/stories
/Users/fang/Projects/avatar/venv/lib/python3.6/site-packages/rasa/shared/utils/io.py:93: UserWarning: Issue found in '/var/folders/r_/stydk2lj1f71lq5wjf4dq69m0000gn/T/tmppiw2mkyh': 
Found intent 'bot_challenge' in stories which is not part of the domain.
  More info at https://rasa.com/docs/rasa/stories
warning: inexact rename detection was skipped due to too many files.
warning: you may want to set your diff.renameLimit variable to at least 27952 and retry the command.
warning: inexact rename detection was skipped due to too many files.
warning: you may want to set your diff.renameLimit variable to at least 27952 and retry the command.
warning: inexact rename detection was skipped due to too many files.
warning: you may want to set your diff.renameLimit variable to at least 27952 and retry the command.
[2020-12-29 08:48:05 -0500] [8572] [INFO] Goin' Fast @ http://0.0.0.0:5002
2020-12-29 08:48:05 INFO     sanic.root  - Goin' Fast @ http://0.0.0.0:5002

The server is running at http://localhost:5002/login?username=me&password=C30Is5TVCUeg

[2020-12-29 08:48:05 -0500] [8572] [INFO] Starting worker [8572]
2020-12-29 08:48:05 INFO     sanic.root  - Starting worker [8572]
/Users/fang/Projects/avatar/venv/lib/python3.6/site-packages/rasa/shared/utils/io.py:93: UserWarning: Interpreter parsed an intent 'affirm' which is not defined in the domain. Please make sure all intents are listed in the domain.
  More info at https://rasa.com/docs/rasa/domain
2020-12-29 08:48:33 WARNING  rasa.core.processor  - Circuit breaker tripped. Stopped predicting more actions for sender 'ab3f732743524d219fa057d8744428e7'.
^CStopping event service.
[2020-12-29 08:48:45 -0500] [8572] [INFO] Stopping worker [8572]
2020-12-29 08:48:45 INFO     sanic.root  - Stopping worker [8572]
/Users/fang/Projects/avatar/venv/lib/python3.6/site-packages/rasa/core/run.py:312: FutureWarning: The method 'EventBroker.close was changed to be asynchronous. Please adapt your custom event broker accordingly. Support for synchronous implementations will be removed in Rasa Open Source 3.0.0.
  f"The method '{EventBroker.__name__}.{EventBroker.close.__name__} was "
/Users/fang/Projects/avatar/venv/lib/python3.6/site-packages/rasa/core/run.py:317: RuntimeWarning: coroutine 'EventBroker.close' was never awaited
  event_broker.close()
[2020-12-29 08:48:46 -0500] [8572] [INFO] Server Stopped
2020-12-29 08:48:46 INFO     sanic.root  - Server Stopped
^C^C
(venv) ➜  
(venv) ➜  avatar git:(main) ✗ rasa x --enable-api
warning: inexact rename detection was skipped due to too many files.
warning: you may want to set your diff.renameLimit variable to at least 27952 and retry the command.
warning: inexact rename detection was skipped due to too many files.
warning: you may want to set your diff.renameLimit variable to at least 27952 and retry the command.
warning: inexact rename detection was skipped due to too many files.
warning: you may want to set your diff.renameLimit variable to at least 27952 and retry the command.
Starting Rasa X in local mode... 🚀
/Users/fang/Projects/avatar/venv/lib/python3.6/site-packages/rasa/shared/utils/io.py:93: UserWarning: Issue found in '/var/folders/r_/stydk2lj1f71lq5wjf4dq69m0000gn/T/tmpyzvuwtme': 
Found intent 'mood_unhappy' in stories which is not part of the domain.
  More info at https://rasa.com/docs/rasa/stories
/Users/fang/Projects/avatar/venv/lib/python3.6/site-packages/rasa/shared/utils/io.py:93: UserWarning: Issue found in '/var/folders/r_/stydk2lj1f71lq5wjf4dq69m0000gn/T/tmpyzvuwtme': 
Found intent 'bot_challenge' in stories which is not part of the domain.
  More info at https://rasa.com/docs/rasa/stories
warning: inexact rename detection was skipped due to too many files.
warning: you may want to set your diff.renameLimit variable to at least 27952 and retry the command.
warning: inexact rename detection was skipped due to too many files.
warning: you may want to set your diff.renameLimit variable to at least 27952 and retry the command.
warning: inexact rename detection was skipped due to too many files.
warning: you may want to set your diff.renameLimit variable to at least 27952 and retry the command.
[2020-12-29 08:49:02 -0500] [8724] [INFO] Goin' Fast @ http://0.0.0.0:5002
2020-12-29 08:49:02 INFO     sanic.root  - Goin' Fast @ http://0.0.0.0:5002

The server is running at http://localhost:5002/login?username=me&password=2bdUErj3EtC5

[2020-12-29 08:49:02 -0500] [8724] [INFO] Starting worker [8724]
2020-12-29 08:49:02 INFO     sanic.root  - Starting worker [8724]

Hi @fandy,

got it. Can you please repeat the process explicitly without using rasa x, instead using my mentioned commands?

Let me know about the results…

Kind regards
Julian

@JulianGerhard here are the logs: actions.sh · GitHub

Could it be something to do with my config?

# Configuration for Rasa NLU.
# https://rasa.com/docs/rasa/nlu/components/
language: en

pipeline:

policies:
  - name: RulePolicy
    core_fallback_threshold: 0.4
    core_fallback_action_name: "action_fallback"
    enable_fallback_prediction: True

@JulianGerhard pinging again, I posted the logs above, but I don’t see anything out of the ordinary.

Hi @fandy,

got it. At this point I’d suggest to zip the bot, upload it here such that I can test it on my system, just to make sure… would that be possible?

Kind regards
Julian

Have the same issue