Skip to content

The agent that grows with you

test(update): a same-named script outside the checkout still repairs it

kshitijk4poor4e5cea136ab0
diff --git a/tests/hermes_cli/test_update_launch_completion.py b/tests/hermes_cli/test_update_launch_completion.py
index 233c2b26a07..47dbd519fc4 100644
--- a/tests/hermes_cli/test_update_launch_completion.py
+++ b/tests/hermes_cli/test_update_launch_completion.py
@@ -122,6 +122,25 @@ def test_prepared_completion_import_does_not_start_another_tail(tmp_path, monkey
assert venv_sync.completion_pending_path(root).is_file()
+def test_same_named_script_outside_the_checkout_still_repairs(tmp_path, monkeypatch, completion_tail):
+ """Only this checkout's own tail is exempt: another tree's worker still owes this one's repair."""
+ import pm
+ from hermes_cli import _launchers
+
+ root = _self_checkout(tmp_path, monkeypatch)
+ foreign = tmp_path / "other" / "hermes_cli" / "source_completion.py"
+ foreign.parent.mkdir(parents=True)
+ foreign.touch()
+ venv_sync.arm_completion(root)
+ monkeypatch.setattr(pm, "venv_is_current", lambda **kw: True)
+ monkeypatch.setattr(_launchers, "resolve_store_python", lambda _: Path(sys.executable))
+ monkeypatch.setattr(sys, "argv", [str(foreign), "--prepared"])
+
+ assert venv_sync.prepare_launch(root, sys.argv[1:]) is None
+ assert len(completion_tail) == 1
+ assert not venv_sync.completion_pending_path(root).is_file()
+
+
def test_completion_tail_output_stays_off_stdout(tmp_path, monkeypatch, completion_tail):
"""The automatic tail runs in front of the user's command, which may be piping JSON."""
import pm