Skip to content

fix(hooks): wire all 24 hooks, start schedulers, fix threading, add validation - #49

Merged
Cipher208 merged 2 commits into
masterfrom
fix/audit-bugs-hooks
Jul 4, 2026
Merged

Cipher208 merged 2 commits into
masterfrom
fix/audit-bugs-hooks

Conversation

@Cipher208

Copy link
Copy Markdown
Owner

AUDIT_BUGS.md Fixes (10/11 items)

Critical (#1-3): Hook wiring

  • Added _fire_hook safe wrapper (21 calls across tools_layer.py)
  • memory_remember: importance_gate, emotion_trigger, message_received, agent hooks
  • memory_recall/episode_recall: retrieval_router, auto_context
  • memory_episode_save: emotion_trigger, state_delta, consolidation
  • session_start/end: message_received, consolidation, state_delta
  • graph_add: error_occurred, decision_made, personality_shift, emotion_context
  • graph_query: retrieval_router
  • context_inject: auto_context
  • emotion_trigger: fire() + direct fallback

Important (#4-8): Schedulers & threading

  • importance_scheduler started in lifespan with graceful shutdown
  • Periodic forgetting.cleanup() + consolidation.consolidate_staging() (15min)
  • threading.Lock replaced with ThreadPoolExecutor(max_workers=1)
  • _validate_layer() added to all 17 MCP tools

Skipped

Verification

  • 372 tests pass
  • ruff lint clean
  • ruff format clean

…ding, add validation

Critical (AUDIT_BUGS #1-3):
- Add _fire_hook safe wrapper to tools_layer.py
- Wire fire() into memory_remember (importance_gate, emotion_trigger, message_received, agent hooks)
- Wire fire() into memory_recall and memory_episode_recall (retrieval_router, auto_context)
- Wire fire() into memory_episode_save (emotion_trigger, state_delta, consolidation)
- Wire fire() into session_start/end and graph_add/query
- Replace direct emotion_trigger.should_save() with fire() + fallback

Important (AUDIT_BUGS #4-8):
- Start importance_scheduler in lifespan with graceful shutdown
- Add periodic forgetting.cleanup() and consolidation.consolidate_staging() tasks
- Replace threading.Lock with ThreadPoolExecutor(max_workers=1) in hooks/shared.py
- Add _validate_layer() to all 17 MCP tool functions
- Wire context_inject through auto_context hook

21 _fire_hook calls across tools_layer.py
@codecov-commenter

codecov-commenter commented Jul 4, 2026

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 25.00000% with 66 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
mcp_server/tools_layer.py 5.08% 56 Missing ⚠️
mcp_server/server.py 50.00% 10 Missing ⚠️

📢 Thoughts on this report? Let us know!

@Cipher208
Cipher208 merged commit c06a75c into master Jul 4, 2026
18 checks passed
@Cipher208
Cipher208 deleted the fix/audit-bugs-hooks branch July 4, 2026 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants