The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(profiles): a copy of the setup profile no longer carries the setup toolsets
alt-glitch33c4494e2324
diff --git a/hermes_cli/profile_distribution.py b/hermes_cli/profile_distribution.pyindex 5089738bcba..4a37fa3898e 100644--- a/hermes_cli/profile_distribution.py+++ b/hermes_cli/profile_distribution.py@@ -572,8 +572,8 @@ def _copy_dist_payload(staged: Path, target: Path, manifest: DistributionManifes# Make sure the manifest on disk reflects resolved name + sourcewrite_manifest(target, manifest)- if any(rel_parts == (SETUP_PROFILE_MARKER,) for _, rel_parts in entries):- (target / SETUP_PROFILE_MARKER).unlink()+ from hermes_cli.setup_profile import release_setup_copy+ release_setup_copy(target, from_setup=any(rel_parts == (SETUP_PROFILE_MARKER,) for _, rel_parts in entries))def _bootstrap_user_dirs(target: Path) -> None:diff --git a/hermes_cli/profiles.py b/hermes_cli/profiles.pyindex 8e686c22c82..5073d3fb2e3 100644--- a/hermes_cli/profiles.py+++ b/hermes_cli/profiles.py@@ -1281,7 +1281,6 @@ def _clone_all_into(source_dir: Path, profile_dir: Path, canon: str) -> None:"""--clone-all: full copytree minus infrastructure/history, then strip runtime filesand cloned single-use OAuth grants."""_copytree_keep_junctions(source_dir, profile_dir, _clone_all_copytree_ignore(source_dir))- (profile_dir / SETUP_PROFILE_MARKER).unlink(missing_ok=True)materialized = _materialize_symlinked_files(profile_dir)if materialized:logger.info("profile %s: materialized symlinked %s so the clone never writes through to %s",@@ -1437,6 +1436,9 @@ def create_profile(_clone_all_into(source_dir, staging, canon)else:_bootstrap_profile_dir(staging, source_dir, sync_imports=sync_imports)+ if source_dir is not None:+ from hermes_cli.setup_profile import release_setup_copy+ release_setup_copy(staging, from_setup=(source_dir / SETUP_PROFILE_MARKER).is_file())if source_dir is not None and not clone_channels:from hermes_cli.profile_channels import strip_channel_settingsstripped = strip_channel_settings(staging, include_state=clone_all, source_dir=source_dir)@@ -2359,7 +2361,8 @@ def import_profile(archive_path: str, name: Optional[str] = None) -> Path:shutil.rmtree(child)else:child.unlink()- (final_source / SETUP_PROFILE_MARKER).unlink(missing_ok=True)+ from hermes_cli.setup_profile import release_setup_copy+ release_setup_copy(final_source, from_setup=(final_source / SETUP_PROFILE_MARKER).is_file())shutil.move(str(final_source), str(profile_dir))return profile_dirdiff --git a/hermes_cli/setup_profile.py b/hermes_cli/setup_profile.pyindex ccd5af21c84..94f68af335f 100644--- a/hermes_cli/setup_profile.py+++ b/hermes_cli/setup_profile.py@@ -225,6 +225,25 @@ def _write_state(path: Path, state: dict) -> None:atomic_json_write(path / profiles_mod.SETUP_PROFILE_MARKER, state)+def release_setup_copy(copy_dir: Path, *, from_setup: bool) -> None:+ """A copy of a profile (clone, clone-all, import, distribution install) is never the setup profile: drop the+ marker, and when the source was the setup profile, the setup toolsets its config grants (``_write_setup_config``)."""+ (copy_dir / profiles_mod.SETUP_PROFILE_MARKER).unlink(missing_ok=True)+ config_path = copy_dir / "config.yaml"+ if not from_setup or not config_path.is_file():+ return+ from hermes_cli.config import atomic_config_replace, read_user_config_raw+ config = read_user_config_raw(config_path)+ platforms = dict(config.get("platform_toolsets") or {})+ if platforms.pop("cli", None) is None:+ return+ if platforms:+ config["platform_toolsets"] = platforms+ else:+ config.pop("platform_toolsets", None)+ atomic_config_replace(config_path, config)++def _write_setup_config(path: Path) -> None:from agent.skill_utils import parse_config_string_listfrom hermes_cli.config import atomic_config_write, read_user_config_raw