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: handle missing self.wolfie #14

Merged
merged 9 commits into from
Aug 22, 2023
Merged

Conversation

mikejgray
Copy link
Contributor

@mikejgray mikejgray commented Aug 19, 2023

Fixes #13

  • Move to modern OVOS self.__init__() instead of classic Mycroft self.initialize() with create_skill() function
  • Add logging
  • Don't override base class parameter names
  • Add error handling where self.wolfie may not be instantiated
  • Remove references to Mycroft imports in favor of OVOS imports

Works on the Mark 1 Raspbian OVOS image!

ovos@mark1-dev:~ $ cat ~/.local/state/mycroft/skills.log | grep wolfie
2023-08-18 22:42:22.331 - skill-ovos-wolfie.openvoiceos - DEBUG - WolframAlpha query: what are the first 14 digits of pi
2023-08-18 22:42:23.335 - skill-ovos-wolfie.openvoiceos - DEBUG - [{'title': 'Nearby digits', 'summary': 'Nearby digits.\n3.1415926535897932384626433832795028841971693993751...'}, {'title': 'Digit counts', 'img': 'https://www6b3.wolframalpha.com/Calculate/MSP/MSP504023ha69396debcd4600003hbh1i4428d2af25?MSPStoreType=image/gif&s=14'}]
2023-08-18 22:42:23.335 - skill-ovos-wolfie.openvoiceos - DEBUG - WolframAlpha response: Nearby digits.
2023-08-18 22:42:23.353 - skills - ovos_core.intent_services.commonqa_service:handle_query_response:156 - INFO - Answer from skill-ovos-wolfie.openvoiceos
2023-08-18 22:42:23.359 - skills - ovos_core.intent_services.commonqa_service:_query_timeout:202 - INFO - Handling with: skill-ovos-wolfie.openvoiceos

@mikejgray mikejgray self-assigned this Aug 19, 2023
@mikejgray mikejgray requested a review from a team August 19, 2023 04:47
__init__.py Outdated
@@ -52,6 +53,7 @@ def __init__(self, *args, **kwargs):
'Scrabble score', # spammy
'Other notable uses' # spammy
]
self.initialize()
Copy link
Member

Choose a reason for hiding this comment

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

if this isnt called its a serious bug in core, it def should not be called manually

Copy link
Contributor Author

Choose a reason for hiding this comment

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

self.wolfie was None until I did this. Not sure if maybe a different exception was raised and swallowed but this got the code working on the Mark 1.

Choose a reason for hiding this comment

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

That’s weird. Surely it’d happen to every skill and not just Wolfie. Have you guys tried diffing the boilerplate part against another skill?

Choose a reason for hiding this comment

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

Oh, I see, it was using the old imports. This might be a hassle to chase down.

To clarify, was it None when it imported from Mycroft.skill, after the change to ovos.util, or both?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Both, so far as I could tell. I haven't done any testing to back this up yet, but do we know for sure that this isn't a regression in core? I've seen a lot of skills just not working properly recently. Of the default skills in the RaspOvos image, how many are still using the Mycroft-style initialize?

Copy link
Contributor Author

@mikejgray mikejgray Aug 19, 2023

Choose a reason for hiding this comment

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

ovos-skill-date-time                 0.2.3a5 initialize, no create_skill()
ovos-skill-fallback-unknown          0.0.4a1 no initialize
ovos-skill-hello-world               0.0.4a3 no initialize
ovos-skill-naptime                   0.2.3a1 initialize, no create_skill(), also not working as expected
ovos-skill-personal                  0.0.4a2 no initialize
ovos-skill-somafm                    0.0.2 no initialize
ovos-skill-stop                      0.3.0a4 no initialize
ovos-skill-volume                    0.0.2a3 no initialize
ovos-skill-weather                   0.0.1a13 initialize, no create_skill()
skill-ddg                            0.0.2 no initialize
skill-news                           0.0.4a2 no initialize
skill-ovos-dictation                 0.0.0a1 initialize, no create_skill(), single property
skill-wikipedia-for-humans           0.0.1 initialize, create_skill(), also not working (was going to try to fix this weekend)
skill-wolfie                         0.0.1 well, here we are (initialize and create_skill())
skill-youtube-music                  0.0.1 no initialize
neon-skill-alerts                    1.2.0 initialize, no create_skill()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Again, no data to back it up yet, but the skills I've seen with problems right now use both self.initialize() and have a create_skill() function. The rest don't. That's probably where I'll start looking for additional data points.

