feat: require live PR head re-pin before conflict-fix classification (Closes #522)

Treat inventory mergeable/head as advisory. Add classification helper and
MCP tool so author sessions re-pin the live PR head before creating a
conflict-fix worktree, skip stale inventory false-negatives, and prove
classification in final reports.
This commit is contained in:
2026-07-08 22:30:21 -04:00
parent 81822da04d
commit add87b5708
7 changed files with 505 additions and 1 deletions
+35
View File
@@ -827,6 +827,7 @@ import reconciliation_workflow # noqa: E402
import audit_reconciliation_mode # noqa: E402
import review_merge_state_machine # noqa: E402
import pr_work_lease # noqa: E402
import conflict_fix_classification # noqa: E402
import native_mcp_preference # noqa: E402
import worktree_cleanup_audit # noqa: E402
@@ -8209,6 +8210,40 @@ def gitea_acquire_conflict_fix_lease(
}
@mcp.tool()
def gitea_assess_conflict_fix_classification(
pr_number: int,
inventory_head_sha: str | None = None,
inventory_mergeable: bool | None = None,
live_head_sha: str | None = None,
live_mergeable: bool | None = None,
) -> dict:
"""Read-only: classify conflict-fix need from live PR state (#522).
Open PR inventory can be stale. Callers must pass a live re-fetched PR head
and mergeability value before creating a conflict-fix worktree.
"""
read_block = _profile_operation_gate("gitea.read")
if read_block:
return {
"success": False,
"performed": False,
"reasons": read_block,
"permission_report": _permission_block_report("gitea.read"),
}
result = conflict_fix_classification.assess_conflict_fix_classification(
pr_number=pr_number,
inventory_head_sha=inventory_head_sha,
inventory_mergeable=inventory_mergeable,
live_head_sha=live_head_sha,
live_mergeable=live_mergeable,
)
result["success"] = True
result["performed"] = False
return result
@mcp.tool()
def gitea_assess_conflict_fix_push(
pr_number: int,