Skip to content

The agent that grows with you

fix(goals): pause when the session workspace is missing

Jay Zhou8cd3d8149ead
diff --git a/hermes_cli/goals.py b/hermes_cli/goals.py
index 67a904aebfa..47aa40f165e 100644
--- a/hermes_cli/goals.py
+++ b/hermes_cli/goals.py
@@ -375,7 +375,8 @@ def _gate_workspace() -> Tuple[Optional[str], Optional[str]]:
"""``(cwd, refusal)`` for this check's gates. A multi-session backend's process directory is not
the session's project, so gates run in the scoped session workspace (#125369). A declared
workspace that is not a directory on this host (deleted, remote, container) is a refusal: a
- relative gate run anywhere else would check a different project and could pass a failing goal.
+ relative gate run anywhere else would check a different project and could pass a failing goal,
+ and no agent turn can fix it, so the caller pauses instead of retrying.
No declared workspace keeps the classic resolution (TERMINAL_CWD, else the launch directory)."""
from agent.runtime_cwd import resolve_agent_cwd, scoped_session_cwd
@@ -384,8 +385,8 @@ def _gate_workspace() -> Tuple[Optional[str], Optional[str]]:
path = Path(declared).expanduser()
if path.is_dir():
return str(path), None
- return None, (f"[gate not run: the session workspace {declared} is not a directory on this host, "
- "and running the gate anywhere else would check a different project]")
+ return None, (f"the session workspace {declared} is not a directory on this host, "
+ "and running gates anywhere else would check a different project")
try:
return str(resolve_agent_cwd()), None
except OSError:
@@ -1311,8 +1312,14 @@ class GoalManager:
return None
gate_cwd, refusal = _gate_workspace()
+ if refusal:
+ return self._pause_decision(
+ f"quality gates not run: {refusal}", "gate_failed", f"gates not run: {refusal}",
+ f"⏸ Goal paused — quality gates not run: {refusal}. Fix the workspace or "
+ f"/goal gate remove the gates, then /goal resume.",
+ )
for gate in state.gates:
- passed, exit_code, tail = (False, -1, refusal) if refusal else run_gate(gate, cwd=gate_cwd)
+ passed, exit_code, tail = run_gate(gate, cwd=gate_cwd)
gate.last_exit_code = exit_code
gate.last_output_tail = tail
if passed: