fix: exempt reconciler close_pr from branches-only worktree guard (#468)

Reconciler profiles perform Gitea metadata mutations (close_pr) and must
not be blocked when the MCP workspace resolves to the stable control
checkout without GITEA_AUTHOR_WORKTREE. Author file mutations remain
guarded. Add regression tests for reconciler close vs author create_issue.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
This commit is contained in:
2026-07-07 17:36:33 -04:00
co-authored by Claude Opus 4.8
parent f061fee18d
commit c7b462a034
2 changed files with 96 additions and 2 deletions
+7 -2
View File
@@ -399,8 +399,13 @@ def record_preflight_check(type_name: str, resolved_role: str | None = None):
def _enforce_branches_only_author_mutation(worktree_path: str | None = None) -> None:
"""#274: author mutations must run from a branches/ session worktree."""
if _preflight_resolved_role == "reviewer":
"""#274: author file/branch mutations must run from a branches/ worktree.
Reviewer and reconciler roles are exempt: reconciler ``close_pr`` is a
Gitea metadata mutation and must not require ``GITEA_AUTHOR_WORKTREE``
(#468).
"""
if _preflight_resolved_role in ("reviewer", "reconciler"):
return
workspace = author_mutation_worktree.resolve_mutation_workspace(
worktree_path,