fix: harden conflict resolution pipeline

This commit is contained in:
lezi-fun committed 2026-08-14 14:18:42 +08:00
1 parent decf7ab8b4
commit 351d3148aa
9 files changed
+273 -55

No files matched your search

+1 -1
View File
@@ -114,7 +114,7 @@ A collaborator with `write`, `maintain`, or `admin` permission can also explicit
Automatic conflict repair applies to current same-repository PR heads. External fork commits remain API-only during `pull_request_target`; a maintainer can explicitly run `/conflict` when the contributor enabled **Allow edits from maintainers**. That trusted comment workflow checks out the PR head without persisted credentials and pushes with an explicit `--force-with-lease` tied to the reviewed head SHA, so a newly pushed contributor commit is never overwritten. Stale heads, non-dirty states, disabled maintainer edits, and failed reviews are skipped. ghbot creates the merge locally, gives goose a sanitized credential-free snapshot, and allows it to change direct conflict files plus related callers, types, tests, lockfiles, configuration, or documentation when necessary for compatibility. Protected agent/configuration and credential paths are rejected.
After applying the proposed files, ghbot verifies there are no unmerged paths and runs `git diff --check`. A second isolated goose pass reviews the complete staged diff and, when configured, runs the trusted `CONFLICT_TEST_COMMAND`. The result is committed and pushed only when that final pass returns `safeToCommit=true` and the remote PR head still matches the reviewed SHA. ghbot never force-pushes. The new commit triggers a fresh `synchronize` review; the old decision is not reused as approval.
After applying the proposed files, ghbot verifies there are no unmerged paths and runs `git diff --check` only on AI-touched files. When configured, a credential-free validation container mounts the candidate read-only, copies it to a disposable workspace, and runs `CONFLICT_TEST_COMMAND` there. Infrastructure failures are reported directly instead of being sent to goose as code-repair requests; a genuine merge-related validation failure permits one focused edit pass followed by one authoritative host rerun. A separate tool-free goose prompt then performs the final read-only staged-diff confirmation. The result is committed and pushed only when that confirmation returns `safeToCommit=true` and the remote PR head still matches the reviewed SHA. Same-repository heads use a normal push; external forks use the SHA-pinned force lease described above. The new commit triggers a fresh `synchronize` review; the old decision is not reused as approval.
## goose configuration