(maxIdenticalReads: number)
| 117 | * some local servers, crashing the model under sustained load). |
| 118 | */ |
| 119 | export function readLoopAction(maxIdenticalReads: number): 'none' | 'summarize' | 'abort' { |
| 120 | if (maxIdenticalReads >= 5) return 'abort'; |
| 121 | if (maxIdenticalReads >= 3) return 'summarize'; |
| 122 | return 'none'; |
| 123 | } |
| 124 | |
| 125 | /** |
| 126 | * Detect "stuck" loops in the recent tool-call history. Two shapes: |
no outgoing calls
no test coverage detected