fix: achieve goal if can't fail

This commit is contained in:
2026-02-02 16:29:09 +01:00
parent ff93356a9a
commit 4855bde1a4

View File

@@ -467,7 +467,6 @@ class AgentSpeakGenerator:
:param main_goal: Whether this is a main goal (for UI notification purposes).
"""
context: list[AstExpression] = [self._astify(phase)]
if goal.can_fail:
context.append(~self._astify(goal, achieved=True))
if previous_goal and previous_goal.can_fail:
context.append(self._astify(previous_goal, achieved=True))
@@ -489,7 +488,7 @@ class AgentSpeakGenerator:
if isinstance(step, Goal):
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)))
if len(body) == 0: