Commit Graph

22 Commits

Author SHA1 Message Date
cf21dd3f76 fix(navigation): purge permanent trap dead-ends & clear UNKNOWN traps
ROOT CAUSE:
The bot would permanently softlock itself on UNKNOWN screens (like Trending Audio/Reels)
because 'is_trap' had NO time-decay, and UNKNOWN screen traps persisted forever.
Once 'press back' was trapped on an UNKNOWN screen, the bot was permanently blocked
from escaping any future UNKNOWN screen, causing endless restart loops.

FIXES:
1. Trap Time-Decay: 'is_trap' now forgives Qdrant-persisted traps older than 30 minutes.
   This mirrors ContextMemory and prevents permanent dead-ends.
2. UNKNOWN Guard: 'learn_trap' now REFUSES to persist traps for UNKNOWN screens to Qdrant.
   They only live in-memory to prevent breaking global navigation.
3. In-Memory Purge: 'force start instagram' now properly calls 'clear_traps()' to wipe
   the planner's in-memory traps. Previously they survived restarts, immediately
   re-trapping the bot.

Purged 6 ancient traps from Qdrant (one was 8 days old!).
TDD: 3 new tests, full suite 113/114 (1 infra flake)
2026-05-05 16:42:34 +02:00
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
b626dc6488 feat(navigation): add structural identity and transitions for NOTIFICATIONS trap 2026-05-05 13:05:46 +02:00
5ada31c77e feat(navigation): harden obstacle guard and intent resolver against keyboard hallucinations 2026-05-05 10:52:38 +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
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
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
0e43996ccd feat(orchestrator): wire GoalDecomposer into bot_flow.py
Replace the old dual-path orchestrator (abstract goals vs legacy desires)
with unified GoalDecomposer-driven task routing:

1. GoalDecomposer reads mission.strategy + plugins config
2. Generates weighted Task objects (verb, target_screen, budget)
3. GrowthBrain.select_task() picks one probabilistically
4. Selected Task's target_screen routes through existing nav_graph
5. Feed loops + PluginRegistry handle the actual interactions

The abstract goals path (goal_executor.achieve('Nurture community'))
that caused infinite scrolling is now eliminated entirely.

Legacy desire fallback preserved for configs without plugins.

22/22 tests passing.
2026-04-29 17:20:04 +02:00
b6846ab0fe feat(brain): add GrowthBrain.select_task() + kill abstract goals config
- GrowthBrain.select_task() uses weighted random from concrete Task objects
- Removed self.goals from Config (no longer reads goals: from config.yml)
- Mission + plugins are now the SSOT for bot behavior

The bot no longer receives abstract strings like 'Nurture my community' that
the LLM Brain can't operationalize. Instead, the GoalDecomposer generates
Task(browse_feed, HomeFeed, budget=7) which routes to concrete feed loops.

18/18 TDD tests passing.
2026-04-29 17:17:39 +02:00
6db579f45b feat(goals): add GoalDecomposer — pure-logic task planner from mission+plugins
Introduces the GoalDecomposer class that bridges mission.strategy + plugin
capabilities into concrete, weighted Task objects. Each Task has a target
screen, budget, weight, and human-readable intent.

Key design decisions:
- Pure logic, zero LLM/device dependencies
- Strategy weights (aggressive_growth, community_builder, etc.) drive selection
- Plugins declare which screens they operate on (multi-screen map)
- Screens need BOTH an action route AND active plugin to be viable
- Frozen dataclass ensures Task immutability

12/12 TDD tests passing.
2026-04-29 17:15:17 +02:00
a7449a1db3 chore(test): Ruthless deletion of ALL remaining MagicMocks and patches across the entire test suite 2026-04-27 16:50:26 +02:00
42eabb7bda fix: implement wipe_all_ai_caches, harden blank_start imports, purge root garbage
- Implement wipe_all_ai_caches() in qdrant_memory.py (was a phantom function
  referenced but never created, causing ERROR on every blank_start)
- Move imports OUT of try/except in bot_flow.py blank_start block so that
  ImportError/NameError crash loudly instead of being silently swallowed
- Add Production Integrity Guard (check_production_integrity) to detect
  MagicMock poisoning at startup
- Add missing TelepathicEngine import in bot_flow.py
- Fix conftest.py: move sys.modules monkeypatching into session fixture
  to prevent global environment poisoning on test import
- Add TDD test test_wipe_all_ai_caches.py proving importability and
  correct wipe behavior across all 8 global Qdrant collections
- Delete root garbage: patch_sae_tests.py, test_debug.py, test_mock.py,
  tmp_bot_flow.py, test_e2e_output*.txt
2026-04-25 21:43:53 +02:00
144d6401b5 feat: complete modular plugin refactor with 100% E2E coverage for interactions 2026-04-25 20:58:07 +02:00
30724d3c03 chore: FSD stabilization, strict TDD enforcement, and unlearn mechanism
- implemented self-healing unlearn for Qdrant false positives
- centralized testing logic in conftest
- documented core rules, ai standards, and goap philosophy
- purged old dev scratchpads
2026-04-24 13:28:32 +02:00
75009d91a2 feat(navigation): Implement 100% autonomous Blank Start architecture; purge heuristics 2026-04-22 00:05:03 +02:00
0a02e901b6 fix(feed): resolve home feed back-button scroll-to-top trap
- Separated obstacle detection from feed marker validation
- Prevented blind BACK button presses when markers are missing mid-scroll
- Added TDD verification for feed navigation stability
- Cleaned up debug artifacts and temporary test output
2026-04-21 02:00:01 +02:00
2c6404f387 feat: stabilize autonomous instagram bot suite (100% green)
Summary of work:
- Resolved mass SystemExit: 2 failures by hardening Config against pytest CLI args.
- Fixed state leakage in test suite by implementing aggressive cache wiping in conftest.py.
- Fixed TypeErrors and UnboundLocalErrors in TelepathicEngine and bot_flow.
- Aligned MockTelepathicEngine signatures to resolve Mock Drift.
- Achieved 100% pass rate across 498 tests.
2026-04-20 15:11:49 +02:00
fc3209bdc1 test: stabilize E2E coverage and GOAP fallback logic
- Refactored 'test_navigation_resilience.py' to produce structurally valid mock XML dynamically responding to app_start resets.
- Patched 'bot_flow.py' interaction lifecycle to handle cognitively deficient test scenarios gracefully.
- Migrated 'device_facade_full.py' assertions to shell-first interaction schemas (adb shell input).
- Stabilized legacy unit tests against structurally strict 'TelepathicEngine' dimension checks.
2026-04-20 00:33:27 +02:00
ba4d7ffda2 chore: migrate autonomous navigation to GOAP and finalize 100% E2E test stabilization
- Delegate legacy BFS navigation to structure-based GOAP system
- Harden Situational Awareness Engine (SAE) for modal and obstacle clearance
- Fix device sizing calculations during mocked humanized scrolls
- Remove deprecated V8 test stubs and legacy debug entrypoints
- Stabilize Telepathic Engine context parsing thresholds
Result: 66/66 E2E and integration tests passing
2026-04-19 22:14:56 +02:00
0aeed11186 Hardening autonomous navigation: Implemented Modal Guards, Transient Drift Protection (WhatsApp fix), and Aggressive Recovery paths. Cleaned up diagnostic artifacts. 2026-04-17 12:57:12 +02:00