Skip to content

Fix: Record refusals in admit_event and add persistence test - #24

Open
ranjani-cse wants to merge 1 commit into
theschoolofai:mainfrom
ranjani-cse:fix-refusal-persistence
Open

ranjani-cse wants to merge 1 commit into
theschoolofai:mainfrom
ranjani-cse:fix-refusal-persistence

Conversation

@ranjani-cse

Copy link
Copy Markdown

What breaks

Refusals in the autonomy governor leave no persistent trace. A defended night and an idle night look identical because there is no record of what was refused.

Steps to reproduce

  1. Trigger an event that the governor refuses (e.g., an event from a self-actor or exceeding rate limit)
  2. Check get_refusal_history() → returns empty or no record of the refusal

Test that fails before fix: proofs/test_refusal_persistence.py

The fix

Added _record_refusal method and updated admit_event to record refusals:

def _record_refusal(self, event, reason, verdict_type="refusal"):
    refusal_entry = {
        "timestamp": datetime.now(UTC).isoformat(),
        "event_id": getattr(event, "id", "unknown"),
        "source": getattr(event, "source", "unknown"),
        "actor": getattr(event, "actor", ""),
        "reason": reason,
        "type": verdict_type,
    }
    self.store.record_refusal(refusal_entry)

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