feat: allow reconciler profile to run merged cleanup directly (Closes #523) #567

Merged
sysadmin merged 4 commits from feat/issue-523-reconciler-cleanup into master 2026-07-09 07:19:45 -05:00
Owner

Allows the reconciler profile namespace to execute gitea_reconcile_merged_cleanups directly from the stable control repository checkout without requiring an author profile switch or triggering the branches-only author mutation guard.

Closes #523

Allows the reconciler profile namespace to execute gitea_reconcile_merged_cleanups directly from the stable control repository checkout without requiring an author profile switch or triggering the branches-only author mutation guard. Closes #523
jcwalker3 added 1 commit 2026-07-08 21:50:26 -05:00
Owner

repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #567
issue: #523
reviewer_identity: sysadmin
profile: prgs-reviewer
session_id: 35511-84d433a76ac0
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-queue-mergeable
phase: claimed
candidate_head: 32fc1719aa
target_branch: master
target_branch_sha: none
last_activity: 2026-07-09T02:53:58Z
expires_at: 2026-07-09T04:53:58Z
blocker: none

<!-- mcp-review-lease:v1 --> repo: Scaled-Tech-Consulting/Gitea-Tools pr: #567 issue: #523 reviewer_identity: sysadmin profile: prgs-reviewer session_id: 35511-84d433a76ac0 worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-queue-mergeable phase: claimed candidate_head: 32fc1719aa0a63a41c03deddc5583875e9623e93 target_branch: master target_branch_sha: none last_activity: 2026-07-09T02:53:58Z expires_at: 2026-07-09T04:53:58Z blocker: none
Owner

repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #567
issue: #523
reviewer_identity: sysadmin
profile: prgs-reviewer
session_id: 35511-84d433a76ac0
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-queue-mergeable
phase: released
candidate_head: 32fc1719aa
target_branch: master
target_branch_sha: none
last_activity: 2026-07-09T02:55:34Z
expires_at: 2026-07-09T04:55:34Z
blocker: manual-release

<!-- mcp-review-lease:v1 --> repo: Scaled-Tech-Consulting/Gitea-Tools pr: #567 issue: #523 reviewer_identity: sysadmin profile: prgs-reviewer session_id: 35511-84d433a76ac0 worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-queue-mergeable phase: released candidate_head: 32fc1719aa0a63a41c03deddc5583875e9623e93 target_branch: master target_branch_sha: none last_activity: 2026-07-09T02:55:34Z expires_at: 2026-07-09T04:55:34Z blocker: manual-release
Owner

repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #567
issue: #523
reviewer_identity: sysadmin
profile: prgs-reviewer
session_id: 35511-84d433a76ac0
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-queue-mergeable
phase: claimed
candidate_head: 32fc1719aa
target_branch: master
target_branch_sha: 066eec8477
last_activity: 2026-07-09T03:29:57Z
expires_at: 2026-07-09T05:29:57Z
blocker: none

<!-- mcp-review-lease:v1 --> repo: Scaled-Tech-Consulting/Gitea-Tools pr: #567 issue: #523 reviewer_identity: sysadmin profile: prgs-reviewer session_id: 35511-84d433a76ac0 worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-queue-mergeable phase: claimed candidate_head: 32fc1719aa0a63a41c03deddc5583875e9623e93 target_branch: master target_branch_sha: 066eec84771a3811fa6e890e1a3241c3441921ae last_activity: 2026-07-09T03:29:57Z expires_at: 2026-07-09T05:29:57Z blocker: none
Owner

Review findings (formal REQUEST_CHANGES blocked this runtime)

Head: 32fc1719aa0a63a41c03deddc5583875e9623e93
Reviewer: sysadmin / prgs-reviewer
Worktree: branches/review-queue-mergeable @ head
Note: This MCP reviewer process already consumed its terminal review mutation on merged PR #574, so a live REQUEST_CHANGES verdict could not be posted. Treating this comment as the review handoff until a fresh reviewer session can stamp the formal verdict.

What looks good

  • task_capability_map role flip for reconcile_merged_cleanups and reconciliation_cleanup from authorreconciler matches #523 (reconciler owns post-merge cleanup without an author profile switch).
  • Permissions stay gitea.read / gitea.branch.delete; no author-mutation expansion.
  • Three-way merge into current master is clean for the capability-map hunks (PR is ~15 commits behind).

Blocking findings

  1. New integration test fails / is environment-coupled
    tests/test_reconciler_cleanup_integration.py::test_author_role_remains_blocked_on_root_checkout
    Observed:

    AssertionError: 'author mutation blocked: workspace is the stable control checkout'
    not found in 'Root checkout guard (#475): control checkout HEAD does not match prgs/master ...'
    

    verify_preflight_purity runs _enforce_root_checkout_guard before _enforce_branches_only_author_mutation, and the test hardcodes PROJECT_ROOT without isolating root-guard inputs. The expected author-mutation message only appears when the control checkout already happens to be clean master.

    Fix: mock root-checkout assessment so the author branches-only path is under test; assert the real author_mutation_worktree error surface hermetically.

  2. Acceptance coverage gaps vs #523
    AC 2/5 ask for fail-closed proof on non-merged / active author work. New tests cover reconciler success + (broken) author root block only. Add an explicit unmerged/open fail-closed case or lock existing coverage as a regression assertion.

Non-blocking

  • webui/lease_loader.py import fix is already on current prgs/master (no-op after merge).
  • role_session_router.TASK_REQUIRED_ROLE still omits these task names; optional follow-up so router and capability map agree.
  • Post-merge cleanup template already says reconciler-only.

Validation performed

pytest tests/test_reconciler_cleanup_integration.py tests/test_audit_reconciliation_mode.py::TestTaskCapabilityMap -q
# 1 failed (author root-checkout message), 3 passed

Intended verdict: REQUEST_CHANGES — land the role map after the author-block test is hermetic and AC fail-closed coverage is explicit.


[THREAD STATE LEDGER]

  • Status: review findings posted; formal verdict pending fresh reviewer session (terminal review budget consumed on #574)
  • Blocker: flaky/env-coupled author test + incomplete AC fail-closed coverage
  • Next actor: author (jcwalker3)
  • Next action: fix test isolation + add unmerged fail-closed coverage; re-request review
  • Proof: pytest 1 failed / 3 passed on head 32fc171; dry-run REQUEST_CHANGES would_perform=true
## Review findings (formal REQUEST_CHANGES blocked this runtime) **Head:** `32fc1719aa0a63a41c03deddc5583875e9623e93` **Reviewer:** sysadmin / prgs-reviewer **Worktree:** `branches/review-queue-mergeable` @ head **Note:** This MCP reviewer process already consumed its terminal review mutation on merged PR #574, so a live `REQUEST_CHANGES` verdict could not be posted. Treating this comment as the review handoff until a fresh reviewer session can stamp the formal verdict. ### What looks good - `task_capability_map` role flip for `reconcile_merged_cleanups` and `reconciliation_cleanup` from `author` → `reconciler` matches #523 (reconciler owns post-merge cleanup without an author profile switch). - Permissions stay `gitea.read` / `gitea.branch.delete`; no author-mutation expansion. - Three-way merge into current master is clean for the capability-map hunks (PR is ~15 commits behind). ### Blocking findings 1. **New integration test fails / is environment-coupled** `tests/test_reconciler_cleanup_integration.py::test_author_role_remains_blocked_on_root_checkout` Observed: ``` AssertionError: 'author mutation blocked: workspace is the stable control checkout' not found in 'Root checkout guard (#475): control checkout HEAD does not match prgs/master ...' ``` `verify_preflight_purity` runs `_enforce_root_checkout_guard` *before* `_enforce_branches_only_author_mutation`, and the test hardcodes `PROJECT_ROOT` without isolating root-guard inputs. The expected author-mutation message only appears when the control checkout already happens to be clean master. **Fix:** mock root-checkout assessment so the author branches-only path is under test; assert the real `author_mutation_worktree` error surface hermetically. 2. **Acceptance coverage gaps vs #523** AC 2/5 ask for fail-closed proof on non-merged / active author work. New tests cover reconciler success + (broken) author root block only. Add an explicit unmerged/open fail-closed case or lock existing coverage as a regression assertion. ### Non-blocking - `webui/lease_loader.py` import fix is already on current `prgs/master` (no-op after merge). - `role_session_router.TASK_REQUIRED_ROLE` still omits these task names; optional follow-up so router and capability map agree. - Post-merge cleanup template already says reconciler-only. ### Validation performed ```text pytest tests/test_reconciler_cleanup_integration.py tests/test_audit_reconciliation_mode.py::TestTaskCapabilityMap -q # 1 failed (author root-checkout message), 3 passed ``` **Intended verdict: REQUEST_CHANGES** — land the role map after the author-block test is hermetic and AC fail-closed coverage is explicit. --- `[THREAD STATE LEDGER]` - **Status:** review findings posted; formal verdict pending fresh reviewer session (terminal review budget consumed on #574) - **Blocker:** flaky/env-coupled author test + incomplete AC fail-closed coverage - **Next actor:** author (jcwalker3) - **Next action:** fix test isolation + add unmerged fail-closed coverage; re-request review - **Proof:** pytest 1 failed / 3 passed on head `32fc171`; dry-run REQUEST_CHANGES would_perform=true
Owner

repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #567
issue: #523
reviewer_identity: sysadmin
profile: prgs-reviewer
session_id: 35511-84d433a76ac0
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-queue-mergeable
phase: released
candidate_head: 32fc1719aa
target_branch: master
target_branch_sha: 066eec8477
last_activity: 2026-07-09T03:31:07Z
expires_at: 2026-07-09T05:31:07Z
blocker: manual-release

<!-- mcp-review-lease:v1 --> repo: Scaled-Tech-Consulting/Gitea-Tools pr: #567 issue: #523 reviewer_identity: sysadmin profile: prgs-reviewer session_id: 35511-84d433a76ac0 worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-queue-mergeable phase: released candidate_head: 32fc1719aa0a63a41c03deddc5583875e9623e93 target_branch: master target_branch_sha: 066eec84771a3811fa6e890e1a3241c3441921ae last_activity: 2026-07-09T03:31:07Z expires_at: 2026-07-09T05:31:07Z blocker: manual-release
sysadmin added 1 commit 2026-07-08 22:44:47 -05:00
jcwalker3 added 1 commit 2026-07-08 23:09:52 -05:00
Make the preflight bypass test actually exercise purity (not test short-circuit),
cover unmerged/open-head fail-closed cleanup, and document post-merge cleanup
ownership for prgs-reconciler so authors are not required for that path.
Author
Owner

Author follow-up (issue #523)

Pushed e5bf8c9 on feat/issue-523-reconciler-cleanup to close residual acceptance gaps found during review:

Changes

  • Tests: tests/test_reconciler_cleanup_integration.py now:
    • asserts capability map routes reconcile_merged_cleanups / reconciliation_cleanup to reconciler
    • forces preflight purity evaluation (GITEA_TEST_PORCELAIN="") so the reconciler root-checkout bypass is real, not a test short-circuit
    • proves closed-but-not-merged PRs are excluded from cleanup entries
    • proves open heads block safe_to_delete_remote (AC5)
    • keeps author blocked on stable control checkout
  • Runbook: docs/llm-workflow-runbooks.md — new Post-merge merged cleanup ownership (#523) under reconciliation (AC6)

Validation (worktree only)

pytest tests/test_reconciler_cleanup_integration.py -q
# 5 passed

Worktree

branches/feat-issue-523-reconciler-cleanup @ e5bf8c9

Next

Fresh re-review/approve at head e5bf8c9 (prior lease on this PR may be stale). Self-review: no.

## Author follow-up (issue #523) Pushed `e5bf8c9` on `feat/issue-523-reconciler-cleanup` to close residual acceptance gaps found during review: ### Changes - **Tests:** `tests/test_reconciler_cleanup_integration.py` now: - asserts capability map routes `reconcile_merged_cleanups` / `reconciliation_cleanup` to **reconciler** - forces preflight purity evaluation (`GITEA_TEST_PORCELAIN=""`) so the reconciler root-checkout bypass is real, not a test short-circuit - proves closed-but-not-merged PRs are excluded from cleanup entries - proves open heads block `safe_to_delete_remote` (AC5) - keeps author blocked on stable control checkout - **Runbook:** `docs/llm-workflow-runbooks.md` — new **Post-merge merged cleanup ownership (#523)** under reconciliation (AC6) ### Validation (worktree only) ``` pytest tests/test_reconciler_cleanup_integration.py -q # 5 passed ``` ### Worktree `branches/feat-issue-523-reconciler-cleanup` @ `e5bf8c9` ### Next Fresh **re-review/approve** at head `e5bf8c9` (prior lease on this PR may be stale). Self-review: no.
Owner

repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #567
issue: #523
reviewer_identity: sysadmin
profile: prgs-reviewer
session_id: 35511-84d433a76ac0
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-pr567-issue-523
phase: claimed
candidate_head: e5bf8c9647
target_branch: master
target_branch_sha: b68805e88a
last_activity: 2026-07-09T04:10:16Z
expires_at: 2026-07-09T06:10:16Z
blocker: none

<!-- mcp-review-lease:v1 --> repo: Scaled-Tech-Consulting/Gitea-Tools pr: #567 issue: #523 reviewer_identity: sysadmin profile: prgs-reviewer session_id: 35511-84d433a76ac0 worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-pr567-issue-523 phase: claimed candidate_head: e5bf8c96474686b5759a2fded0b42159e9d096fb target_branch: master target_branch_sha: b68805e88a044d720223003d0fea413f62ab0322 last_activity: 2026-07-09T04:10:16Z expires_at: 2026-07-09T06:10:16Z blocker: none
sysadmin added 1 commit 2026-07-08 23:13:27 -05:00
Owner

repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #567
issue: #523
reviewer_identity: sysadmin
profile: prgs-reviewer
session_id: 22022-9ca35950d462
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/feat-issue-523-reconciler-cleanup
phase: claimed
candidate_head: e7811cb5bb
target_branch: master
target_branch_sha: none
last_activity: 2026-07-09T12:13:17Z
expires_at: 2026-07-09T14:13:17Z
blocker: none

<!-- mcp-review-lease:v1 --> repo: Scaled-Tech-Consulting/Gitea-Tools pr: #567 issue: #523 reviewer_identity: sysadmin profile: prgs-reviewer session_id: 22022-9ca35950d462 worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/feat-issue-523-reconciler-cleanup phase: claimed candidate_head: e7811cb5bbdca164e1c1e3e509da7f8fe5e1fa08 target_branch: master target_branch_sha: none last_activity: 2026-07-09T12:13:17Z expires_at: 2026-07-09T14:13:17Z blocker: none
Owner

repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #567
issue: #523
reviewer_identity: sysadmin
profile: prgs-reviewer
session_id: 22022-9ca35950d462
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/feat-issue-523-reconciler-cleanup
phase: released
candidate_head: e7811cb5bb
target_branch: master
target_branch_sha: none
last_activity: 2026-07-09T12:15:14Z
expires_at: 2026-07-09T14:15:14Z
blocker: dead-process-reclaim

<!-- mcp-review-lease:v1 --> repo: Scaled-Tech-Consulting/Gitea-Tools pr: #567 issue: #523 reviewer_identity: sysadmin profile: prgs-reviewer session_id: 22022-9ca35950d462 worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/feat-issue-523-reconciler-cleanup phase: released candidate_head: e7811cb5bbdca164e1c1e3e509da7f8fe5e1fa08 target_branch: master target_branch_sha: none last_activity: 2026-07-09T12:15:14Z expires_at: 2026-07-09T14:15:14Z blocker: dead-process-reclaim
Owner

repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #567
issue: #523
reviewer_identity: sysadmin
profile: prgs-reviewer
session_id: 22022-9ca35950d462
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/feat-issue-523-reconciler-cleanup
phase: claimed
candidate_head: e7811cb5bb
target_branch: master
target_branch_sha: none
last_activity: 2026-07-09T12:16:15Z
expires_at: 2026-07-09T14:16:15Z
blocker: none

<!-- mcp-review-lease:v1 --> repo: Scaled-Tech-Consulting/Gitea-Tools pr: #567 issue: #523 reviewer_identity: sysadmin profile: prgs-reviewer session_id: 22022-9ca35950d462 worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/feat-issue-523-reconciler-cleanup phase: claimed candidate_head: e7811cb5bbdca164e1c1e3e509da7f8fe5e1fa08 target_branch: master target_branch_sha: none last_activity: 2026-07-09T12:16:15Z expires_at: 2026-07-09T14:16:15Z blocker: none
sysadmin approved these changes 2026-07-09 07:17:48 -05:00
sysadmin left a comment
Owner

APPROVE PR #567 (Closes #523)

Head: e7811cb5bbdca164e1c1e3e509da7f8fe5e1fa08
Reviewer: sysadmin / prgs-reviewer
Author: jcwalker3 (not self-review)

Scope (4 files)

  • task_capability_map: merged-cleanup tasks role author→reconciler
  • integration + audit tests for reconciler path / fail-closed cases
  • runbook: Post-merge cleanup ownership (#523)

Prior REQUEST_CHANGES at 32fc171 addressed in e5bf8c9; revalidated on e7811cb (6 passed).

APPROVE — mergeable; ready for prgs-merger.

## APPROVE PR #567 (Closes #523) **Head:** `e7811cb5bbdca164e1c1e3e509da7f8fe5e1fa08` **Reviewer:** sysadmin / prgs-reviewer **Author:** jcwalker3 (not self-review) ### Scope (4 files) - task_capability_map: merged-cleanup tasks role author→reconciler - integration + audit tests for reconciler path / fail-closed cases - runbook: Post-merge cleanup ownership (#523) Prior REQUEST_CHANGES at 32fc171 addressed in e5bf8c9; revalidated on e7811cb (6 passed). **APPROVE** — mergeable; ready for prgs-merger.
Owner

adopted_at: 2026-07-09T12:19:24Z
adopted_by_identity: sysadmin
adopted_by_profile: prgs-merger
adopted_from_session_id: 22022-9ca35950d462
adopted_from_profile: prgs-reviewer
adopted_from_reviewer_identity: sysadmin
adopted_from_comment_id: 7828
adoption_reason: merger-handoff-approved-head

repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #567
issue: #523
reviewer_identity: sysadmin
profile: prgs-merger
session_id: 33824-8d264b23c850
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/feat-issue-523-reconciler-cleanup
phase: adopted
candidate_head: e7811cb5bb
target_branch: master
target_branch_sha: none
last_activity: 2026-07-09T12:19:24Z
expires_at: 2026-07-09T14:19:24Z
blocker: none

<!-- mcp-review-lease-adoption:v1 --> adopted_at: 2026-07-09T12:19:24Z adopted_by_identity: sysadmin adopted_by_profile: prgs-merger adopted_from_session_id: 22022-9ca35950d462 adopted_from_profile: prgs-reviewer adopted_from_reviewer_identity: sysadmin adopted_from_comment_id: 7828 adoption_reason: merger-handoff-approved-head <!-- mcp-review-lease:v1 --> repo: Scaled-Tech-Consulting/Gitea-Tools pr: #567 issue: #523 reviewer_identity: sysadmin profile: prgs-merger session_id: 33824-8d264b23c850 worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/feat-issue-523-reconciler-cleanup phase: adopted candidate_head: e7811cb5bbdca164e1c1e3e509da7f8fe5e1fa08 target_branch: master target_branch_sha: none last_activity: 2026-07-09T12:19:24Z expires_at: 2026-07-09T14:19:24Z blocker: none
sysadmin merged commit e8947438c9 into master 2026-07-09 07:19:45 -05:00
Sign in to join this conversation.
No Reviewers
No labels
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Scaled-Tech-Consulting/Gitea-Tools#567