chore: harden verify_success fallbacks to Fail-Fast and apply aggressive GOAP penalty

This commit is contained in:
2026-05-03 15:42:09 +02:00
parent 5fbbe3d273
commit f46b0b7bcb
4 changed files with 24 additions and 11 deletions

View File

@@ -496,8 +496,12 @@ class GoalExecutor:
return False
else:
# action_success is None (INCONCLUSIVE)
# We decay the memory so it unlearns if it repeatedly fails to produce a definitive success.
logger.warning(f"⚠️ [GOAP Execute] Applying AGGRESSIVE PENALTY for inconclusive action '{action}'.")
engine.decay_click(action)
# Double penalty to burn ambiguous paths faster (outer loop adds +1, so total +2 = instantly hits MAX_RETRIES)
self.action_failures[(pre_action_screen_type, action)] = (
self.action_failures.get((pre_action_screen_type, action), 0) + 1
)
return False
def _execute_recalled_path(self, steps: List[Dict], goal: str) -> bool:

View File

@@ -167,7 +167,8 @@ class ActionMemory:
and "row_feed_button_like" not in post_xml_lower
and "clips_viewer" not in post_xml_lower
):
return None # Still on grid, inconclusive
logger.warning(f"⚠️ [ActionMemory] Still on grid after trying to '{intent}'. Verification FAIL.")
return False # Still on grid, definitely failed
state_toggles = ["like", "save", "follow", "heart"]
is_toggle = any(t in intent_lower for t in state_toggles)
@@ -269,7 +270,10 @@ class ActionMemory:
if diff > 0:
logger.debug(f"🧠 [ActionMemory] Structural delta detected for toggle '{intent}'. Verification PASS.")
return True
else:
logger.warning(
f"⚠️ [ActionMemory] Zero structural shift (diff={diff}) for state-toggle '{intent}'. Verification FAIL."
)
return False
# If the intent is an abstract goal (like "find customers"), diff > 50 is NOT enough.
# We must force visual VLM confirmation because clicking the wrong thing (like "Create highlight")
# also produces a large diff but achieves the wrong goal.
@@ -317,6 +321,12 @@ class ActionMemory:
logger.warning(f"⚠️ [ActionMemory] Cannot visually verify abstract intent '{intent}'. Failing safe.")
return False
# If diff <= 50 for non-toggle
logger.warning(
f"⚠️ [ActionMemory] Insufficient structural change (diff={diff}) for non-toggle '{intent}'. Verification FAIL."
)
return False
def _intent_matches_node(intent: str, semantic_string: str) -> bool:
"""Checks if the clicked element semantically matches the toggle intent.