handleMaxIterationsAutoApprove decides whether to auto-extend iterations in --yolo mode. Returns maxIterContinue (approved), maxIterStop (cap reached), or maxIterPrompt (not in auto-approve mode, caller should ask the user).
(autoApprove bool, autoExtensions *int, maxIter int)
| 51 | // --yolo mode. Returns maxIterContinue (approved), maxIterStop (cap reached), |
| 52 | // or maxIterPrompt (not in auto-approve mode, caller should ask the user). |
| 53 | func handleMaxIterationsAutoApprove(autoApprove bool, autoExtensions *int, maxIter int) maxIterAction { |
| 54 | if !autoApprove { |
| 55 | return maxIterPrompt |
| 56 | } |
| 57 | *autoExtensions++ |
| 58 | if *autoExtensions <= maxAutoExtensions { |
| 59 | slog.Info("Auto-extending iterations in yolo mode", |
| 60 | "extension", *autoExtensions, |
| 61 | "max_extensions", maxAutoExtensions, |
| 62 | "current_max", maxIter) |
| 63 | return maxIterContinue |
| 64 | } |
| 65 | slog.Warn("Max auto-extensions reached in yolo mode, stopping", |
| 66 | "total_extensions", *autoExtensions) |
| 67 | return maxIterStop |
| 68 | } |
| 69 | |
| 70 | // Config holds configuration for running an agent in CLI mode |
| 71 | type Config struct { |