Skip to content

feat: implement approval state machine (Task 13) - #10

Merged
itenev merged 2 commits into
mainfrom
feat/approval-state-machine
Jun 7, 2026
Merged

feat: implement approval state machine (Task 13)#10
itenev merged 2 commits into
mainfrom
feat/approval-state-machine

Conversation

@itenev

@itenev itenev commented Jun 7, 2026

Copy link
Copy Markdown
Owner
Summary
Implements the approval state machine and fatigue prevention logic (Task 13) for action proposals. This ensures operators are not spammed with repeated identical proposals, enforces cooldowns, and automatically escalates when an action times out multiple times.

Type of Change
- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [x] Documentation update

Pre-Review Findings and Resolutions
<!-- Hermes pre-review checklist. Fill this out before requesting human review. -->
- [x] Linting/formatting (ruff check --fix && ruff format) applied before pre-review.
- [x] Any runbook loading/YAML changes include an end-to-end test loading the physical file. (N/A for this PR)
- [x] Design contracts verified (single-writer boundary maintained, no new violations introduced).
- Findings flagged by Hermes: 
  - None. The implementation cleanly separates state machine logic from the database layer and handles edge cases (e.g., already suppressed actions) gracefully.
- Resolutions applied:
  - N/A

Testing
- [x] All existing tests pass (pytest -v --cov=agentic_node_ops --cov=webhook_receiver — 148 tests passed, 90% coverage)
- [x] New tests added for new functionality (tests/test_approval.py includes 12 tests covering fatigue rules, escalation, and proposal grouping)
- [x] Manual verification steps (if applicable): N/A (fully covered by unit tests using temporary in-memory SQLite databases)

Checklist
- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas
- [x] I have made corresponding changes to the documentation (docs/hermes-implementation-plan.md)
- [x] My changes generate no new warnings or errors

loki-hermes-agent[bot] added 2 commits June 7, 2026 23:27
- Add DB methods for action proposals and fatigue prevention
- Create approval.py with cooldown, escalation, and grouping logic
- Add 12 tests covering fatigue rules, escalation, and proposal grouping
- Update hermes-implementation-plan.md to mark Task 13 complete
- Move `import uuid` to module level in database.py
- Fix `Optional[callable]` to `Optional[Callable[..., None]]` in approval.py
- Fix `get_pending_proposals` to use f-string for SQLite datetime parameter
- Add test_should_propose_action_suppressed
- Add test_check_timeout_escalation_no_escalation
- Add test_group_pending_proposals_empty
@itenev
itenev merged commit bdca97e into main Jun 7, 2026
2 checks passed
@itenev
itenev deleted the feat/approval-state-machine branch June 7, 2026 20:42
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