You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When posting inline PR review comments via POST /repos/{owner}/{repo}/pulls/{pull_number}/comments, the runner sometimes fails the entire job with exit code 1 if GitHub returns 422 with:
{
"message": "Validation Failed",
"errors": [{
"resource": "PullRequestReviewComment",
"code": "custom",
"field": "pull_request_review_thread.line",
"message": "could not be resolved"
}]
}
GithubProvider.setPullRequestComments (dist/provider/github.js) currently throws after any failed post, which breaks CI even when the review itself succeeded and only anchoring failed.
Actual diff hunk (develop vs main) only touches lines around 27–30 (addition of INfseEmissaoProvider registration at ~line 30)
Line 26 is outside the diff hunk → GitHub cannot resolve the thread line
The model cited line 26 (context); the actionable change in the patch is on another line.
Current behavior
// dist/provider/github.js — setPullRequestCommentsconstresponse=awaitthis.client.restPost(path,{
body,commit_id: sha,path: filePath,line: review.lineNumber,side: 'RIGHT',});// on failure: failures.push(...); then throw if failures.length > 0
Leading / on fileName is already stripped (replace(/^\/+/, '')) — not the root cause here.
No validation that lineNumber is inside a diff hunk for commit_id + path.
Expected behavior
Before POST: resolve whether (path, line, side, commit_id) is commentable on this PR (e.g. fetch PR files / patch from REST or compare with diff produced by the same getDiffBreakdown pipeline used for the agent).
On mismatch: remap to the nearest valid line in the same hunk (prefer added/changed lines), or fall back to a non-inline channel (review body / summary) instead of failing the whole run.
On GitHub 422: treat as partial publish — log ::warning::, continue with other comments, do not throw unless all comments failed or auth/system errors occur.
Align with documented intent: review findings should not fail CI; exit 1 only for true system errors (auth, missing SHA, agent crash).
Optional: POST .../pulls/{pull_number}/reviews with comments array after validating each position.
Add unit tests with a fixture patch where the model line is off-by-N from the hunk.
Consider prompting the agent to prefer line numbers from the diff hunks only (secondary; server-side validation should still be authoritative).
Workaround (consumer-side, temporary)
ERP.Fiscal added CURSOR_REVIEWER_EXTRA_EXCLUDE_PATTERNS and a workflow wrapper that exits 0 when the log contains could not be resolved — this should be removed once this issue is fixed upstream.
Environment
Runner: run.sh from main, clones release branch
Provider: --gh, GitHub Actions, GITHUB_TOKEN with pull-requests: write
Summary
When posting inline PR review comments via
POST /repos/{owner}/{repo}/pulls/{pull_number}/comments, the runner sometimes fails the entire job with exit code 1 if GitHub returns 422 with:{ "message": "Validation Failed", "errors": [{ "resource": "PullRequestReviewComment", "code": "custom", "field": "pull_request_review_thread.line", "message": "could not be resolved" }] }GithubProvider.setPullRequestComments(dist/provider/github.js) currently throws after any failed post, which breaks CI even when the review itself succeeded and only anchoring failed.Reproduction (consumer: ERP.Fiscal)
src/ERP.Fiscal.PlugNotas/Extensions/PlugNotasServiceCollectionExtensions.csline 26INfseEmissaoProviderregistration at ~line 30)The model cited line 26 (context); the actionable change in the patch is on another line.
Current behavior
/onfileNameis already stripped (replace(/^\/+/, '')) — not the root cause here.lineNumberis inside a diff hunk forcommit_id+path.Expected behavior
(path, line, side, commit_id)is commentable on this PR (e.g. fetch PR files / patch from REST or compare with diff produced by the samegetDiffBreakdownpipeline used for the agent).::warning::, continue with other comments, do not throw unless all comments failed or auth/system errors occur.Suggested implementation notes
commit_id.POST .../pulls/{pull_number}/reviewswith comments array after validating each position.Workaround (consumer-side, temporary)
ERP.Fiscal added
CURSOR_REVIEWER_EXTRA_EXCLUDE_PATTERNSand a workflow wrapper that exits 0 when the log containscould not be resolved— this should be removed once this issue is fixed upstream.Environment
run.shfrommain, clonesreleasebranch--gh, GitHub Actions,GITHUB_TOKENwithpull-requests: write