Rasa: tracker.sender_id always returns `default` in custom actions

Created on 19 Nov 2020  ·  11Comments  ·  Source: RasaHQ/rasa

Rasa version: 2.1.0

Rasa SDK version: 2.1.1

Python version: 3.7.9

Operating system: Ubuntu

Issue:
In all of my custom actions, tracker.sender_id now always returns default instead of the actual sender id. We are heavily using this sender id as user identifiers in our database which currently fails as a result.

Note that I am using Facebook Messenger and in the Rasa core, the sender_id is correctly set.

Error (including full traceback):
No error is thrown

Command or request that led to error:

rasa run actions --action actions --debug

Most helpful comment

Perfect, will work on it today!

All 11 comments

Thanks for raising this issue, @joejuzl will get back to you about it soon✨

Please also check out the docs and the forum in case your issue was raised there too 🤗

Hi @joejuzl ! I was wondering if you had a chance to look into that? Any help would be greatly appreciated!! :-)

Hi @nbeuchat thanks for creating this issue.

This does indeed seem to be a bug.
I think it originates in https://github.com/RasaHQ/rasa.
I believe it comes from where we create temporary_tracker in MessageProcessor._run_action

Would you be up for contributing a fix?

Hi @joejuzl thanks for checking! I see where the issue lies now. Happy to provide a fix, looking into this now.

@wochinge I am looking at the _run_action from the MessageProcessor. I see that you added the temporary tracker that copies from the original one. However, tracker.copy() does not copy the sender_id because of how init_copy initializes the sender id:

    def init_copy(self) -> "DialogueStateTracker":
        """Creates a new state tracker with the same initial values."""

        return DialogueStateTracker(
            DEFAULT_SENDER_ID,  # problematic line
           ...

In order to fix this, I see two options:

  • Set the sender_id on the temporary_tracker
  • Modify the behavior of DialogueStateTracker.copy or DialogueStateTracker.init_copy so that they also copy the sender id. However, I do not have enough overview on the whole Rasa ecosystem to understand how that would effect other parts of Rasa.

What do you think would be the best approach?

Thanks for your inputs! Happy to do a PR afterwards :-)

Modify the behavior of DialogueStateTracker.copy or DialogueStateTracker.init_copy so that they also copy the sender id. However, I do not have enough overview on the whole Rasa ecosystem to understand how that would effect other parts of Rasa.

That sounds perfect! 👍 I checked the code base and it should actually fix a couple of other locations which use init_copy 🙈 Feel free to request review from me then 👍

Perfect, will work on it today!

Please target 2.1.x for your PR. Then we can ship a patch release asap.

I try to update rasa 2.1.3 and also my rasa sdk 2.1.2 but still get this bug. This happens in rasa docker hub images also. Did this release? I'm so stuck at here :(

I try to update rasa 2.1.3 and also my rasa sdk 2.1.2 but still get this bug. This happens in rasa docker hub images also. Did this release? I'm so stuck at here :(

I also tried doing this the day it appeared to have released. Same problem. I spent a while trying to figure out if I was somehow using an old version, or if I was reading the git commits wrong and it had not yet released. Came up empty. Thought I'd shelve that part of my work for a bit and come back to re-test.

So yes, has this fix been released? And in what version?

The fix was released released in Rasa Open Source 2.1.1 (cc @nbeuchat )

Was this page helpful?
0 / 5 - 0 ratings