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

ATO 678 missing slot set event on a custom action filled slot #12314

Conversation

vcidst
Copy link
Contributor

@vcidst vcidst commented Apr 21, 2023

Proposed changes:

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)

@vcidst vcidst requested a review from ancalita April 21, 2023 14:28
@vcidst vcidst requested a review from a team as a code owner April 21, 2023 14:28
@vcidst vcidst changed the base branch from main to 3.5.x April 21, 2023 14:28
@@ -0,0 +1 @@
`SlotSet` events will be emitted when the value set by the custom action is the same as the existing value.
Copy link
Member

Choose a reason for hiding this comment

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

I'd give more context that this case needs to be handled to allow the AugMemo Policy to function properly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, I've added this context to the changelog

Copy link
Member

@ancalita ancalita left a comment

Choose a reason for hiding this comment

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

Regarding the failures in the CI - you will need to adapt this test to include the duplicate SlotSet event now that the code doesn't prevent this from being added to the tracker.

I'd also recommend going a bit beyond the existing unit test you added and creating a regression test that trains an agent that uses AugMemo policy in its config to check that the agent behaves as expected (similar to the scenario in the ticket description for example).

changelog/12314.bugfix.md Outdated Show resolved Hide resolved
tests/core/test_actions.py Show resolved Hide resolved
vcidst and others added 5 commits April 25, 2023 12:59
Co-authored-by: Anca Lita <27920906+ancalita@users.noreply.github.com>
…filled-slot' of github.com:RasaHQ/rasa into ATO-678-jpmc-missing-slot-set-event-on-a-custom-action-filled-slot
@sonarcloud
Copy link

sonarcloud bot commented Apr 26, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@vcidst vcidst changed the title ATO 678 [JPMC] missing slot set event on a custom action filled slot ATO 678 missing slot set event on a custom action filled slot May 2, 2023
Comment on lines 74 to 104
# Check that the bot asks for the type of RSA token
with aioresponses() as mocked:
mocked.post(
action_server_url,
payload={
"events": [
{
"event": "slot",
"name": "rsa_token",
"value": "unknown",
}
],
"responses": [],
},
)

# Send the first message
await agent.handle_message(
_build_user_message(output_channel, "help me install a rsa token")
)
await remote_action.run(
CollectingOutputChannel(),
TemplatedNaturalLanguageGenerator(domain.responses),
tracker,
domain,
)

assert output_channel.messages[-1] == {
"recipient_id": SENDER,
"text": "What type of rsa token do you need?",
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ancalita Can you please help me figure out what's wrong here? The assertion fails with,

FAILED tests/regressions/test_action_extract_slots_12314.py::test_setting_slot_with_custom_action - AssertionError: assert {'recipient_i...type of None'} == {'recipient_i...do you need?'}
  Omitting 1 identical items, use -vv to show
  Differing items:
  {'text': 'User has requested rsa token type of None'} != {'text': 'What type of rsa token do you need?'}
  Full diff:
  - {'recipient_id': 'sender', 'text': 'What type of rsa token do you need?'}
  ?                                     ^   ---- ^^^           ^ ^^ --  ---
  + {'recipient_id': 'sender', 'text': 'User has requested rsa token type of None'}
  ?                                     ^^^^^  ++++++++  ^           ^^^^^ ^^^

The bot instead uttered 'User has requested rsa token type of None' this happens when the custom action specified in domain.yaml is not run.

Copy link
Member

Choose a reason for hiding this comment

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

I think what's needed is to specify to the agent its action_endpoint attribute:

agent.action_endpoint = endpoint

Then the agent can run the RemoteAction without you having to execute it in the test code. Hope that works 🤞🏻

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ancalita I tried that it still fails, do you have any other ideas?

Copy link
Member

Choose a reason for hiding this comment

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

Ah, I'm out of ideas, then maybe we can't test this without having a proper integration test with an instance of an action server running. I'd say this might require more effort, so if the manual tests validated the solution, let's not spend more time on the integration test, sorry for setting you on wild goose chase 😞

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ancalita I think this was a great idea but I'm not sure at this point how to make this test work. Can I mark it as flaky and keep it there with some TODO comments?

Copy link
Member

Choose a reason for hiding this comment

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

I think the flaky workflows have required status on main, so you'd have to comment out the failing assertions to prevent the test from failing. I also think that flaky marker doesn't describe this test well, because it always fails in current form 😄 Therefore I'd not add the flaky marker.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ancalita In that case, I've removed the regression tests from this PR. Can you please review it again?

Copy link
Member

Choose a reason for hiding this comment

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

Sure, could you also please add a ticket in Jira maintenance epic for writing up an integration test with an instance of the action server, linking to this PR? 🙏🏻

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I've added a ticket here: https://rasahq.atlassian.net/browse/ATO-1046

@github-actions
Copy link
Contributor

github-actions bot commented May 4, 2023

🚀 A preview of the docs have been deployed at the following URL: https://12314--rasahq-docs-rasa-v2.netlify.app/docs/rasa

Copy link
Member

@ancalita ancalita left a comment

Choose a reason for hiding this comment

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

🎉

@vcidst vcidst merged commit e2aa3e4 into 3.5.x May 8, 2023
@vcidst vcidst deleted the ATO-678-jpmc-missing-slot-set-event-on-a-custom-action-filled-slot branch May 8, 2023 11:22
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.

2 participants