Skip to content

feat: wire dispatcher to Hermes agent loop (Task 9)#3

Merged
itenev merged 2 commits into
mainfrom
feat/wire-dispatcher-loop
Jun 6, 2026
Merged

feat: wire dispatcher to Hermes agent loop (Task 9)#3
itenev merged 2 commits into
mainfrom
feat/wire-dispatcher-loop

Conversation

@loki-hermes-agent

@loki-hermes-agent loki-hermes-agent Bot commented Jun 6, 2026

Copy link
Copy Markdown

Summary

Wires the dispatcher to the Hermes agent loop (Task 9), and addresses review feedback.

Changes

  • src/agentic_node_ops/database.py: SQLite WAL wrapper, sole writer, implements full schema
  • src/agentic_node_ops/processor.py:
    • Reads alerts.jsonl from last_read_offset, inserts to SQLite, builds NotificationPayload, dispatches via NotificationDispatcher, updates offset atomically
    • Review fix: Replaced per-cycle asyncio.run() with a single persistent event loop (_run_loop_async) to maintain httpx connection pools
    • Review fix: Swapped time.sleep for asyncio.sleep for better cancellation handling
    • Review fix: Added sqlite3.IntegrityError catch to advance offset on UNIQUE constraint violations, preventing infinite retry loops
    • Review fix: Clarified comment that notification dispatch failures (captured in NotificationResult) do not trigger the offset-rollback path
  • tests/test_database.py & tests/test_processor.py: 13 unit tests covering database operations, offset management, payload building, async processing loop, and duplicate incident handling
  • docs/hermes-implementation-plan.md: Updated to mark Task 9 complete

Testing

All 43 tests passing.

Checklist

  • Tests pass
  • Implementation plan updated
  • Review feedback addressed

loki-hermes-agent[bot] added 2 commits June 7, 2026 01:11
- Create src/agentic_node_ops/database.py: SQLite WAL wrapper, sole writer, implements full schema (incidents, host_fingerprints, operator_corrections, runbook_outcomes, action_proposals)
- Create src/agentic_node_ops/processor.py: reads alerts.jsonl from last_read_offset, inserts to SQLite, builds NotificationPayload, dispatches via NotificationDispatcher, updates offset atomically (tempfile + rename)
- Add 12 unit tests covering database operations, offset management, payload building, and async processing loop
- Update docs/hermes-implementation-plan.md to mark Task 9 complete
- Replace per-cycle asyncio.run() with single persistent event loop (_run_loop_async) to maintain httpx connection pools
- Use asyncio.sleep instead of time.sleep for better cancellation handling
- Remove redundant import time from run_processor_loop
- Add sqlite3.IntegrityError catch to advance offset on UNIQUE constraint violations, preventing infinite retry loops
- Update comment to clarify that notification dispatch failures (captured in NotificationResult) do not trigger the offset-rollback path
- Add test_process_alerts_async_duplicate_incident to verify duplicate handling
@itenev
itenev merged commit 27d3fc2 into main Jun 6, 2026
2 checks passed
@itenev
itenev deleted the feat/wire-dispatcher-loop branch June 6, 2026 22:34
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.

1 participant