Reason is the safe, human-facing sentence for a stop, and the single source of truth for it: the diff-review manifest reason and the scan subtask warning both render this string, so the same stop can never read differently in the two commands' output. Each return is a static literal — never error te
()
| 307 | // new constant announces itself in the artifact rather than hiding behind a |
| 308 | // message that says nothing. |
| 309 | func (s MainLoopStop) Reason() string { |
| 310 | switch s { |
| 311 | case StopNone: |
| 312 | return "main task stopped before completing" |
| 313 | case StopMaxRounds: |
| 314 | return "reached the maximum tool-request rounds without finishing" |
| 315 | case StopEmptyRounds: |
| 316 | return "stopped after repeated rounds without a usable tool result" |
| 317 | case StopCompression: |
| 318 | return "stopped because context compression exceeded its threshold" |
| 319 | default: |
| 320 | return fmt.Sprintf("main task stopped for an unrecognized reason (stop=%d)", int(s)) |
| 321 | } |
| 322 | } |
| 323 | |
| 324 | // RunPerFile drives the main LLM conversation loop for a single file. |
| 325 | // It sends messages with the configured tool definitions, executes any |
no outgoing calls