The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(plugins): exempt every guard-excluded dir from the symlinked-user-file refusal
kshitijk4poor7be3b39931d9
diff --git a/hermes_cli/plugins_cmd_catalog.py b/hermes_cli/plugins_cmd_catalog.pyindex 4b0bd400527..a7ddbb40779 100644--- a/hermes_cli/plugins_cmd_catalog.py+++ b/hermes_cli/plugins_cmd_catalog.py@@ -362,6 +362,7 @@ def _carry_user_files(old: Path, new: Path, local: Optional[list[str]]) -> list[Returns the carried paths (POSIX, relative to the tree) so a later scan block can name them."""from hermes_cli.plugins_cmd import PluginOperationError+ from tools.plugin_guard import EXCLUDED_DIRSkeep = {Path(rel) for rel in local or ()}linked: list[str] = []@@ -370,8 +371,9 @@ def _carry_user_files(old: Path, new: Path, local: Optional[list[str]]) -> list[def _user_link(rel: Path) -> None:# Git-owned user state that is a symlink is refused, never followed: a link injected after the# installer's scan could point outside the plugin root past the guard (which skips links).- # Links under node_modules/ are reproducible install artefacts (.bin shims), not user state.- if local is not None and not keep.isdisjoint((rel, *rel.parents)) and "node_modules" not in rel.parts:+ # Links under the guard's excluded dirs (node_modules/.bin shims, .venv/bin/python) are+ # reproducible install artefacts, not user state.+ if local is not None and not keep.isdisjoint((rel, *rel.parents)) and EXCLUDED_DIRS.isdisjoint(rel.parts):linked.append(rel.as_posix())def _walk_error(exc: OSError) -> None:diff --git a/tests/hermes_cli/test_plugins_cmd_catalog.py b/tests/hermes_cli/test_plugins_cmd_catalog.pyindex a1d52a86126..06c0a47b6a3 100644--- a/tests/hermes_cli/test_plugins_cmd_catalog.py+++ b/tests/hermes_cli/test_plugins_cmd_catalog.py@@ -264,13 +264,16 @@ def test_update_of_a_subdir_install_keeps_files_the_user_created_or_edited(worlddef test_repin_keeps_a_wholly_ignored_data_dir_in_a_git_checkout(world):"""A single ``!! data/`` status entry must preserve every file below that ignored directory."""repo = world["repo"]- (repo / ".gitignore").write_text("data/\n")+ (repo / ".gitignore").write_text("data/\n.venv/\n")world["state"]["pin"] = _commit(repo, "ignore data")target = cat.install_catalog_entry(pc_cat.get_live_catalog_entry("cat-plugin"), force=False)[0]assert (target / ".git").exists()(target / "data" / "db").mkdir(parents=True)(target / "data" / "db" / "index.db").write_text("user data")+ # An ignored venv always holds symlinks (bin/python); it is a reproducible artefact, not user state.+ (target / ".venv" / "bin").mkdir(parents=True)+ (target / ".venv" / "bin" / "python").symlink_to("/usr/bin/python3")(repo / "__init__.py").write_text("def register(ctx):\n pass # v3\n")world["state"]["pin"] = _commit(repo, "v3")