fix(perception): detect bottom sheet modals structurally to prevent phantom interactions

This commit is contained in:
2026-05-05 14:10:15 +02:00
parent dd79e07fb3
commit f8fc8ace8e
2 changed files with 6 additions and 0 deletions

View File

@@ -198,12 +198,16 @@ class ScreenIdentity:
"next_button_textview",
)
browser_markers = ("ig_browser_text_title", "ig_browser_close_button", "ig_chrome_subsection")
bottom_sheet_markers = ("bottom_sheet_container", "action_sheet_container")
if not is_normal_override and any(marker in ids_str for marker in creation_flow_markers):
logger.info("🛡️ [ScreenIdentity] Content-creation overlay detected → MODAL")
return ScreenType.MODAL
if not is_normal_override and any(marker in ids_str for marker in browser_markers):
logger.info("🛡️ [ScreenIdentity] In-App Browser detected → MODAL")
return ScreenType.MODAL
if not is_normal_override and any(marker in ids_str for marker in bottom_sheet_markers):
logger.info("🛡️ [ScreenIdentity] Bottom Sheet Modal detected → MODAL")
return ScreenType.MODAL
# Priority 2: Structural Heuristics (100% Deterministic)
if "unified_follow_list_tab_layout" in ids or "follow_list_container" in ids:

View File

@@ -486,6 +486,8 @@ class SituationalAwarenessEngine:
"ig_browser_text_title", # In-App Browser Title
"ig_browser_close_button", # In-App Browser Close Button
"ig_chrome_subsection", # In-App Browser Chrome
"bottom_sheet_container", # Bottom sheet modal (e.g., following options)
"action_sheet_container", # Action sheet modal
)
if any(
re.search(rf'resource-id="[^"]*{marker}[^"]*"', xml_dump, re.IGNORECASE)