diff --git a/hermes_cli/goal_command.py b/hermes_cli/goal_command.py index 98f8ae4e4b..6fe3491583 100644 --- a/hermes_cli/goal_command.py +++ b/hermes_cli/goal_command.py @@ -147,7 +147,7 @@ def _set(mgr, arg, *, drafting, last_user_message, render, progress): else: headline, contract = goals.parse_contract(arg) contract = contract if not contract.is_empty() else None - previous = (mgr.state.goal or "").strip() if mgr.state is not None else "" + previous = mgr.state.goal if mgr.has_goal() else "" state = mgr.set(headline or arg, contract=contract) output = render("gateway.goal.set", "⊙ Goal set ({budget}-turn budget): {goal}", budget=state.max_turns, goal=state.goal) diff --git a/tests/hermes_cli/test_goal_dispatch.py b/tests/hermes_cli/test_goal_dispatch.py index 2ef73513dd..2235cd405d 100644 --- a/tests/hermes_cli/test_goal_dispatch.py +++ b/tests/hermes_cli/test_goal_dispatch.py @@ -145,3 +145,6 @@ def test_double_dash_sets_control_word_goal_and_announces_the_replace(): result = _dispatch(mgr, '-- pause the nightly cron') assert goals.load_goal(mgr.session_id).goal == 'pause the nightly cron' assert 'was: original objective' in result.output + mgr.clear() + fresh = goals.GoalManager(session_id=mgr.session_id) # gateway/TUI reload per command + assert 'replaced' not in _dispatch(fresh, 'fresh objective').output