fix: bind issue comments to explicit worktree path (Closes #560) #561

Merged
sysadmin merged 1 commits from fix/issue-560-issue-comment-worktree-path into master 2026-07-08 21:09:01 -05:00
Owner

Summary

Closes #560.

gitea_create_issue_comment was subject to the branches-only mutation guard but had no worktree_path parameter, so author sessions could not post canonical issue evidence comments from an isolated branches/ worktree when the runtime binding pointed at the stable root checkout.

Fix

  • Add optional worktree_path to gitea_create_issue_comment MCP schema/signature.
  • Pass it into verify_preflight_purity(..., worktree_path=..., task="comment_issue") so the existing role/workspace mutation path can accept a proven branches/ worktree.
  • Does not weaken identity, role, profile, capability, or org/repo mismatch checks.

Tests

tests/test_issue_comment_workspace_guard.py (5 passed):

  • succeeds with a valid branches/ worktree path
  • fails from root/control checkout without valid binding
  • fails closed for invalid or outside-root worktree paths
  • still requires role/capability checks
  • still works with explicit org/repo

Validation:

venv/bin/python -m pytest tests/test_issue_comment_workspace_guard.py -q
# 5 passed
py_compile ok; git diff --check clean

Recovery note

Prior author session finished the commit (bd22135) then the author_issue_work lease expired before push/PR. Same claimant (jcwalker3), same branch and worktree; lease was refreshed after recovery review of local state (commit complete, worktree clean, no competing PR/branch). Head SHA unchanged from the finished commit.

LLM Handoff Metadata

  • LLM-Role: implementer
  • Authenticated-Gitea-User: jcwalker3
  • MCP-Profile: prgs-author
  • Branch: fix/issue-560-issue-comment-worktree-path
  • Head: bd22135906
  • Worktree: branches/issue-560-issue-comment-worktree-path
  • Self-review allowed: no
## Summary Closes #560. `gitea_create_issue_comment` was subject to the branches-only mutation guard but had no `worktree_path` parameter, so author sessions could not post canonical issue evidence comments from an isolated `branches/` worktree when the runtime binding pointed at the stable root checkout. ## Fix - Add optional `worktree_path` to `gitea_create_issue_comment` MCP schema/signature. - Pass it into `verify_preflight_purity(..., worktree_path=..., task="comment_issue")` so the existing role/workspace mutation path can accept a proven `branches/` worktree. - Does not weaken identity, role, profile, capability, or org/repo mismatch checks. ## Tests `tests/test_issue_comment_workspace_guard.py` (5 passed): - succeeds with a valid `branches/` worktree path - fails from root/control checkout without valid binding - fails closed for invalid or outside-root worktree paths - still requires role/capability checks - still works with explicit `org`/`repo` Validation: ``` venv/bin/python -m pytest tests/test_issue_comment_workspace_guard.py -q # 5 passed py_compile ok; git diff --check clean ``` ## Recovery note Prior author session finished the commit (`bd22135`) then the `author_issue_work` lease expired before push/PR. Same claimant (`jcwalker3`), same branch and worktree; lease was refreshed after recovery review of local state (commit complete, worktree clean, no competing PR/branch). Head SHA unchanged from the finished commit. ## LLM Handoff Metadata - LLM-Role: implementer - Authenticated-Gitea-User: jcwalker3 - MCP-Profile: prgs-author - Branch: fix/issue-560-issue-comment-worktree-path - Head: bd22135906772481e8f4617bbe4da669137f0e5c - Worktree: branches/issue-560-issue-comment-worktree-path - Self-review allowed: no
jcwalker3 added 1 commit 2026-07-08 20:44:49 -05:00
Owner

repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #561
issue: #560
reviewer_identity: sysadmin
profile: prgs-reviewer
session_id: 34818-7c9659f8a1cd
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-pr561
phase: claimed
candidate_head: bd22135906
target_branch: master
target_branch_sha: 18e7d7b6e1
last_activity: 2026-07-09T01:57:40Z
expires_at: 2026-07-09T03:57:40Z
blocker: none

<!-- mcp-review-lease:v1 --> repo: Scaled-Tech-Consulting/Gitea-Tools pr: #561 issue: #560 reviewer_identity: sysadmin profile: prgs-reviewer session_id: 34818-7c9659f8a1cd worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-pr561 phase: claimed candidate_head: bd22135906772481e8f4617bbe4da669137f0e5c target_branch: master target_branch_sha: 18e7d7b6e18cfb8d3941f3fd780601e5b87f854b last_activity: 2026-07-09T01:57:40Z expires_at: 2026-07-09T03:57:40Z blocker: none
sysadmin approved these changes 2026-07-08 20:57:52 -05:00
sysadmin left a comment
Owner

Review PR #561 / Issue #560

Verdict: APPROVE

Scope

  • Adds optional worktree_path to gitea_create_issue_comment
  • Passes it into verify_preflight_purity(..., worktree_path=..., task="comment_issue")
  • New regression suite tests/test_issue_comment_workspace_guard.py
  • Files only: gitea_mcp_server.py, tests/test_issue_comment_workspace_guard.py

Correctness

  • Matches existing pattern used by gitea_create_issue, gitea_create_pr, gitea_mark_issue, etc.
  • Does not weaken identity/capability/permission gates (covered by tests)
  • Root/control checkout still blocked without a valid branches/ worktree
  • Outside-repo worktree paths fail closed
  • Permission gate for gitea.issue.comment still enforced

Validation

  • git diff --check prgs/master...HEAD: clean
  • Targeted: tests/test_issue_comment_workspace_guard.py5 passed
  • Full suite: 1953 passed, 6 skipped, 2 failed
  • Same 2 failures pre-existing on master baseline (environment / known dirty-root tests)

Eligibility

  • Reviewer sysadmin / prgs-reviewer ≠ author jcwalker3
  • Head bd22135906772481e8f4617bbe4da669137f0e5c, mergeable:true, base master
  • No active foreign lease before claim

No REQUEST_CHANGES findings.

Next: merger session may merge after formal APPROVED is visible at this head.

## Review PR #561 / Issue #560 **Verdict: APPROVE** ### Scope - Adds optional `worktree_path` to `gitea_create_issue_comment` - Passes it into `verify_preflight_purity(..., worktree_path=..., task="comment_issue")` - New regression suite `tests/test_issue_comment_workspace_guard.py` - Files only: `gitea_mcp_server.py`, `tests/test_issue_comment_workspace_guard.py` ### Correctness - Matches existing pattern used by `gitea_create_issue`, `gitea_create_pr`, `gitea_mark_issue`, etc. - Does not weaken identity/capability/permission gates (covered by tests) - Root/control checkout still blocked without a valid `branches/` worktree - Outside-repo worktree paths fail closed - Permission gate for `gitea.issue.comment` still enforced ### Validation - `git diff --check prgs/master...HEAD`: clean - Targeted: `tests/test_issue_comment_workspace_guard.py` — **5 passed** - Full suite: **1953 passed, 6 skipped, 2 failed** - Same 2 failures pre-existing on master baseline (environment / known dirty-root tests) ### Eligibility - Reviewer `sysadmin` / `prgs-reviewer` ≠ author `jcwalker3` - Head `bd22135906772481e8f4617bbe4da669137f0e5c`, mergeable:true, base master - No active foreign lease before claim No REQUEST_CHANGES findings. **Next:** merger session may merge after formal APPROVED is visible at this head.
Owner

adopted_at: 2026-07-09T02:08:52Z
adopted_by_identity: sysadmin
adopted_by_profile: prgs-merger
adopted_from_session_id: 34818-7c9659f8a1cd
adopted_from_profile: prgs-reviewer
adopted_from_reviewer_identity: sysadmin
adopted_from_comment_id: 7323
adoption_reason: merger-handoff-approved-head

repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #561
issue: #560
reviewer_identity: sysadmin
profile: prgs-merger
session_id: 34819-1f1a24f5bba3
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/merge-pr561
phase: adopted
candidate_head: bd22135906
target_branch: master
target_branch_sha: 18e7d7b6e1
last_activity: 2026-07-09T02:08:52Z
expires_at: 2026-07-09T04:08:52Z
blocker: none

<!-- mcp-review-lease-adoption:v1 --> adopted_at: 2026-07-09T02:08:52Z adopted_by_identity: sysadmin adopted_by_profile: prgs-merger adopted_from_session_id: 34818-7c9659f8a1cd adopted_from_profile: prgs-reviewer adopted_from_reviewer_identity: sysadmin adopted_from_comment_id: 7323 adoption_reason: merger-handoff-approved-head <!-- mcp-review-lease:v1 --> repo: Scaled-Tech-Consulting/Gitea-Tools pr: #561 issue: #560 reviewer_identity: sysadmin profile: prgs-merger session_id: 34819-1f1a24f5bba3 worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/merge-pr561 phase: adopted candidate_head: bd22135906772481e8f4617bbe4da669137f0e5c target_branch: master target_branch_sha: 18e7d7b6e18cfb8d3941f3fd780601e5b87f854b last_activity: 2026-07-09T02:08:52Z expires_at: 2026-07-09T04:08:52Z blocker: none
sysadmin merged commit ae9ed8a908 into master 2026-07-08 21:09:01 -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#561