Compare commits

...

1 Commits

Author SHA1 Message Date
4855bde1a4 fix: achieve goal if can't fail 2026-02-02 16:29:09 +01:00

View File

@@ -467,8 +467,7 @@ class AgentSpeakGenerator:
:param main_goal: Whether this is a main goal (for UI notification purposes). :param main_goal: Whether this is a main goal (for UI notification purposes).
""" """
context: list[AstExpression] = [self._astify(phase)] context: list[AstExpression] = [self._astify(phase)]
if goal.can_fail: context.append(~self._astify(goal, achieved=True))
context.append(~self._astify(goal, achieved=True))
if previous_goal and previous_goal.can_fail: if previous_goal and previous_goal.can_fail:
context.append(self._astify(previous_goal, achieved=True)) context.append(self._astify(previous_goal, achieved=True))
if not continues_response: if not continues_response:
@@ -489,7 +488,7 @@ class AgentSpeakGenerator:
if isinstance(step, Goal): if isinstance(step, Goal):
subgoals.append(step) subgoals.append(step)
if not goal.can_fail and not continues_response: if not goal.can_fail:
body.append(AstStatement(StatementType.ADD_BELIEF, self._astify(goal, achieved=True))) body.append(AstStatement(StatementType.ADD_BELIEF, self._astify(goal, achieved=True)))
if len(body) == 0: if len(body) == 0: