Skip to content

fix: dispatch ChatEngine.continue_chat with keyword arguments - #429

Draft
JarbasAl wants to merge 1 commit into
devfrom
fix/chatengine-tools-kwdispatch
Draft

fix: dispatch ChatEngine.continue_chat with keyword arguments#429
JarbasAl wants to merge 1 commit into
devfrom
fix/chatengine-tools-kwdispatch

Conversation

@JarbasAl

Copy link
Copy Markdown
Member

🤖 Auto-generated by Claude Sonnet 5 (claude-sonnet-5) via Claude Code — NOT human-reviewed. Verify before acting.

ChatEngine's base wrappers (stream_tokens, stream_sentences, and MultimodalChatEngine.stream_chat) called self.continue_chat(messages, session_id, lang, units) positionally. That positional call is why plugins whose continue_chat override dropped the tools parameter never crashed: nothing in the base class ever passed tools positionally. The break only shows up when a caller passes tools= by keyword, which is exactly what ovos-persona-server's server-side tool loop does, and by then the failure surfaces far from the plugin that is actually non-conforming.

This PR switches those three wrappers to keyword dispatch (messages=, session_id=, lang=, units=), so any subclass whose continue_chat signature diverges from the base is exercised the same way real callers exercise it, instead of being shielded by argument order.

It also adds a ChatEngine.init_subclass check that inspects the subclass's continue_chat signature with inspect.signature at class-definition time. If the override names neither a tools parameter nor **kwargs, it logs a warning once per class, naming the class and the fix. It deliberately only warns and never raises: turning a degraded plugin into an import-time crash would take down an entire install over a single non-conforming plugin, which is worse than the silent-hiding problem this PR is fixing.

Tests cover a conforming subclass (names tools) producing no warning, a non-conforming subclass producing exactly one warning naming the class, a **kwargs subclass producing no warning, and the three base wrappers dispatching with the expected keyword arguments. Reverting only the source change and re-running the new tests makes test_non_conforming_subclass_warns_once fail with "Expected 'warning' to have been called once. Called 0 times."; restoring the fix makes it and the rest of test_agents.py (72 tests) pass. The full suite runs 970 passed, 49 skipped, with 10 pre-existing failures in test_hardware.py caused by an unrelated ovos_color_parser/ovos_hardware_helpers version mismatch in the test environment, unaffected by this change.

Base ChatEngine wrappers (stream_tokens, stream_sentences,
MultimodalChatEngine.stream_chat) called continue_chat positionally,
so a subclass whose override dropped the `tools` parameter never
crashed - nothing ever passed `tools` positionally. It only breaks
when a caller passes tools= by keyword, as ovos-persona-server's
server-side tool loop does. Switching those wrappers to keyword
dispatch stops the divergent signature from hiding.

Also add a ChatEngine.__init_subclass__ check that inspects the
subclass's continue_chat signature via inspect.signature and emits a
single LOG.warning per class (never a raise - a degraded plugin must
not crash an entire install) when it names neither `tools` nor
**kwargs.

Fail-before: reverting only the source change (keeping the new
tests) makes test_non_conforming_subclass_warns_once fail with
"Expected 'warning' to have been called once. Called 0 times."
Restoring the fix makes it and the rest of test_agents.py (72 tests)
pass.

Full suite: 970 passed, 49 skipped; 10 pre-existing failures in
test_hardware.py from an unrelated ovos_color_parser/ovos_hardware_helpers
version mismatch in the environment, unaffected by this change.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 5aecae1f-b5ff-495e-982a-e0042bd2e056

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the fix label Aug 14, 2026
@github-actions

github-actions Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

I've gathered some intelligence on your latest changes. 🕵️‍♀️

I've aggregated the results of the automated checks for this PR below.

📋 Repo Health

Checking if we're following maintenance best practices. 📏

✅ All required files present.

Latest Version: 2.11.1a2

ovos_plugin_manager/version.py — Version file
README.md — README
LICENSE — License file
pyproject.toml — pyproject.toml
⚠️ setup.py — setup.py
CHANGELOG.md — Changelog
ovos_plugin_manager/version.py has valid version block markers

⚖️ License Check

Evaluating the impact of these changes on our licensing. 📈

✅ No license violations found.

Policy: Apache 2.0 (universal donor). StrongCopyleft / NetworkCopyleft / WeakCopyleft / Other / Error categories fail. MPL allowed.

🔒 Security (pip-audit)

Security report: No threats detected in the area. ✅

✅ No known vulnerabilities found (65 packages scanned).

🔨 Build Tests

The build is complete. No hard hats required. 👷‍♂️

Python Build Install Tests
3.10 ⚠️
3.11 ⚠️
3.12 ⚠️
3.13 ⚠️
3.14 ⚠️

❌ 3.10: Install OK, tests failed
❌ 3.11: Install OK, tests failed
❌ 3.12: Install OK, tests failed
❌ 3.13: Install OK, tests failed
❌ 3.14: Install OK, tests failed
Check job logs for details.

📊 Coverage

Quantifying the invisible strength of your code. 💪

82.7% total coverage

⚠️ Some tests failed — coverage figures may be incomplete.

Files below 80% coverage (23 files)
File Coverage Missing lines
ovos_plugin_manager/utils/audio.py 27.0% 65
ovos_plugin_manager/templates/embeddings.py 27.5% 187
ovos_plugin_manager/hardware/__init__.py 31.6% 13
ovos_plugin_manager/__init__.py 33.3% 4
ovos_plugin_manager/templates/gui.py 39.0% 25
ovos_plugin_manager/audio.py 40.5% 22
ovos_plugin_manager/templates/language.py 58.0% 21
ovos_plugin_manager/audio2ipa.py 58.1% 13
ovos_plugin_manager/gui.py 62.5% 15
ovos_plugin_manager/postag.py 63.0% 17
ovos_plugin_manager/segmentation.py 63.0% 17
ovos_plugin_manager/tokenization.py 63.0% 17
ovos_plugin_manager/templates/solvers.py 68.7% 82
ovos_plugin_manager/coreference.py 69.2% 16
ovos_plugin_manager/plugin_entry.py 69.5% 46
ovos_plugin_manager/templates/ocp.py 72.2% 5
ovos_plugin_manager/templates/segmentation.py 73.7% 5
ovos_plugin_manager/templates/audio2ipa.py 75.0% 3
ovos_plugin_manager/templates/postag.py 75.0% 5
ovos_plugin_manager/media_provider.py 75.7% 9
ovos_plugin_manager/templates/hotwords.py 77.4% 7
ovos_plugin_manager/persona.py 77.8% 2
ovos_plugin_manager/templates/keywords.py 78.9% 4

Full report: download the coverage-report artifact.

🔍 Lint

The automated checks have finished their work. 🏁

ruff: issues found — see job log

🏷️ Release Preview

Setting the stage for the upcoming deployment. 🎭

Current: 2.11.1a2Next: 2.11.2a1

Signal Value
Label (none)
PR title fix: dispatch ChatEngine.continue_chat with keyword arguments
Bump build

✅ PR title follows conventional commit format.


🚀 Release Channel Compatibility

Predicted next version: 2.11.2a1

Channel Status Note Current Constraint
Stable Too new (must be <0.10.0) ovos-plugin-manager>=0.9.0,<0.10.0
Testing Compatible ovos-plugin-manager>=1.0.3,<3.0.0
Alpha Compatible ovos-plugin-manager>=2.11.1a2

Making code review just a little bit easier. 💆‍♂️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant