diff options
| author | soryu <soryu@soryu.co> | 2026-01-24 00:52:28 +0000 |
|---|---|---|
| committer | soryu <soryu@soryu.co> | 2026-01-24 00:52:28 +0000 |
| commit | cb2aa9a73163ce392d7c3f1dd81888b039312a67 (patch) | |
| tree | 4b124f0f8ab3762140fa8b7ed2e0370e479fedae /makima/src/server/state.rs | |
| parent | 579c983d3efb8f1414ffb45b9e031f741cce5f76 (diff) | |
| download | soryu-cb2aa9a73163ce392d7c3f1dd81888b039312a67.tar.gz soryu-cb2aa9a73163ce392d7c3f1dd81888b039312a67.zip | |
feat: Add maximum iterations limit for autonomous loop mode
Adds configurable iteration limits to prevent runaway autonomous loops
and provide predictable behavior, inspired by Ralph's design patterns.
Changes:
- Add AutonomousLoopConfig to daemon config with:
- default_max_iterations: 10 (default for new tasks)
- hard_limit: 50 (absolute maximum that cannot be exceeded)
- no_change_threshold: 3 (consecutive runs without progress)
- same_error_threshold: 5 (consecutive runs with same error)
- Add max_iterations and iteration_count fields to Task model
- Add iteration_limit_reached status to TaskStatus enum
- Pass max_iterations through DaemonCommand::SpawnTask
- Apply limits in CircuitBreaker during autonomous loop execution
When a task hits the iteration limit:
- Task status is set to "iteration_limit_reached" (not "failed")
- Clear message is logged about hitting the limit
- Task can be resumed with a higher limit if needed
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Diffstat (limited to 'makima/src/server/state.rs')
| -rw-r--r-- | makima/src/server/state.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/makima/src/server/state.rs b/makima/src/server/state.rs index 5b75281..1c22088 100644 --- a/makima/src/server/state.rs +++ b/makima/src/server/state.rs @@ -223,6 +223,9 @@ pub enum DaemonCommand { /// Commit SHA to apply the patch on top of #[serde(rename = "patchBaseSha", default, skip_serializing_if = "Option::is_none")] patch_base_sha: Option<String>, + /// Maximum iterations for autonomous loop mode + #[serde(rename = "maxIterations", default, skip_serializing_if = "Option::is_none")] + max_iterations: Option<u32>, }, /// Pause a running task PauseTask { |
