fix: make review posting deterministic - #138
Conversation
Add per-process review submission guards, hard turn limits for both review passes, and move validated GitHub review posting into a deterministic CI step. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
|
Droid finished @factory-nizar's task —— View job The deterministic posting flow has two high-confidence gaps: it does not pin the review to the validated head commit, and the file-only validator still exposes a write-capable GitHub token to shell execution. |
| startLine: startLine !== null && startLine < anchor ? startLine : null, | ||
| side, | ||
| old_path: asNonEmptyString(comment.old_path), | ||
| old_line: oldLine, |
There was a problem hiding this comment.
[P1] Pin the review to the validated commit
The validator emits commit_id, but this parser drops it, so the deterministic GitHub posting request defaults to the PR's latest head. If a commit is pushed after pr.diff is generated, GitHub resolves the old anchors against the new head and can reject the atomic review or attach findings to different code; preserve the validated SHA and pass it as the review's top-level commit_id.
| context, | ||
| }); | ||
| const allowedTools = Array.from(new Set(baseTools)); | ||
| const mcpTools = JSON.stringify({ mcpServers: {} }); |
There was a problem hiding this comment.
[P1] [security] Remove GitHub credentials from the validator process
The file-only validator still enables Execute, and every action variant passes GITHUB_TOKEN into the Droid process running with unsafe permission skipping. A prompt injection in the required-to-read PR diff can therefore invoke the GitHub API directly with that token, bypassing this empty MCP configuration and the claimed single deterministic posting call; omit the token from the validator process and expose it only to preparation and posting steps.
Summary
submit_reviewatomic and idempotent per MCP process, with a hard refusal after a successful or in-flight submissionreview_validated.jsonthrough one deterministic GitHub API callValidation
bun test(618 passed)bun run typecheckbun run format:checkgit diff --check