@mikejgray
Copy link
Contributor Author

I removed create_skill() and self.wolfie did not initialize, but that's probably not surprising - I'd imagine you need to call it from create_skill() before it uses self.initialize():

2023-08-19 08:37:29.499 - skill-ovos-wolfie.openvoiceos - DEBUG - WolframAlpha query: what are the first 14 digits of pi
2023-08-19 08:37:29.499 - skill-ovos-wolfie.openvoiceos - ERROR - WolframAlphaSkill not initialized, no response

@mikejgray
Copy link
Contributor Author

As expected, removing initialize() altogether yields positive results:

2023-08-19 08:41:00.322 - skill-ovos-wolfie.openvoiceos - DEBUG - WolframAlpha response: Nearby digits.
3.1415926535897932384626433832795028841971693993751...
2023-08-19 08:41:00.341 - skills - ovos_core.intent_services.commonqa_service:handle_query_response:156 - INFO - Answer from skill-ovos-wolfie.openvoiceos
2023-08-19 08:41:00.346 - skills - ovos_core.intent_services.commonqa_service:_query_timeout:178 - INFO - Timeout occurred check responses
2023-08-19 08:41:00.351 - skills - ovos_core.intent_services.commonqa_service:_query_timeout:202 - INFO - Handling with: skill-ovos-wolfie.openvoiceos

@mikejgray
Copy link
Contributor Author

Going back to the Mycroft-style initialize returns to the buggy behavior I first reported:

2023-08-19 08:44:02.879 - skills - ovos_workshop.skill_launcher:load:528 - INFO - ATTEMPTING TO LOAD PLUGIN SKILL: skill-ovos-wolfie.openvoiceos
2023-08-19 08:44:02.884 - skill-ovos-wolfie.openvoiceos - DEBUG - initializing skill settings for skill-ovos-wolfie.openvoiceos
2023-08-19 08:44:02.903 - skills - ovos_utils.events:add:161 - DEBUG - Added event: skill-ovos-wolfie.openvoiceos.activate
2023-08-19 08:44:02.907 - skills - ovos_utils.events:add:161 - DEBUG - Added event: skill-ovos-wolfie.openvoiceos.deactivate
2023-08-19 08:44:03.082 - skills - ovos_utils.events:add:161 - DEBUG - Added event: skill-ovos-wolfie.openvoiceos:WolfieMore
2023-08-19 08:44:03.099 - skills - ovos_utils.events:add:161 - DEBUG - Added event: skill-ovos-wolfie.openvoiceos:search_wolfie.intent
2023-08-19 08:44:03.223 - skills - ovos_workshop.skill_launcher:_communicate_load_status:506 - INFO - Skill skill-ovos-wolfie.openvoiceos loaded successfully
2023-08-19 08:44:10.511 - skills - ovos_core.intent_services.padatious_service:_register_object:298 - DEBUG - Registering Padatious intent: skill-ovos-wolfie.openvoiceos:search_wolfie.intent
2023-08-19 08:44:35.419 - skills - ovos_core.skill_manager:_handle_settings_file_change:141 - INFO - skill settings.json change detected for skill-ovos-wolfie.openvoiceos
2023-08-19 08:44:35.536 - skill-ovos-wolfie.openvoiceos - DEBUG - WolframAlpha query: what are the first 14 digits of pi
2023-08-19 08:44:35.548 - skill-ovos-wolfie.openvoiceos - ERROR - WolframAlphaSkill not initialized, no response

@ChanceNCounter
Copy link

Adding all hands

@JarbasAl JarbasAl added the bug Something isn't working label Aug 22, 2023
@JarbasAl JarbasAl merged commit 46a6717 into OpenVoiceOS:dev Aug 22, 2023
1 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

improve handling where NoneType may be returned
3 participants