Commit Graph

186 Commits

Author SHA1 Message Date
8a2c93fb64 fix(follow+vlm): prevent following-click catastrophe & stop VLM memory poisoning
FOLLOW PLUGIN SAFETY GUARD:
- Added pre-click XML guard: checks button text before clicking
- If button says 'Following'/'Requested'/'Message' → SKIP
  (prevents opening dangerous Unfollow/Add-to-Favorites bottom sheet)
- Changed intent from 'tap Follow or Following button' to 'tap follow button'
- This was the root cause of adding users to Close Friends/Favorites

VLM VERIFICATION RESILIENCE:
- VLM false no longer shortcircuits to return False
- VLM verdict is now a SOFT SIGNAL that falls through to structural
  delta verification as ground-truth tiebreaker
- Small local VLMs (7B llava) systematically return false for everything
- This was THE root cause of memory poisoning: every action got penalized
  because VLM always said 'failed', regardless of actual screen state
- 22 total poisoned Qdrant entries purged across two sessions

ROOT CAUSE CHAIN:
VLM always says false → penalties on every action → confidence < 0.2 →
circuit breaker blocks ALL core actions → bot can't like/follow/comment
→ bot clicks random things → adds to favorites, opens bottom sheets

TDD: 4 new tests, full suite 110/111 (1 infra flake)
2026-05-05 16:05:31 +02:00
749e82ea14 fix(guard+memory): radical overhaul of close friends detection & circuit breaker
CLOSE FRIENDS GUARD:
- Replaced broken text-only detection ('enge freunde'/'close friend')
  with STRUCTURAL resource-id marker detection:
  * friendly_bubbles_component (feed posts)
  * profile_header_close_friend (profile view)
  * close_friends_badge (Reels)
  * close_friends_star (green star)
- Kept legacy text fallback for edge cases
- TDD: 5 tests including meta-test enforcing structural detection

CONTEXT MEMORY CIRCUIT BREAKER:
- Old system: single failure permanently blocks action (confidence < 0.2 = dead)
- New system: time-based decay — failures older than 1 hour are auto-forgiven
  and the poisoned entry is DELETED, allowing re-exploration
- This prevents catastrophic self-sabotage where the bot blocks its own
  core actions (tap like, tap follow, tap comment) permanently
- Purged 14 poisoned entries from live Qdrant that were blocking ALL
  fundamental interactions
- TDD: 2 meta-tests enforcing time-decay and no permanent blocking

Full suite: 106/107 passed (1 infra flake)
2026-05-05 15:48:59 +02:00
8d58c3cf89 fix(sae): purge all hardcoded fallback coords — autonomous structural dismiss
- Removed hardcoded (540,150) fallback in _plan_escape_via_llm
- Added _find_structural_dismiss_target: scans raw XML for clickable
  dismiss/cancel/close buttons and extracts coords from bounds attrs
- LLM repeat detection now falls back to structural scan (not magic numbers)
- Temperature increases progressively when LLM is stubborn (0.1 → 0.7)
- Failure history injected as CRITICAL block into LLM system prompt
- Extended pre-commit test discovery to include tests/tdd/
- TDD: 7 new tests including meta-tests proving zero hardcoded coords
- Full suite: 100/100 passed
2026-05-05 15:30:45 +02:00
f8fc8ace8e fix(perception): detect bottom sheet modals structurally to prevent phantom interactions 2026-05-05 14:10:15 +02:00
dd79e07fb3 fix(behaviors): prevent rabbit hole from activating on non-feed screens and add tap post username context gate 2026-05-05 13:42:22 +02:00
da1a308c5d fix(sae): keyboard structural markers to be regex based for safety 2026-05-05 13:33:41 +02:00
b626dc6488 feat(navigation): add structural identity and transitions for NOTIFICATIONS trap 2026-05-05 13:05:46 +02:00
5ca5777c4b feat(story_view): delegate next story segment resolution to TelepathicEngine/VLM instead of hardcoded coordinates 2026-05-05 12:32:34 +02:00
8729995338 fix(navigation): implement global trap guards for audio/save/trending and adjust story tap height 2026-05-05 12:26:59 +02:00
d57857d444 fix(navigation): purge localized string checks for audio/trending buttons and prevent repetitive carousel swiping loops 2026-05-05 12:10:58 +02:00
ac272eadce fix(navigation): detect end of carousel by checking ui delta to prevent blind swiping 2026-05-05 12:07:27 +02:00
59e7967458 fix(navigation): block VLM from hallucinating trending audio clicks during like intent 2026-05-05 12:03:53 +02:00
59cd5477af fix(navigation): harden obstacle guard and structural sanity checks against phantom keyboards and reply-box traps 2026-05-05 11:27:31 +02:00
c3f84088aa fix(action_memory): explicitly request JSON schema for visual verification
1. Prevent VLM from inventing arbitrary JSON keys when queried with format_json=True.
2. Ensure verify_success prompt directly requests {"success": true/false}.
3. Maintain negative reinforcement parsing integrity.
2026-05-05 11:16:40 +02:00
548fc374ae feat(perception): implement extreme VLM guards and surface spatial metadata
1. Add long_clickable and class_name to SpatialNode and box_legend.
2. Inject strict guardrails into the SoM prompt to prevent EditText, Recents gallery, and long_clickable hallucinations.
3. Update text-based resolver with equivalent extreme fallback rules.
4. Ensures VLM explicitly rejects non-deterministic edge cases (e.g., Select Album).
2026-05-05 11:01:28 +02:00
5ada31c77e feat(navigation): harden obstacle guard and intent resolver against keyboard hallucinations 2026-05-05 10:52:38 +02:00
39185593dd test(e2e): Fix E2E context generator and harden StoryView plugin
- Updated e2e_workflow_ctx in conftest to structurally parse screen_type
- Fixed StoryViewPlugin to gracefully handle pre-existing story screens
- Resolved 'LIE DETECTED' failure in story test suite
- Validated structural path transitions for story ring and story exit
2026-05-05 01:50:40 +02:00
c0cfa24384 feat(core): P0 radical evolution — kill blank_start, complete ContextGate matrix, fix HD Map back transitions
P0-2: Kill blank_start: true in config — the nuclear option that wipes ALL learned
knowledge on every run. Replaced with memory_hygiene() selective amnesia that
prunes low-confidence entries while preserving high-confidence learned patterns.

P0-3: Purge all root-level garbage scripts (scratch.py, test_run.py, profile_dump.xml,
resp_dump.json, pytest_output.log, test_output.log, coverage.xml, coverage_e2e.json).
Updated .gitignore to prevent reaccumulation.

P2-2: Replace piecemeal BANNED_SCREENS/REQUIRED_MARKERS with complete Action
Compatibility Matrix (VALID_SCREENS whitelist). Every interaction intent now has
an explicit set of valid screens. Covers like, comment, follow, unfollow, save,
repost across all 14 screen types.

P2-3: Remove non-deterministic 'press back' transitions from HD Map topology for
OTHER_PROFILE, POST_DETAIL, and SEARCH_RESULTS. Add tab transitions to POST_DETAIL.

P2-4: Replace ScreenMemoryDB nuclear 200-entry wipe with LRU eviction.
store_screen() now accepts confidence parameter.

TDD: 22 new tests (all GREEN), 240 unit/tdd/integration passed, 0 regressions.
E2E: 288 passed (+2 fixed), 6 pre-existing LIE DETECTED failures.
2026-05-04 18:19:00 +02:00
3800254fe3 feat: structural hardening, grid fast-paths, and state-aware adaptive snap recovery 2026-05-04 17:43:25 +02:00
22216cbd2d feat(core): finalize P2 & P3 hardening - Topology HD Map, Empathy Filter, and Git Hygiene 2026-05-04 15:03:42 +02:00
79e5784b93 feat(core): complete P1 hardening phase - ContextGate, Localization Purge, SoM Safety Clamp 2026-05-04 14:51:54 +02:00
5c9ea0e5e2 fix(resonance): remediate 0.85 score flatlining (P1-4)
- Raised ContentMemoryDB cache threshold from 0.95 to 0.98 to prevent cross-post poisoning.
- Implemented continuous resonance scoring by storing and retrieving 'resonance_score'
  in ContentMemoryDB.
