String names the stop for diagnostics — telemetry attributes, log lines and test failure messages. Without it a MainLoopStop formats as a bare integer, which tells the reader nothing about which exit fired.
()
| 238 | // test failure messages. Without it a MainLoopStop formats as a bare integer, |
| 239 | // which tells the reader nothing about which exit fired. |
| 240 | func (s MainLoopStop) String() string { |
| 241 | switch s { |
| 242 | case StopNone: |
| 243 | return "none" |
| 244 | case StopMaxRounds: |
| 245 | return "max_rounds" |
| 246 | case StopEmptyRounds: |
| 247 | return "empty_rounds" |
| 248 | case StopCompression: |
| 249 | return "compression" |
| 250 | case StopTokenBudget: |
| 251 | return "token_budget" |
| 252 | default: |
| 253 | return fmt.Sprintf("MainLoopStop(%d)", int(s)) |
| 254 | } |
| 255 | } |
| 256 | |
| 257 | // Reason is the safe, human-facing sentence for a stop, and the single source of |
| 258 | // truth for it: the diff-review manifest reason and the scan subtask warning |