From 7dd083feca02ef2a188f9cb515e0fa4a98f484eb Mon Sep 17 00:00:00 2001 From: kshitijk4poor <82637225+kshitijk4poor@users.noreply.github.com> Date: Sat, 3 Oct 2026 19:44:33 +0530 Subject: [PATCH] fix(goal): treat `--` as the escape only when it is its own token Gate quality finding (Low): `arg.startswith("--")` also matched goal text that starts with a flag-like word, so `/goal --dry-run the migration` silently set "dry-run the migration". Match only the standalone `--` token (the documented `/goal -- ` form) and reuse the parsed rest, so flag-like text is kept literally as on main. --- hermes_cli/goal_command.py | 4 ++-- tests/hermes_cli/test_goal_dispatch.py | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/hermes_cli/goal_command.py b/hermes_cli/goal_command.py index 6fe3491583..86f258f94a 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 2235cd405d..f0dca0eb77 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'