fix(perception): allow state-toggling actions to bypass structural length check

This commit is contained in:
2026-04-27 11:13:43 +02:00
parent b5cca06ce2
commit 0fbd1b1678

View File

@@ -88,6 +88,13 @@ class ActionMemory:
if "explore_action_bar" in post_click_xml and "row_feed_button_like" not in post_click_xml:
return None # Still on grid, inconclusive
# State toggles (like, save, follow) rarely change XML length by > 50 chars
state_toggles = ["like", "save", "follow", "heart"]
if any(t in intent.lower() for t in state_toggles):
if pre_click_xml != post_click_xml:
logger.debug(f"🧠 [ActionMemory] State toggle detected for '{intent}'. Verification PASS.")
return True
if abs(len(pre_click_xml) - len(post_click_xml)) > 50:
logger.debug(f"🧠 [ActionMemory] Structural change detected for '{intent}'. Verification PASS.")
return True