Skip to content

[Bug]: --clone-all flag creates an infinitely recursive duplicate w/in the profiles directory, takes up all available disk space. #4306

Closed as not planned

Description

@clayht12-code

Bug Description

The --clone-all flag for isolated agent creation seems to be copying the source profile directory into a subdirectory of itself (e.g., ra/profiles/ra), creating an infinitely recursive duplicate that consumes all available disk space. The destination path should be a sibling location (e.g., ra-clone) instead of a child of the source. This is likely a path construction issue where the clone destination is being resolved relative to the source directory rather than at the same level.

Steps to Reproduce

  1. create a new agent from your existing hermes baseline agent with the --clone-all flag
  2. my specific command was "hermes profile create ra --clone-all"

Expected Behavior

it should have merely copied the config to the new profile.

Actual Behavior

The clone feature's destination path is resolved as a child of the source profile directory instead of a sibling, causing shutil.copytree to recursively copy the profile into itself. This creates infinite nesting (profile/profiles/profile/profiles/...) that consumes all disk space until paths exceed macOS's PATH_MAX limit, at which point it crashes with "No such file or directory." The fix is to resolve the destination path relative to the parent profiles/ directory, not the source profile itself.

Affected Component

Configuration (config.yaml, .env, hermes setup)

Messaging Platform (if gateway-related)

No response

Operating System

Mac OS 26.2

Python Version

3.11.14

Hermes Version

0.6.0

Relevant Logs / Traceback

Root Cause Analysis (optional)

No response

Proposed Fix (optional)

No response

Are you willing to submit a PR for this?

  • I'd like to fix this myself and submit a PR

Activity

  1. teknium1 commented on May 3, 2026

    @teknium1
    Collaborator

    Thanks for the detailed report — this bug is fixed on main and shipped in v2026.4.30.

    This is an automated hermes-sweeper review.

    What was wrong: shutil.copytree from the default ~/.hermes profile included the sibling ~/.hermes/profiles/ tree in the destination, creating the profiles/profiles/profiles/… explosion you described.

    The fix:

    • Commit 528e7dc added _clone_all_copytree_ignore() in hermes_cli/profiles.py (line 75), which returns ['profiles'] when copytree visits the source root — exactly matching the export exclusion that already existed in _DEFAULT_EXPORT_EXCLUDE_ROOT.
    • The copytree call at line 452–455 now passes ignore=_clone_all_copytree_ignore(source_dir).
    • A regression test test_clone_all_excludes_sibling_profiles_tree (tests/hermes_cli/test_profiles.py:191) directly asserts the new profile contains no profiles/ subdirectory after --clone-all.

    Please upgrade to v2026.4.30 or later to get the fix.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions