StopService: wrap handlers in HandlerLifecycle instead of ad-hoc emission#796
Conversation
Replace rudimentary manual emission of both UTTERANCE_HANDLED (which the orchestrator now owns via IntentDispatcher._notify_terminal) and mycroft.skill.handler.complete with the canonical HandlerLifecycle context manager from ovos-bus-client. HandlerLifecycle consistently emits the full handler-lifecycle trio (start/complete/error) so that the dispatcher can properly track in-flight entries and fire §9.5 UTTERANCE_HANDLED at the right moment. Co-Authored-By: Claude
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Standard verification protocol finished. 📋I've aggregated the results of the automated checks for this PR below. 🏷️ Release PreviewThe release candidate is looking strong. 💪 Current:
🚀 Release Channel Compatibility Predicted next version:
📋 Repo HealthI've checked the repo's strength (aka test suite robustness). 🏋️♂️ ✅ All required files present. Latest Version: ✅ 🔎 Type CheckHere's the report you've been waiting for. 📁 ❌ mypy: 250 error(s) found
Errors (showing first 10/250)🔒 Security (pip-audit)Checking for any potential security breaches. 🔓 ✅ No known vulnerabilities found (110 packages scanned). 📊 CoverageScanning for any 'untested' alerts! 🚨 Files below 80% coverage (8 files)
Full report: download the 🔌 Plugin DetectionChecking if the plugin meets our contribution guidelines. ✅ Plugin Info:
OPM Detection:
Entry Point Validation:
⊘ No Issues:
🔨 Build TestsI've put your code through the build grinder. ☕
❌ 3.10: Install OK, tests failed ⚖️ License CheckLegal eagle here! Checking those licenses. ⚖️ ✅ No license violations found. Policy: Apache 2.0 (universal donor). StrongCopyleft / NetworkCopyleft / WeakCopyleft / Other / Error categories fail. MPL allowed. 📚 DocsProcessing complete! Details follow. 📬 ✅ All required documentation files present. ✅ 🌍 Locale BuildChecking if there's anything else we need to do. 📋 ✅ Locale properly configured (64 files, 17 languages) Locale directories found:
Localization coverage:
pyproject.toml: ✅
Build manifest: ✅ 31 locale files included in package 🔌 Skill Tests (ovoscope)I've put the skill through its paces with live intent matching. 🏃 ❌ 2/36 passed, 17 failed ❌ **TestAdaptIntent** — 0/4
❌ **TestCancelIntentMidSentence** — 0/1
❌ **TestConverse** — 0/1
❌ **TestCountSkills** — 0/4
❌ **TestDeactivate** — 2/3
❌ **TestFallback** — 0/1
❌ **TestGlobalStopVocWithActiveSkill** — 0/1
❌ **TestGlobalStopVocabulary** — 0/2
❌ **TestIntentPipelineRouting** — 0/4
❌ **TestLangDisambiguation** — 0/4
❌ **TestNoSkills** — 0/2
❌ **TestPadatiousIntent** — 0/4
❌ **TestStopNoSkills** — 0/3
❌ **TestStopServiceAsSkill** — 0/1
❌ **TestStopSkillCanHandleFalse** — 0/1
🚌 Bus CoverageQuantifying the invisible connections in your code. 💪 🔴 Coverage Summary
📊 Per-Skill Breakdown
🔍 Detailed Message Type Breakdown
|
Same pattern as StopService — handle_converse is called via bus event dispatch after the converse pipeline stage matches, but had no lifecycle signalling. Without it the dispatcher's in-flight entry for converse dispatches would only ever resolve on timeout (10s). Co-Authored-By: Claude
test_handle_global_stop_emits_mycroft_stop: check for mycroft.skill.handler.start/complete instead of ovos.utterance.handled. test_handle_skill_stop_forwards_to_skill: HandlerLifecycle emits 3 messages (start, forward, complete), not 1. Co-Authored-By: Claude
Added assertions to check for 'mycroft.stop' and 'ovos.utterance.handled' messages in stop service tests.
StopService wraps its global/skill stop handlers in HandlerLifecycle (#796), so the legacy mycroft.skill.handler.{start,complete} done-signal now brackets mycroft.stop / {skill_id}.stop. Update the stop expectations to assert the trio. The ping-pong tests built the stop message from a stale, test-local Session that never saw the count skill's server-side self-activation (the count message, serialized before activation, folds an empty active_skills back into the singleton — correct SESSION-1 last-write-wins). Resend the live singleton session for the stop turn, as a real client tracking responses would, instead of manually activating — so the running skill is in active_skills and the ping-pong path runs without a manual activate crutch. Also drop the §8 ovos.intent.handler.complete from the expected lists where it is filtered via ignore_messages. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Summary
Replace rudimentary manual emission of lifecycle events (both the
UTTERANCE_HANDLEDthat the orchestrator now owns and the missingmycroft.skill.handler.*trio) with the canonicalHandlerLifecyclecontext manager fromovos-bus-client.The
HandlerLifecyclecontext manager consistently emits the full handler-lifecycle trio (start/complete/error) so that the dispatcher can properly track in-flight entries and fire §9.5UTTERANCE_HANDLEDat the right moment — instead of waiting for the handler timeout.Changes
StopService (
stop_service.py)message.forward(\"ovos.utterance.handled\")fromhandle_global_stop— the orchestrator's dispatcher emits the §9.5 end-markerhandle_global_stopandhandle_skill_stopinHandlerLifecycleConverseService (
converse_service.py)handle_converseinHandlerLifecycle— same self-handling pattern as StopService (pipeline match → bus event dispatch → self-handled), but was missing lifecycle signalling entirely, causing converse dispatches to only resolve on timeoutOther pipeline plugins
FallbackServicedoes not need this — it does not self-handle itsmatch_type(skills listen forovos.skills.fallback.{skill_id}.requestdirectly via workshop's automatic lifecycle wrapping).