{"record":{"id":"f63970576a1d1c9f","repo":"alibaba/open-code-review","slug":"ocr-subtask-error-for-group-q-v","errorCode":null,"errorMessage":"[ocr] Subtask error for group %q: %v","messagePattern":"\\[ocr\\] Subtask error for group %q: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/agent/agent.go","lineNumber":773,"sourceCode":"\t\t\t\t\t\tif comments := a.args.CommentCollector.CommentsForPath(d.NewPath); len(comments) > 0 {\n\t\t\t\t\t\t\ta.markCompleted(d)\n\t\t\t\t\t\t\ta.session.RecordReviewItemDone(d.NewPath, d.OldPath, d.NewPath, fingerprint, comments)\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\t\t\t\t\t\ta.markFailed(d, stop.class, stop.reason)\n\t\t\t\t\t\tif stop.checkpoint != \"\" {\n\t\t\t\t\t\t\ta.session.RecordReviewItemFailed(d.NewPath, d.OldPath, d.NewPath, fingerprint, stop.checkpoint)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfailedCount++\n\t\t\t\t\t}\n\t\t\t\t\t// subtaskFailed must count only the files actually marked failed\n\t\t\t\t\t// above, not the whole group — a group can mix Completed and\n\t\t\t\t\t// Failed files, and reportAsError itself is a group-level signal\n\t\t\t\t\t// (any file with comments suppresses it) that must not be assumed\n\t\t\t\t\t// to imply failedCount == len(g.Diffs).\n\t\t\t\t\tif stop.reportAsError && failedCount > 0 {\n\t\t\t\t\t\tatomic.AddInt64(&a.subtaskFailed, failedCount)\n\t\t\t\t\t\tstopErr := errors.New(stop.checkpoint)\n\t\t\t\t\t\tfmt.Fprintf(stdout.Writer(), \"[ocr] Subtask error for group %q: %v\\n\", g.Label, stopErr)\n\t\t\t\t\t\ttelemetry.ErrorEvent(groupCtx, \"subtask.error\", stopErr,\n\t\t\t\t\t\t\ttelemetry.AnyToAttr(\"group.label\", g.Label))\n\t\t\t\t\t\ta.recordWarning(\"subtask_error\", g.Label, stopErr.Error())\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn\n\t\t\t}\n\t\t\tfor _, d := range g.Diffs {\n\t\t\t\tfingerprint := reviewItemFingerprint(a.reviewMode(), d)\n\t\t\t\tcomments := a.args.CommentCollector.CommentsForPath(d.NewPath)\n\t\t\t\ta.markCompleted(d)\n\t\t\t\ta.session.RecordReviewItemDone(d.NewPath, d.OldPath, d.NewPath, fingerprint, comments)\n\t\t\t}\n\t\t}(group)\n\t}\n\n\twg.Wait()","sourceCodeStart":755,"sourceCodeEnd":791,"githubUrl":"https://github.com/alibaba/open-code-review/blob/5cf97d0d15cbd41b602513c4be3bfec3cee5bf7f/internal/agent/agent.go#L755-L791","documentation":"The agent's parallel subtask runner reports a group-level failure: when stop.reportAsError is set and at least one file in the group failed, the checkpoint message becomes an error, is logged to stdout, emitted as a telemetry event, and recorded as a warning. It is a progress/status notification for a subtask group, not a fatal process error — the group can mix Completed and Failed files.","triggerScenarios":"A subtask group's stop signal sets reportAsError (no file in the group produced comments, so reportAsError stays true) while failedCount > 0 — i.e. some diffs in the group errored during review.","commonSituations":"LLM API outages or rate limits failing individual file reviews within a parallel group; a diff file too large to process; checkpoint criteria unmet because the group aborted midway.","solutions":["Inspect the recorded warning key 'subtask_error' and telemetry 'subtask.error' events for the failing group label to find root per-file errors.","Retry the run if the cause was a transient provider error (rate limits, network).","Check group.Diffs for files exceeding size/token limits and exclude or split them.","If subtask failures should not surface as group errors, adjust the stop/reportAsError criteria so Completed files suppress the group-level error."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if stop.reportAsError && failedCount > 0 {\n    atomic.AddInt64(&a.subtaskFailed, failedCount)\n    stopErr := errors.New(stop.checkpoint)\n    fmt.Fprintf(stdout.Writer(), \"[ocr] Subtask error for group %q: %v\\n\", g.Label, stopErr)\n    telemetry.ErrorEvent(groupCtx, \"subtask.error\", stopErr, telemetry.AnyToAttr(\"group.label\", g.Label))\n    a.recordWarning(\"subtask_error\", g.Label, stopErr.Error())\n}","preventionTips":["Monitor the 'subtask.error' telemetry event and 'subtask_error' warnings per group label","Add retry/backoff for LLM provider calls inside subtasks to survive transient outages","Exclude or pre-check oversized diffs so individual file failures do not fail the group","Remember reportAsError is group-level: files with comments suppress it — design checkpoints accordingly"],"tags":["agent","concurrency","telemetry","go"],"backgroundTag":"subtask-group-failure","analyzedSha":"5cf97d0d15cbd41b602513c4be3bfec3cee5bf7f","analyzedAt":"2026-09-02T02:08:09.116Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}