Repository navigation
fix: echo the hub's session back so get_response follow-ups work - #312
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
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 |
I've completed the automated review of your changes. 📑I've aggregated the results of the automated checks for this PR below. 🔍 LintThe latest check report is now ready. 📝 ❌ ruff: issues found in 85 file(s) — see job log ⚖️ License CheckI've audited the copyright holders list. 👥 ✅ No license violations found. Policy: Apache 2.0 (universal donor). StrongCopyleft / NetworkCopyleft / WeakCopyleft / Other / Error categories fail. MPL allowed. 📋 Repo HealthChecking for any cluttered files or folders. 🧹 ✅ All required files present. Latest Version: ✅ 🏷️ Release PreviewI've checked the 'New Features' highlight reel. 📽️ Current:
✅ PR title follows conventional commit format. 🚀 Release Channel Compatibility Predicted next version:
🔒 Security (pip-audit)Scanning for any potential SQL injection points. 💉 ✅ No known vulnerabilities found (67 packages scanned). 📊 CoverageCoverage report incoming! Every line counts. 🎯 ✅ 85.1% total coverage Files below 80% coverage (6 files)
Full report: download the 🔨 Build TestsChecking the blueprint against the actual construction. 📐 ✅ All versions pass
Catch you at the next merge! 🌊 |
…ups work The hub returns the session on its replies, with response_mode while a skill waits for an answer. HiveMessageBusClient.emit sent only session_id and site_id on the next utterance, so ovos-core had lost the pending response and the answer went unmatched (silent on the terminal, error sound on HiveMind-voice-sat). The client now keeps the state-record fields of an inbound BUS frame whose session_id is the client's own (active_handlers, converse_handlers, response_mode, intent_context; OVOS-SESSION-1 §2.1), read before the client's own bus stamps default session fields onto the frame. emit sends them with session_id and the client's site_id on a BUS message that has no session. Override fields the hub returned (pipeline, blacklisted_*) are not kept, so an operator change reaches the next utterance. A response_mode whose expires_at has passed is not sent (OVOS-CONVERSE-1 §2.2). A caller-set session is never replaced and another session_id is never adopted. Fail-before: on the previous commit, 3 of the 12 tests in tests/test_session_echo.py fail (a returned pipeline and blacklisted_skills are sent again, and an expired response_mode is sent); on dev, 3 of the earlier 8 fail with KeyError 'response_mode'. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
712fc1f to
61ce578
Compare
This makes
HiveMessageBusClient.emitsend back the session state the hub returned, so a follow-up answer to aget_responsequestion reaches ovos-core with its pending-response state. Without it the answer is unmatched:hivemind-client terminalprints nothing and HiveMind-voice-sat plays the error sound.Governing clauses, verbatim.
HIVEMIND-BRIDGE-1 §4.2: "The session a server returns in a reply is therefore the session the peer sends in its next message. The rules of this section reach a value the peer originates; the server's own value coming back is the mechanism those clauses prescribe, and the server keeps it." The same section says: "The server MUST keep its own value for a node-owned field, and MUST NOT adopt a value a peer declared for it."
OVOS-SESSION-1 §2.1: "State-record fields — fields that record state accumulated within the session rather than a preference over deployment configuration:
active_handlers(OVOS-PIPELINE-1 §7.1),converse_handlersandresponse_mode(OVOS-CONVERSE-1 §2.1, §2.2),intent_context(OVOS-CONTEXT-1 §2). There is no deployment default to fall back to".OVOS-SESSION-2 §3.2: "A client MAY adopt incrementally from Messages observed mid-round, and MAY run a more elaborate policy (field-by-field merge, selecting by emitter identity). Both are conformant".
OVOS-CONVERSE-1 §2.2: "Once passed, the entry is inert — no delivery ever happens from it (§5.2)".
What changed: when an inbound BUS frame carries a session whose
session_idis this client's own, the client keeps only the state-record fields (active_handlers,converse_handlers,response_mode,intent_context) ashub_session, with its ownsession_idandsite_id.emitsendshub_sessionon a BUS message that has no session. It drops aresponse_modewhoseexpires_athas passed. Override fields such aspipelineandblacklisted_skillsare not kept, so an operator change on the hub reaches the satellite on its next utterance. A session the caller set is never replaced, and a session for another id is never adopted. The carrier is read from the frame before the client's own bus stamps its default session onto it.Tests:
tests/test_session_echo.pybinds the protocol the way the terminal and the satellite do and feeds the client a hub reply. Four tests are new: a returnedpipelineandblacklisted_skillsare not sent again (the test asserts the exact set of outgoing session keys), the other state-record fields are sent again with their values, and an expiredresponse_modeis not sent, whether it expired before or between turns. On the previous commit, 3 of the 12 tests in the file fail; they pass now. On dev, 3 of the earlier 8 fail. The full suite withtests/e2egives 1120 passed, 4 skipped.Live run with hivemind-core 5.3.4a1, hivemind-ovos-agent-plugin 0.5.1a1, ovos-core 3.7.4a1 and a
get_responseskill, using the realhivemind-client terminalon a pty. This branch answers the follow-up ("nice to meet you Miro" 0.3 s after typing). After the operator blacklists the skill and then allows it again between turns, this branch matches the skill on the next utterance. The earlier commit stays silent after the allow, because it keeps sending the old blacklist. An ovos-core restart in mid-question still leaves a staleresponse_modeinside its 300 s window, because ovos-core does not clear it on delivery (OVOS-CONVERSE-1 §5.2). That fix belongs in ovos-core.🤖 Generated with Claude Code