mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
fix(migration): don't auto-archive OpenClaw source directory
Remove auto-archival from hermes claw migrate — not its responsibility (hermes claw cleanup is still there for that). Skip MESSAGING_CWD when it points inside the OpenClaw source directory, which was the actual root cause of agent confusion after migration. Use Path.is_relative_to() for robust path containment check. Salvaged from PR #8192 by opriz. Co-authored-by: opriz <opriz@users.noreply.github.com>
This commit is contained in:
parent
1871227198
commit
36f57dbc51
4 changed files with 54 additions and 165 deletions
|
|
@ -185,6 +185,38 @@ def test_migrator_optionally_imports_supported_secrets_and_messaging_settings(tm
|
|||
assert "TELEGRAM_BOT_TOKEN=123:abc" in env_text
|
||||
|
||||
|
||||
def test_messaging_cwd_skipped_when_inside_source(tmp_path: Path):
|
||||
"""MESSAGING_CWD pointing inside the OpenClaw source dir should be skipped."""
|
||||
mod = load_module()
|
||||
source = tmp_path / ".openclaw"
|
||||
target = tmp_path / ".hermes"
|
||||
target.mkdir()
|
||||
|
||||
# Workspace path is inside the source directory
|
||||
ws_path = str(source / "workspace")
|
||||
(source / "credentials").mkdir(parents=True)
|
||||
(source / "openclaw.json").write_text(
|
||||
json.dumps({"agents": {"defaults": {"workspace": ws_path}}}),
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
migrator = mod.Migrator(
|
||||
source_root=source,
|
||||
target_root=target,
|
||||
execute=True,
|
||||
workspace_target=None,
|
||||
overwrite=False,
|
||||
migrate_secrets=True,
|
||||
output_dir=target / "migration-report",
|
||||
selected_options={"messaging-settings"},
|
||||
)
|
||||
migrator.migrate()
|
||||
|
||||
env_path = target / ".env"
|
||||
if env_path.exists():
|
||||
assert "MESSAGING_CWD" not in env_path.read_text(encoding="utf-8")
|
||||
|
||||
|
||||
def test_migrator_can_execute_only_selected_categories(tmp_path: Path):
|
||||
mod = load_module()
|
||||
source = tmp_path / ".openclaw"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue