mirror of
https://github.com/mikeyobrien/ralph-orchestrator.git
synced 2026-04-24 22:55:57 +03:00
[GH-ISSUE #193] [Feature]: Hat scope enforcement, event chain validation, and human timeout routing #75
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/ralph-orchestrator#75
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @arjhun-personal on GitHub (Feb 25, 2026).
Original GitHub issue: https://github.com/mikeyobrien/ralph-orchestrator/issues/193
Problem
Agents can bypass hat workflow constraints by emitting events outside their hat's declared
publisheslist. In one observed failure mode, an agent skipped human approval, never created tasks, and implemented all phases in a single context window — because nothing enforced the hat's declared scope.Additionally, when
RObot(human-in-the-loop) times out waiting for a response, the timeout is silent — it logs a warning and continues with no event, making it invisible in the event log and unroutable to hats.Proposed Solution
Three layers of defense-in-depth:
Hat scope enforcement — Gate events in
process_events_from_jsonl()against the active hat's declaredpublishespatterns. Out-of-scope events are dropped and replaced with{hat_id}.scope_violationdiagnostic events. Coordination mode (no active hat) retains unrestricted publishing.Event chain validation +
loop.cancel— Newrequired_eventsconfig field andseen_topicstracking.LOOP_COMPLETEis rejected unless all required events have been seen during the loop's lifetime. A separateloop.cancelevent provides clean early termination (human rejection, timeout) without chain validation.Human timeout routing —
wait_for_response()timeout publishes ahuman.timeoutevent instead of silently continuing, making timeouts visible and routable to subscriber hats.All features are opt-in via config (
enforce_hat_scope,cancellation_promise,required_events) — zero behavior change for existing users on upgrade.