MCPcopy Create free account
hub / github.com/alibaba/open-code-review / Reason

Method Reason

internal/llmloop/loop.go:272–287  ·  view source on GitHub ↗

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

()

Source from the content-addressed store, hash-verified

270// new constant announces itself in the artifact rather than hiding behind a
271// message that says nothing.
272func (s MainLoopStop) Reason() string {
273 switch s {
274 case StopNone:
275 return "main task stopped before completing"
276 case StopMaxRounds:
277 return "reached the maximum tool-request rounds without finishing"
278 case StopEmptyRounds:
279 return "stopped after repeated rounds without a usable tool result"
280 case StopCompression:
281 return "stopped because context compression exceeded its threshold"
282 case StopTokenBudget:
283 return "reached the aggregate token budget before finishing"
284 default:
285 return fmt.Sprintf("main task stopped for an unrecognized reason (stop=%d)", int(s))
286 }
287}
288
289func (r *Runner) Run(ctx context.Context, messages []llm.Message, taskKey string) (RunResult, error) {
290 completed, stop, err := r.runMainTask(ctx, messages, taskKey)

Calls 1

intFunction · 0.85