The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(kanban): goal gates fail open when the judge transport fails
dkbjornnc68d21cda0f8
diff --git a/hermes_cli/kanban.py b/hermes_cli/kanban.pyindex f738d9d66b2..0fee5a0928d 100644--- a/hermes_cli/kanban.py+++ b/hermes_cli/kanban.py@@ -839,16 +839,14 @@ def _goal_mode_handoff_rejection(task: Optional[kb.Task], evidence: str):from hermes_cli.goals import judge_goal- verdict, reason = "done", ""+ verdict, reason, transport_failed = "done", "", Falsetry:# Headless handoff checks run outside any agent turn: bind the per-task relay-affinity# scope (mirrors kanban_specify) so the relay does not reject the judge call (#113669).from agent.portal_tags import get_affinity_scope, reset_affinity_scope, set_affinity_scopeaffinity_token = None if get_affinity_scope() else set_affinity_scope(f"kanban:{task.id}")try:- # Fail-open on transport failure belongs to the shared gate fix (#73119);- # this gate only ensures the headless call carries a scope.- verdict, reason, _, _, _ = judge_goal(+ verdict, reason, _, _, transport_failed = judge_goal(goal=f"{task.title}\n\n{task.body or ''}".strip(),last_response=evidence.strip())finally:@@ -859,6 +857,13 @@ def _goal_mode_handoff_rejection(task: Optional[kb.Task], evidence: str):_logging.getLogger(__name__).warning("goal judge check failed, allowing lifecycle handoff: %s",judge_exc, exc_info=True)+ if transport_failed:+ # ``judge_goal`` fails open to ``continue`` on transport errors (relay 400, auth, timeout);+ # an unreachable judge is not a human "not done" and must not reject the handoff (#83610).+ import logging as _logging++ _logging.getLogger(__name__).warning("goal judge unreachable (%s), allowing lifecycle handoff", reason)+ return ("done", None)return (verdict, None if verdict == "done" else reason)diff --git a/tools/kanban_tools.py b/tools/kanban_tools.pyindex 06a510820a0..6390577f96b 100644--- a/tools/kanban_tools.py+++ b/tools/kanban_tools.py@@ -405,9 +405,7 @@ def _goal_gate(tool_name: str, task, tid: str, evidence: str) -> None:from agent.portal_tags import get_affinity_scope, reset_affinity_scope, set_affinity_scopeaffinity_token = None if get_affinity_scope() else set_affinity_scope(f"kanban:{tid}")try:- # Fail-open on transport failure belongs to the shared gate fix (#73119);- # this gate only ensures the headless call carries a scope.- verdict, reason, _, _, _ = judge_goal(+ verdict, reason, _, _, transport_failed = judge_goal(goal=f"{task.title}\n\n{task.body or ''}".strip(), last_response=evidence.strip())finally:if affinity_token is not None:@@ -416,6 +414,11 @@ def _goal_gate(tool_name: str, task, tid: str, evidence: str) -> None:logger.warning("goal judge check failed, allowing lifecycle handoff: %s", judge_exc, exc_info=True)return+ if transport_failed:+ # ``judge_goal`` fails open to ``continue`` on transport errors (relay 400, auth, timeout);+ # an unreachable judge is not a human "not done" and must not reject the handoff (#83610).+ logger.warning("goal judge unreachable (%s), allowing lifecycle handoff", reason)+ returnif verdict == "done":returnkey = "blocked" if verdict == "blocked" else "continue"