Skip to content

The agent that grows with you

fix(goal): treat `--` as the escape only when it is its own token

kshitijk4poor7dd083feca02
diff --git a/hermes_cli/goal_command.py b/hermes_cli/goal_command.py
index 6fe3491583a..86f258f94a6 100644
--- a/hermes_cli/goal_command.py
+++ b/hermes_cli/goal_command.py
@@ -193,9 +193,9 @@ def dispatch_goal_command(
rest = tokens[1].strip() if len(tokens) > 1 else ""
prefix = "Invalid goal"
try:
- if arg.startswith("--"):
+ if verb == "--":
# Verbatim goal text for goals that start with a control word (`/goal -- pause the cron`).
- return _set(mgr, arg[2:].strip(), drafting=False, last_user_message=last_user_message,
+ return _set(mgr, rest, drafting=False, last_user_message=last_user_message,
render=render, progress=progress)
if handler := _EXACT_HANDLERS.get(arg.lower()):
return handler(mgr, "", render)
diff --git a/tests/hermes_cli/test_goal_dispatch.py b/tests/hermes_cli/test_goal_dispatch.py
index 2235cd405d9..f0dca0eb771 100644
--- a/tests/hermes_cli/test_goal_dispatch.py
+++ b/tests/hermes_cli/test_goal_dispatch.py
@@ -148,3 +148,5 @@ def test_double_dash_sets_control_word_goal_and_announces_the_replace():
mgr.clear()
fresh = goals.GoalManager(session_id=mgr.session_id) # gateway/TUI reload per command
assert 'replaced' not in _dispatch(fresh, 'fresh objective').output
+ _dispatch(fresh, '--dry-run the migration')
+ assert goals.load_goal(mgr.session_id).goal == '--dry-run the migration'