Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix user ID always default on every shell session. #5117

Merged

Conversation

VictorCoCo
Copy link
Contributor

@VictorCoCo VictorCoCo commented Jan 23, 2020

Proposed changes:

It is hard to check the bot's functionality after making updates and/or changes, especially when
there is a need to maintain a session for a user.

For example:
When using a CoCo component, a session identifier needs to be maintained throughout and when the user ID
doesn't change from session to session, the conversation maintains the context from the previous shell session.

  • ...

Status (please check what you already did):

  • added some tests for the functionality
  • updated the documentation
  • updated the changelog (please check changelog for instructions)
  • reformat files using black (please check Readme for instructions)

@claassistantio
Copy link

claassistantio commented Jan 23, 2020

CLA assistant check
All committers have signed the CLA.

@akelad
Copy link
Contributor

akelad commented Jan 23, 2020

Thanks for submitting this PR, we'll give it a review as soon as possible.

@akelad akelad requested review from ricwo and removed request for erohmensing January 23, 2020 15:14
Copy link
Contributor

@ricwo ricwo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the change makes sense in general - please have a look at the comments.

Would you mind adding a changelog entry? You can find the instructions in the README (you'll have to create an issue for reference in the changelog entry).

Thanks a lot for your contribution! 🎉

@@ -22,6 +22,8 @@

DEFAULT_STREAM_READING_TIMEOUT_IN_SECONDS = 10

CONSOLE_SESSION_USER_ID = str(uuid.uuid4())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we use the hex version of UUID4 elsewhere - it would be good to keep that consistent

Suggested change
CONSOLE_SESSION_USER_ID = str(uuid.uuid4())
CONSOLE_SESSION_USER_ID = uuid.uuid4().hex

rasa/core/channels/console.py Outdated Show resolved Hide resolved
rasa/core/channels/console.py Outdated Show resolved Hide resolved
rasa/core/channels/console.py Outdated Show resolved Hide resolved
VictorCoCo and others added 4 commits January 26, 2020 10:38
Co-Authored-By: ricwo <ric.wkr@gmail.com>
Co-Authored-By: ricwo <ric.wkr@gmail.com>
Co-Authored-By: ricwo <ric.wkr@gmail.com>
Copy link
Contributor

@ricwo ricwo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for the changes 👍

changelog/5117.improvement.rst Outdated Show resolved Hide resolved
changelog/5117.improvement.rst Outdated Show resolved Hide resolved
@ricwo
Copy link
Contributor

ricwo commented Jan 30, 2020

@VictorCoCo can you please make sure test_console_input() passes?

@erohmensing
Copy link
Contributor

erohmensing commented Jan 31, 2020

@ricwo do you think it is worth it to be able to configure the id being set the same every time (or set a specific id, with default random)? I'm wondering if there is anyone who is currently banking on pulling the tracker from "default" every time who will have trouble in the future with an unpredictable conversation ID, especially in a script to pull trackers.

@VictorCoCo
Copy link
Contributor Author

VictorCoCo commented Feb 2, 2020

@ricwo do you think it is worth it to be able to configure the id being set the same every time (or set a specific id, with default random)? I'm wondering if there is anyone who is currently banking on pulling the tracker from "default" every time who will have trouble in the future with an unpredictable conversation ID, especially in a script to pull trackers.

@erohmensing Do you think passing the sender_id to the shell command as an optional argument would help?

@ricwo
Copy link
Contributor

ricwo commented Feb 2, 2020

yes @erohmensing @VictorCoCo I think that is reasonable - as you suggested the easiest thing would be to add a command-line argument to rasa shell (--conversation-id)

@VictorCoCo VictorCoCo requested a review from ricwo February 3, 2020 14:25
@VictorCoCo
Copy link
Contributor Author

@erohmensing Added

--conversation-id

missed your comment, will change --sender-id to --conversation-id

@ricwo
Copy link
Contributor

ricwo commented Feb 4, 2020

@VictorCoCo can you please make sure all tests pass? feel free to request a review from me again afterwards

VictorCoCo and others added 6 commits February 10, 2020 10:50
Co-Authored-By: ricwo <ric.wkr@gmail.com>
Co-Authored-By: ricwo <ric.wkr@gmail.com>
Co-Authored-By: ricwo <ric.wkr@gmail.com>
Co-Authored-By: ricwo <ric.wkr@gmail.com>
Co-Authored-By: ricwo <ric.wkr@gmail.com>
@VictorCoCo VictorCoCo requested a review from ricwo February 10, 2020 17:37
ricwo
ricwo previously approved these changes Feb 11, 2020
Copy link
Contributor

@ricwo ricwo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks for your changes 👍

changelog/5117.improvement.rst Show resolved Hide resolved
changelog/5117.improvement.rst Outdated Show resolved Hide resolved
@ricwo
Copy link
Contributor

ricwo commented Feb 14, 2020

@VictorCoCo would you mind fixing the failing build?

@VictorCoCo
Copy link
Contributor Author

@VictorCoCo would you mind fixing the failing build?

I see only an issue on code climate, an unrelated code issue. Maybe a permission issue, Do you want me to squash it?

@erohmensing erohmensing mentioned this pull request Feb 17, 2020
4 tasks
@@ -59,3 +59,5 @@

DEFAULT_SESSION_EXPIRATION_TIME_IN_MINUTES = 60
DEFAULT_CARRY_OVER_SLOTS_TO_NEW_SESSION = True

DEFAULT_SENDER_ID = "default"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ricwo Would it be better to default to generating a random ID when rasa shell is called instead of fixing it here as a constant?

The reason for this suggestion is: If you have a persistent tracker store and run rasa shell, you would want to start from scratch with a new conversation id and not at whichever state the last session with a default id was in.
(We were also discussing that in the PR that adds such an argument for rasa interactive: #5243.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, It was the way I first changed it. @ricwo @erohmensing I am ok with changing it, What is your opinion?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chkoss yes but this is a separate functionality and should probably be controlled with a different command-line argument, something like --assign-random-conversation-id

@VictorCoCo your initial implementation assigned a random user ID with every new shell session, and made it impossible to use a deterministic one. being able to define a conversation ID as a command-line argument and having the script choose a random one are two separate issues. whatever the default behaviour, there needs to remain the possibility of a deterministic conversation ID

@degiz degiz added this to the Rasa 1.8 milestone Feb 20, 2020
@tmbo
Copy link
Member

tmbo commented Feb 21, 2020

@VictorCoCo we'd love to make this part of the next release next week. Regarding the discussion, I think we should be consistent. By default we should generate a random id. If the user wants to use a specifc one, they can use --conversation-id to set it. (https://github.com/RasaHQ/rasa/pull/5243/files).

Do you mind changing that? Otherwise the PR looks great and we are ready to merge 🚀

@tmbo tmbo dismissed ricwo’s stale review February 21, 2020 10:11

inconsistend API, needs to be fixed before merge

@VictorCoCo
Copy link
Contributor Author

@VictorCoCo we'd love to make this part of the next release next week. Regarding the discussion, I think we should be consistent. By default we should generate a random id. If the user wants to use a specifc one, they can use --conversation-id to set it. (https://github.com/RasaHQ/rasa/pull/5243/files).

Do you mind changing that? Otherwise the PR looks great and we are ready to merge 🚀

Great decision. I will make the changes until Monday.

@tmbo
Copy link
Member

tmbo commented Feb 21, 2020

Perfect - we'll cut the release on Tuesday so Monday sounds great. Please shoot me a message once you are ready 🙂

@VictorCoCo VictorCoCo requested a review from tmbo February 23, 2020 17:17
Copy link
Member

@tmbo tmbo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great work @VictorCoCo thanks a lot for jumping on this and getting the change ready to be merged 🚀

@tmbo tmbo merged commit 1240405 into RasaHQ:master Feb 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants