fix: FakeBus does not fold the default session on receive#395
Conversation
on_message re-introduces the 'default' guard that the real MessageBusClient.on_message keeps (line 263): the default session is never folded on receive — only the explicit ovos.session.update_default broadcast updates it. Commit 9317a8d / #393 dropped that guard claiming to 'match the real MessageBusClient', but the real bus still guards the default id. Folding a stale token-less default snapshot back over the SessionManager singleton on every received message wipes in-place add_context mutations, regressing intent-layer gating: the activate_layer() context token is injected by handle_add_context then immediately discarded by the next message's fold, so gated intents never match. Restoring the guard makes FakeBus match production again (production never wipes, so layer gating works there) and un-breaks the ovos-workshop intent-layers e2e suite that XFAILed after 9317a8d landed.
|
Important Review skippedDraft detected. 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 |
Beep boop! The automated check sequence is complete. 🦾I've aggregated the results of the automated checks for this PR below. 📋 Repo HealthI've performed a health check on the project. 🏥 ✅ All required files present. Latest Version: ✅ 🔍 LintA quick update on the status of your PR. 🔔 ❌ ruff: issues found — see job log 🔒 Security (pip-audit)I've checked the security of our build pipeline. 🏗️ ✅ No known vulnerabilities found (47 packages scanned). ⚖️ License CheckScanning for any 'no-derivatives' clauses. 🚫 ✅ No license violations found. Policy: Apache 2.0 (universal donor). StrongCopyleft / NetworkCopyleft / WeakCopyleft / Other / Error categories fail. MPL allowed. 🏷️ Release PreviewI've checked the countdown clock for the next release. ⏰ Current:
✅ PR title follows conventional commit format. 🚀 Release Channel Compatibility Predicted next version:
📊 CoverageEnsuring our tests aren't missing a beat. 🥁 ✅ 85.1% total coverage Files below 80% coverage (5 files)
Full report: download the 🔨 Build TestsThe build report has been filed and is ready. 📁 ✅ All versions pass
The automation never sleeps, but I might reboot. 💤 |
… pins Root cause of the intent-layers e2e XFAILs is an upstream regression in ovos-utils (#393 / 9317a8d): FakeBus.on_message dropped the 'if sess.session_id != "default"' guard that the real MessageBusClient.on_message still keeps, so the default session is folded on every received message, wiping every in-place add_context mutation (intent-layer tokens included). Fixed in OpenVoiceOS/ovos-utils#395. - test_intent_layers_e2e.py: revert the xfail markers added in this PR; both tests pass once ovos-utils >= 0.13.3a2 lands. - test_base.py: replace test_on_event_end_is_intent_still_emits_utterance_handled (stale vs PIPELINE-1 §9.5) with two deterministic branches: * _defers_utterance_handled_to_core — modern core (>=2.3.0a1) owns the end-marker, so workshop must NOT also emit ovos.utterance.handled. * _emits_utterance_handled_legacy — absent/old core, workshop still emits (migration-window back-compat). Both monkeypatch _core_owns_utterance_handled. - pyproject.toml: bump floors to the latest alphas that carry the singleton-registry SessionManager + §9.5 orchestrator ownership: ovos-utils >= 0.13.3a2, ovos_bus_client >= 2.6.2a2, ovos-spec-tools >= 1.2.3a1, ovos-core >= 2.4.0a1 (test), ovos-adapt-parser >= 1.4.2a1 (test).
|
Withdrawn — restoring the |
Restores the
if sess.session_id != "default"guard inFakeBus.on_message/AsyncFakeBus.on_messagethat #393 (commit9317a8d) dropped.Root cause
#393's message claimed to match the real
MessageBusClient, but the realMessageBusClient.on_messagestill guards the default id (ovos-bus-client 2.6.2a2, line 263):Only the explicit
ovos.session.update_defaultbroadcast updates the default session. By dropping the guard, FakeBus diverged from production and folds the default session on every received message, wholesale-replacing the singleton'scontextwith the incoming message's (pre-mutation) snapshot viaSession.update_from.This silently wipes every in-place
add_contextmutation the instant the next message is received —handle_add_contextinjects the token into the singleton'scontext, and FakeBus'semitthen runson_messageon the sameadd_contextmessage, folding its own pre-injection (token-less) snapshot back over the singleton.What it breaks
Intent-layer gating (ovos-workshop
IntentLayers, refactored to context-gating in OpenVoiceOS/ovos-workshop#427).activate_layer()callsset_context()->add_context->handle_add_contextinjects thelayer_<name>token -> the very next emitted message folds a token-less default session snapshot and discards it -> gated intents never match. The twotest_intent_layers_e2e.pytests started XFAILing right after9317a8dlanded (2026-06-29), inside the same singleton-registry refactor window as ovos-bus-client 2.6.2a1/a2.Fix
Restore the guard so FakeBus matches the real bus: the default session is never folded on receive. Verified locally:
and the full
ovos-workshop/test/unittests/skills/test_intent_layers_e2e.pysuite passes (both tests, previously XFAIL).Production is unaffected (the real bus already guarded) — this is purely a test-harness divergence regression. No behavior change for non-default sessions.
🤖 Generated with Claude Code