From 0fbd1b16789ce670f6102e6404c735b55711ec02 Mon Sep 17 00:00:00 2001 From: Marc Mintel Date: Mon, 27 Apr 2026 11:13:43 +0200 Subject: [PATCH] fix(perception): allow state-toggling actions to bypass structural length check --- GramAddict/core/perception/action_memory.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/GramAddict/core/perception/action_memory.py b/GramAddict/core/perception/action_memory.py index 94b513d..4b489d1 100644 --- a/GramAddict/core/perception/action_memory.py +++ b/GramAddict/core/perception/action_memory.py @@ -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