mirror of
https://github.com/mikeyobrien/ralph-orchestrator.git
synced 2026-04-25 15:15:57 +03:00
[GH-ISSUE #66] Feature/question: Per-hat max_activations limit #26
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/ralph-orchestrator#26
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 @cdriscol on GitHub (Jan 17, 2026).
Original GitHub issue: https://github.com/mikeyobrien/ralph-orchestrator/issues/66
Love what you've built here. I've been running my own custom Ralph implementation and was about to build out review/change loops when I found this library. The hat-based event system is exactly what I need — just ran into one edge case I wanted to raise (and I hope this makes sense).
Problem
Feedback loops between hats can cycle indefinitely. For example, a code reviewer requests changes, the executor fixes them but introduces new issues, the reviewer requests more changes, and so on.
The global
max_iterationsdoesn't help here — it limits total cycles but can't distinguish between productive work and a stuck review loop consuming the entire budget.How the loop works
The executor completes implementation and publishes
implementation.done. The code reviewer triggers, reviews the changes, and publishes eitherreview.approvedorreview.changes_requestedwith specific feedback (file paths, line numbers, issues found). The executor triggers onreview.changes_requested, reads the feedback from the event payload, fixes the issues, and publishesimplementation.doneagain. This continues until the reviewer approves — or indefinitely if it never does.Example
When
code_reviewerreaches 3 activations, the orchestrator publishescode_reviewer.exhaustedinstead of activating it again. An escalator hat can trigger on this event to log unresolved issues and terminate gracefully.@mikeyobrien commented on GitHub (Jan 18, 2026):
I like this idea. As a stop-gap, you could instruct Ralph to use
ralph eventsto inspect if stuck and exit, or add to the guardrails section:I also plan to backport the similarity circuit breaker from v1. Somewhat related, but I don't think it will solve what's described here. I have this task locally:
2. Create OutputSimilarityDetector
Create a new module or add to
event_loop.rs:3. Extend EventLoopConfig
Add new fields with serde defaults:
4. Extend TerminationReason
Add variant and implement methods:
5. Integrate into Event Loop
In
EventLoop:detect_loop()after successful iteration output captureOutputSimilaritytermination incheck_termination()6. Add Tracing
When similarity detected:
Acceptance Criteria
Dependency Added
ralph-corecratesimilarcrate is available and compiles successfullyDetector Detects Similar Outputs
detect_loop()returns trueDetector Allows Dissimilar Outputs
detect_loop()returns false and outputs are added to historySliding Window Behavior
Configuration Integration
similarity_threshold: 0.85andsimilarity_window_size: 3Configuration Defaults
Disable Feature
enable_similarity_detection: falseTermination Reason
OutputSimilaritywith exit code 1Tracing Output
Reset Functionality
reset()is calledUnit Test Coverage
cargo testSmoke Test Passes
cargo test -p ralph-core smoke_runnerMetadata
@cdriscol commented on GitHub (Jan 18, 2026):
Nice - I'll play with that later tonight and provide additional feedback when I do. Thanks for the quick reply and putting together a sweet package here.