fix(mcp): fail closed when merger lease cannot resolve live PR head
gitea_acquire_merger_pr_lease previously continued when GET /pulls returned an empty head SHA. Fail closed so exact-head scoping never proceeds with an unresolvable live head. Add regression coverage for empty head payloads. Fixes #718 Refs #723
This commit is contained in:
+14
-1
@@ -10821,7 +10821,20 @@ def gitea_acquire_merger_pr_lease(
|
||||
or ""
|
||||
)
|
||||
live_head = str(live_head).strip()
|
||||
if live_head and live_head != head_pin:
|
||||
# Fail closed when live PR head cannot be resolved — never proceed with
|
||||
# an unpinned/unknown head even if candidate_head was supplied (#718).
|
||||
if not live_head:
|
||||
return {
|
||||
"success": False,
|
||||
"acquired": False,
|
||||
"reasons": [
|
||||
"live PR head could not be resolved from GET /pulls response "
|
||||
"(exact-head scoping; fail closed)"
|
||||
],
|
||||
"live_head": None,
|
||||
"candidate_head": head_pin,
|
||||
}
|
||||
if live_head != head_pin:
|
||||
return {
|
||||
"success": False,
|
||||
"acquired": False,
|
||||
|
||||
Reference in New Issue
Block a user