The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(plugins): no core override check catches patch helpers that are methods
teknium13421f29d9be4
diff --git a/hermes_cli/plugin_validate_core_override.py b/hermes_cli/plugin_validate_core_override.pyindex 78f6ad5e32f..803b75f664a 100644--- a/hermes_cli/plugin_validate_core_override.py+++ b/hermes_cli/plugin_validate_core_override.py@@ -298,9 +298,9 @@ def core_override_findings(plugin_dir: Path) -> List[str]:for stmt in func.body for n in _walk_scope(stmt)):analysis.core_returners.add(func.name)params = [a.arg for a in func.args.posonlyargs + func.args.args]- for index, param in enumerate(params):- if index == 0 and is_method:- continue+ # A method is called as ``obj.bind(module, ...)``: its call-site args start after ``self``.+ offset = 1 if is_method else 0+ for index, param in enumerate(params[offset:]):if any(analysis.rebinds(n, {param}) for stmt in func.body for n in _walk_scope(stmt)):analysis.param_patchers.setdefault(func.name, set()).add(index)after = (len(analysis.core_returners), sum(len(v) for v in analysis.param_patchers.values()))diff --git a/tests/hermes_cli/test_plugin_validate.py b/tests/hermes_cli/test_plugin_validate.pyindex 49e10f06d74..0d374bade2e 100644--- a/tests/hermes_cli/test_plugin_validate.py+++ b/tests/hermes_cli/test_plugin_validate.py@@ -434,3 +434,19 @@ def test_runtime_rebind_of_hermes_core_fails_admission(tmp_path):"m._PROVIDER_MODELS[...] (__init__.py:11)",]assert core_override_findings(good) == []+++def test_core_override_through_a_method_patch_helper(tmp_path):+ """A patch helper on a class (``self._patches.bind(module, name, fn)``) is caught like a plain one."""+ bad = _make_plugin(tmp_path, manifest=dict(BASE_MANIFEST, name="bad"), init_py=(+ "from agent import auxiliary_client\n"+ "class Patches:\n"+ " def bind(self, target, name, fn):\n"+ " setattr(target, name, fn)\n"+ "def register(ctx):\n"+ " Patches().bind(auxiliary_client, '_relay_sync_stream', print)\n"+ ))++ from hermes_cli.plugin_validate_core_override import core_override_findings++ assert core_override_findings(bad) == ["bind(auxiliary_client, ...) (__init__.py:6)"]