- ResonanceEngine now prioritizes high-fidelity raw scores from cache over
  discrete 'high/medium/low' mapping.

TDD: 3 tests verifying threshold and scoring logic integrity.
2026-05-04 14:42:59 +02:00
91fa426b70 chore(git): purge tracked bytecode and optimize .gitignore
- Fixed .gitignore to correctly handle __pycache__ even when inside whitelisted directories (like tests/).
- Moved pycache ignore patterns to the end of the file to ensure they take absolute precedence over any directory-level whitelists.
- Purged all previously tracked .pyc and __pycache__ files from the git index.
- Cleaned up .hypothesis and .pytest_cache artifacts.

This enforces 'Militärische Git-Disziplin' (Rule 7) and keeps the repo clean of environment-specific junk.
2026-05-04 14:42:22 +02:00
a265dee3d0 fix(memory): ScreenMemory threshold hardening + stale layout purge (P0-3)
- Raised similarity_threshold from 0.90 to 0.95 in get_screen_type() to eliminate
  POST_DETAIL false-positives caused by embedding saturation.
- Implemented purge_stale_screens() with 24h TTL to remove layout drift.
- Added collection size cap (200 points) to store_screen() with automatic wipe
  when saturated to clear overfitting bias.
- Triggered purge_stale_screens() on ScreenIdentity initialization.

TDD: 3 new tests for threshold defaults and purge method integrity.
2026-05-04 14:39:55 +02:00
d81a5d4e81 fix(perception): structural Resource-ID bypass gate + dead code purge in ActionMemory
P0-1: Toggle intents (follow/like/save) resolved via Resource-ID fast-path
now skip VLM verification entirely. Eliminates the #1 session failure:
VLM hallucinating Follow→Like, causing zero follows per session.

P0-2: Purge 52 lines of unreachable dead code after unconditional return
at line 290. Non-toggle structural delta verification now properly reachable.
Remove 4 DEBUG-prefixed logger.info pollution statements.

TDD: 7 new tests covering bypass gate, negative guard, non-toggle delta,
and debug log pollution detection.
2026-05-04 14:35:19 +02:00
f384fbb749 feat: purge ALL remaining German/localized strings from action_memory, telepathic_engine, darwin_engine, resonance_engine — enforce zero-maintenance structural determinism with TDD compliance tests 2026-05-03 23:33:28 +02:00
565bdaa568 chore: purge garbage scripts from repo and harden .gitignore 2026-05-03 23:29:14 +02:00
c641204a6b feat: enforce zero-maintenance autonomous navigation by purging hardcoded string searches and localized translations; harden VLM perception via robust JSON fallback; fix OTHER_PROFILE topological routing 2026-05-03 23:28:00 +02:00
4b645c6fb2 Hardening: Centralized zero-trust CognitiveStack validation and removed synthetic e2e test mocks 2026-05-03 20:30:30 +02:00
c7c7ce29f8 fix(qdrant): increase embedding API timeout to 30s to allow Ollama VRAM cold-starts 2026-05-03 18:38:27 +02:00
b36dde77d8 fix(navigation): harden autonomous perimeter guards against Play Store trap 2026-05-03 18:29:25 +02:00
93b2140844 docs: update ARCHITECTURE.md with SAE 3-layer modal cascade
Ensuring 100% code-documentation parity per strict architectural rules.
2026-05-03 17:15:16 +02:00
67c3d464e0 fix(navigation): harden ScreenIdentity priority cascade and GOAP structural action detection
1. ScreenIdentity: Restructured priority cascade to prevent Qdrant semantic
   cache from overriding deterministic structural heuristics. Cached types
   now resolve AFTER structural checks (Priority 3) instead of before.
   Story/Reels hallucinations from both cache and VLM are rejected if
   structural markers are absent.

2. bot_flow: Added error handling for story ring avatar tap and curiosity
   HomeFeed navigation failures — prevents silent continuation into
   undefined states.

3. GOAP: Extended is_navigation detection to include ScreenTopology
   structural actions, ensuring HD Map routes are correctly classified.

