Old pre-decomposition import paths are gone: plugin compat layer removed on schedule (#126164)

* refactor(plugins): remove the Sep 2026 decomposition compat layer on schedule

The PLUGIN-COMPAT layer (2776813df3 + d63e380324 + 0a5164cebe) kept pre-#102117 import paths
alive for external plugins until 2026-09-14. That window closed two weeks ago; since then the loader
has already been skipping plugins that use the old paths. This removes the layer itself:

- 328 appended `PLUGIN-COMPAT` blocks (lazy `__getattr__` pointer tables, re-exported third-party
  names, restored dead definitions) and the three re-export stub modules
  (gateway/startup_watchdog, hermes_cli/observability/relay_runtime, tools/environments/modal_utils)
- COMPAT_MANIFEST.md, compat_manifest.json, scripts/check_compat_pointers.py and its lint step
- the reporting surfaces: CLI banner notice, `hermes plugins compat`, the `hermes doctor` section,
  the post-update notice, the Desktop one-time dialog, the loader's pre-import skip and the
  `plugins.allow_deprecated_imports` escape hatch

An external plugin that still imports an old path now fails to load with its ImportError as the
reason in `hermes plugins list`, the same path as any broken plugin.

hermes_cli/plugin_compat.py stays as three inert stubs (compat_report, removal_in_effect,
summary_lines): an already-running pre-removal `hermes update` lazy-imports them after the checkout
swap (tests/compat/old_updater_surface.json).

In-tree fallout, both already dead: hermes_cli/setup.py::_check_espeak_ng (no callers; its
`shutil` came from a compat block) and gateway/config.py::SessionResetPolicy ("retained solely for
the scheduled plugin-compat window"). Two test_run_agent patches targeted the removed
`run_agent.handle_function_call` pointer; they now patch `model_tools.handle_function_call`, the
seam production reads, like every sibling test in that file.

* chore: retrigger CI (zero-job startup_failure phantom)

* test: drop resolution allowlist rows for the two deleted which() sites

hermes_cli/setup.py::_check_espeak_ng (dead) and tools/skillevaluator_scan.py::scanner_available
(a restored definition inside a PLUGIN-COMPAT block) no longer exist; the stale-row gate requires
their allowlist entries go with them.
This commit is contained in:
Teknium
2026-09-28 10:21:41 -07:00
committed by GitHub
parent fe18e71863
commit a5bd246865
360 changed files with 36 additions and 27747 deletions

View File

@@ -1,111 +0,0 @@
#!/usr/bin/env python3
"""Fail when in-tree code depends on a plugin-compat pointer.
``compat_manifest.json`` lists every name the Sep 2026 decomposition kept importable from its OLD
module purely for external plugins (the `PLUGIN-COMPAT` blocks). Those blocks are removed on a
schedule by reverting the commit that added them, so nothing inside this repository may depend on
them — otherwise the revert breaks the tree. This check walks every first-party Python file (source
AND tests) and flags:
from <facade> import <compat_name> # direct import through the old path
import <facade>; <facade>.<compat_name> # attribute access through the old path
patch("<facade>.<compat_name>") / monkeypatch.setattr(<facade>, "<compat_name>")
Exit 1 with a file:line list on any hit. Run: python scripts/check_compat_pointers.py
"""
from __future__ import annotations
import ast
import json
import os
import re
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parent.parent
MANIFEST = ROOT / "compat_manifest.json"
DEPENDENCY_DIRS = {".git", ".venv", "venv", "node_modules", "__pycache__"}
ROOT_SKIP_DIRS = DEPENDENCY_DIRS | {
"website", "skills", "optional-skills", "apps", "evals", "build", "MagicMock", ".worktrees"
}
def _py_files():
def fail(error):
raise error
for directory, dirs, files in os.walk(ROOT, onerror=fail):
excluded = ROOT_SKIP_DIRS if Path(directory) == ROOT else DEPENDENCY_DIRS
dirs[:] = [name for name in dirs if name not in excluded and not name.startswith(".")]
for name in files:
if not name.endswith(".py") or name in {"check_compat_pointers.py", "test_compat_manifest_targets.py"}:
continue
yield Path(directory) / name
def main() -> int:
if not MANIFEST.exists():
print("compat_manifest.json missing — nothing to check (compat layer already reverted?)")
return 0
entries = json.loads(MANIFEST.read_text(encoding="utf-8-sig"))["entries"]
compat: dict[str, set[str]] = {}
for e in entries:
compat.setdefault(e["facade"], set()).add(e["name"])
facades = set(compat)
hits: list[str] = []
str_pat = re.compile(r"""["']((?:[A-Za-z_][\w]*\.)+[A-Za-z_]\w*)["']""")
for path in _py_files():
rel = path.relative_to(ROOT)
try:
src = path.read_text(encoding="utf-8-sig", errors="ignore")
tree = ast.parse(src)
except SyntaxError:
continue
# module-level facade import aliases in this file: alias -> facade
aliases: dict[str, str] = {}
for node in ast.walk(tree):
if isinstance(node, ast.ImportFrom) and node.module in facades and node.level == 0:
bad = [a.name for a in node.names if a.name in compat[node.module]]
for b in bad:
hits.append(f"{rel}:{node.lineno}: from {node.module} import {b}")
elif isinstance(node, ast.Import):
for a in node.names:
if a.name in facades:
aliases[a.asname or a.name] = a.name
elif isinstance(node, ast.ImportFrom) and node.level == 0 and node.module:
for a in node.names:
full = f"{node.module}.{a.name}"
if full in facades:
aliases[a.asname or a.name] = full
for node in ast.walk(tree):
if isinstance(node, ast.Attribute) and isinstance(node.value, ast.Name):
fac = aliases.get(node.value.id)
if fac and node.attr in compat[fac]:
hits.append(f"{rel}:{node.lineno}: {node.value.id}.{node.attr} (via {fac})")
elif isinstance(node, ast.Call):
# monkeypatch.setattr(<facade alias>, "<name>", ...) / patch.object(<facade alias>, "<name>")
fn = node.func
is_setattr = (isinstance(fn, ast.Attribute) and fn.attr in ("setattr", "delattr", "object")) or (
isinstance(fn, ast.Name) and fn.id in ("setattr", "delattr", "getattr", "hasattr"))
if is_setattr and len(node.args) >= 2 and isinstance(node.args[0], ast.Name) and isinstance(node.args[1], ast.Constant) and isinstance(node.args[1].value, str):
fac = aliases.get(node.args[0].id)
if fac and node.args[1].value in compat[fac]:
hits.append(f"{rel}:{node.lineno}: setattr/patch({node.args[0].id}, \"{node.args[1].value}\") (via {fac})")
elif isinstance(node, ast.Constant) and isinstance(node.value, str):
m = str_pat.fullmatch(node.value.strip())
if m:
dotted = m.group(1); fac, _, name = dotted.rpartition(".")
if fac in facades and name in compat[fac]:
hits.append(f"{rel}:{node.lineno}: \"{dotted}\" (string patch target)")
if hits:
print("❌ in-tree code depends on plugin-compat pointers (scheduled for removal):")
for h in sorted(set(hits)):
print(" " + h)
print(f"\n{len(set(hits))} site(s). Import from the defining module instead (see COMPAT_MANIFEST.md).")
return 1
print(f"✅ no in-tree dependency on the {len(entries)} plugin-compat pointers")
return 0
if __name__ == "__main__":
sys.exit(main())