4. action_memory: Tightened _parse_yes_no to prevent JSON fall-through
   into ambiguous text matching. Structured responses with 'success'
   boolean are now handled directly.
2026-05-03 17:00:27 +02:00
d298f03891 fix(sae): structural fast-path for Instagram survey/interstitial modal detection
The SAE perceive() had no structural fast-path for Instagram-internal
modal overlays (surveys, rating prompts, interstitials). These modals
live inside com.instagram.android and were invisible to the foreign-app
detector. The LLM fallback frequently misclassified them as NORMAL,
causing the bot to get trapped in survey dialogs.

Added two O(1) structural detection layers:
1. Resource-ID markers: survey_overlay_container, interstitial_container,
   mystery_interstitial, nux_overlay, rating_prompt, feedback_dialog
2. Dismiss-button heuristic: cross-validates dismiss text with overlay
   container structure to prevent caption false positives

Also removed dead code: xml_dump.lower() no-op.

Fixes: test_perceive_instagram_survey_modal
Zero regressions: 464 passed, 6 pre-existing failures
2026-05-03 16:59:52 +02:00
604f2d7341 fix(perception): avoid skipping first highlight story by differentiating from home feed tray 2026-05-03 16:38:02 +02:00
cd8f35056c fix(perception): structural fast-path skips own profile story ring on home feed to prevent modal traps 2026-05-03 16:35:59 +02:00
800fb1da98 fix(perception): replace string matching with structural feed marker check for perfect snapping 2026-05-03 16:31:32 +02:00
6cd068f951 test(curiosity): force CHECK_CURIOSITY triggering and harden HD Map routing 2026-05-03 16:20:18 +02:00
f46b0b7bcb chore: harden verify_success fallbacks to Fail-Fast and apply aggressive GOAP penalty 2026-05-03 15:42:09 +02:00
5fbbe3d273 feat(e2e): ACHIEVED ABSOLUTE REALISM - 100% Production Parity Purge. Removed all synthetic guards and mocks from core. Enabled honest Qdrant and Disk I/O in tests. Empty KNOWN_DIVERGENCES. 2026-05-03 14:44:01 +02:00
f85d0a8a76 test(e2e): eliminate create_emulator_facade monkeypatching and replace with make_real_device_with_xml where applicable 2026-05-03 13:44:58 +02:00
f0a54d4e20 test(e2e): enforce 100% production-parity in dm_engine and follow verification tests 2026-05-03 11:24:25 +02:00
0a73c35809 purge: eliminate last MagicMock and all lambda dump_hierarchy overrides
- device_emulator.py: Replace MagicMock(watcher) with explicit WatcherStub
  that implements exact u2 watcher chain (when/click/start). Any API drift
  now causes AttributeError instead of silent acceptance.
- test_system_sae.py: Inject XML into emulator state instead of bypassing
  dump_hierarchy with lambda
- test_behavior_ad_guard.py: Pass XML to fixture, remove lambda override
- test_behavior_scrape_profile.py: Pass XML to fixture, remove lambda override

Result: ZERO unittest.mock imports, ZERO MagicMock instances,
ZERO dump_hierarchy lambdas across entire E2E suite (50 files).
2026-05-03 10:21:23 +02:00
e535c10b65 fix(perception): structural fast-path and VLM bounds extraction for Reels 2026-05-02 23:17:12 +02:00
91effbc843 test: add E2E coverage for GOAP trap recovery and restart state reset 2026-05-02 23:11:31 +02:00
3da3849ca1 fix: purge GOAP tracking state when Instagram is forced to restart 2026-05-02 22:50:57 +02:00
51ee7a6793 refactor: remove mock_semantic_engine from q_nav_graph production code 2026-05-02 22:44:53 +02:00
936da47f61 test: SAE execution loop coverage 2026-05-02 22:40:52 +02:00
d1e0995148 test: e2e regression suite for SAE structural fast-paths 2026-05-02 22:40:20 +02:00
2f8eebb7e9 fix: stochastic failure in test_autonomous_goals.py 2026-05-02 22:37:34 +02:00