fix(mcp): forward worktree_path into publication preflight (Closes #815) #817
Merged
sysadmin
merged 1 commits from 2026-07-22 18:34:31 -05:00
fix/issue-815-preflight-worktree-forwarding into master
Labels
Clear labels
allocator
anti-stomp
architecture
bug
chore
codex
concurrency
contamination
control-plane
dashboard
database
design
documentation
enhancement
gitea
glitchtip
important
incident
incident-bridge
integration
jenkins
labels
leases
mcp
mcp-health
mcp-menu
multi-project
mutating
nice-to-have
observability
portability
preflight
protected-branch
queue
read-only
reconnect
recovery
refactor
release
reliability
resumable-review
reviewer
roadmap
safety
security
self-hosted
sentry
stale-runtime
status:blocked
status:in-progress
status:pr-open
status:ready
terminal-lock
testing
tracker
type:bug
type:feature
type:feature
type:guardrail
visibility
workflow
workflow-hardening
workflow-hardening
Controller-owned work allocator
Prevent concurrent LLM session stomping
Architecture / structural design
OpenAI Codex client / workflow session surface
Concurrent session safety
Workflow or session contamination incident
MCP control-plane coordination and allocation authority
MCP operational dashboard/queue view
Internal coordination storage (SQLite/Postgres)
Design / investigation, no implementation
Docs / runbooks
New feature or improvement
Gitea MCP workflow
GlitchTip integration
Operational or process incident requiring durable audit trail
Sentry-to-Gitea incident bridging
Integration testing
Jenkins integration
Label taxonomy management
Lease adopt/release/expire lifecycle
MCP server / tooling
MCP namespace and runtime health
MCP menu surface
Work spanning multiple monitoring projects or Gitea repos
Mutating action; requires gating
Observability, metrics, traces, error reporting
Cross-platform / portability
Shared preflight gates before mutation
Protected branch / stable-branch policy concern
Work queue visibility and allocation
Read-only, no mutation
MCP client reconnect/reload recovery path
Recovery paths for stale/foreign leases
Code refactor / restructure
Release / versioning
Reliability / failure handling
Persist and resume prepared review verdicts across sessions
Reviewer workflow tooling
Roadmap / umbrella issue
Safety rails and fail-closed mutation guards
Security / trust boundary
Self-hosted infrastructure integration
Sentry error monitoring integration
Stale backend daemon / runtime-vs-master parity failures
Issue is blocked
Issue is being worked on
Issue has an open pull request
Issue is ready for work
Terminal review lock (#332) path
Tests / test coverage
Issue tracker hygiene / meta
Bug or defect
Feature or enhancement
Feature or enhancement
Safety gate or guardrail
Workflow state visibility for LLMs/operators
Cross-tool workflow
LLM workflow coordination hardening
LLM workflow coordination hardening
No labels
Milestone
No items
No Milestone
Projects
Clear projects
No projects
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: Scaled-Tech-Consulting/Gitea-Tools#817
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Closes #815
Head:
95a5eb254f7758b694a26b3f5629558cb88db328.The defect
gitea_publish_unpublished_issue_branchdeclaresworktree_pathas a required parameter but resolved it only afterverify_preflight_purityhad already run:Every workspace-resolution layer behind that preflight — canonical root, root checkout, create-issue bootstrap, the #618 branches-only guard, issue scope, and anti-stomp — therefore received
Noneand fell back to the MCP process root. A daemon rooted at the stable control checkout refused a valid registered issue worktree the caller had explicitly supplied, before the publication assessor at 9215 was ever constructed. Confirmed against master910b6edbdcf0withmutation_safe: true— not a staleness defect.This is the only
verify_preflight_puritycall site that accepts a caller-supplied worktree and drops it; all thirteen others (lines 1804, 3783, 4011, 4482, 10485, 12302, 12460, 14468, 14952, 17363, 17505, 18806, 18866) forward it.The fix
Resolve the workspace once, before preflight, and forward it:
A blank or absent path forwards
Noneand keeps the ordinary #618 fail-closed fallback, so guard strictness is unchanged for missing, empty, unregistered, foreign, or control-checkout worktrees. The value bound toworkspaceand handed to the assessor is byte-for-byte what the old line 9180 produced, so ownership, cleanliness, hash, ancestry, and read-after-write protections from PR #814 are untouched. The public tool signature and return contract do not change, sodocs/mcp-tool-inventory.mdis not regenerated.Why the #812 suite missed it
The AC20 fixture sets
self.worktree = os.path.realpath(self.repo)and patchesPROJECT_ROOTto that same path, so the fallback resolved to the very worktree the argument named. The production topology — control checkout on a stable branch, issue worktree elsewhere — was never built, and preflight additionally no-ops under pytest unless production guards are forced on.Tests
tests/test_issue_815_preflight_worktree_forwarding.py, 21 cases against synthetic fixtures only (real git repo + real bare remote):verify_preflight_purity; a blank path forwardsNone; org/repo/task forwarding preserved.PROJECT_ROOTis the stable control checkout, the issue worktree is a distinct registered path underbranches/,GITEA_TEST_FORCE_PRODUCTION_GUARDS=1so the #618 guard genuinely runs; publish, dry-run, dry-run/apply agreement, and read-after-write verification.Reverting only the source hunk turns 3 of these red (2 capture + the production reproduction); restoring it turns them green.
Full suite: 11 failed, 4375 passed, 6 skipped, 537 subtests passed. The 11 failures are the documented pre-existing drift baseline —
test_commit_payloads.py,test_issue_702_review_findings_f1_f6.py,test_mcp_server.py,test_post_merge_moot_lease.py,test_reconciler_supersession_close.py— unchanged in count and identity; none touch this tool.Prior completed work
org/repo; prior art for the correction shape.b2f6e9a, hashes, and durable lock were not read into, written to, or otherwise disturbed by this work; a test asserts the fixture never names it.🤖 Generated with Claude Code
repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #817
issue: none
reviewer_identity: sysadmin
profile: prgs-reviewer
session_id: 50184-e42e27f730de
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/reviewer-worktree-pr817
phase: claimed
candidate_head: none
target_branch: master
target_branch_sha: none
last_activity: 2026-07-22T22:59:21Z
expires_at: 2026-07-22T23:09:21Z
blocker: none
repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #817
issue: none
reviewer_identity: sysadmin
profile: prgs-reviewer
session_id: 50184-e42e27f730de
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/reviewer-worktree-pr817
phase: claimed
candidate_head: none
target_branch: master
target_branch_sha: none
last_activity: 2026-07-22T23:01:08Z
expires_at: 2026-07-22T23:11:08Z
blocker: none
repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #817
issue: none
reviewer_identity: sysadmin
profile: prgs-reviewer
session_id: 50184-e42e27f730de
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/reviewer-worktree-pr817
phase: claimed
candidate_head: none
target_branch: master
target_branch_sha: none
last_activity: 2026-07-22T23:01:58Z
expires_at: 2026-07-22T23:11:58Z
blocker: none
repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #817
issue: none
reviewer_identity: sysadmin
profile: prgs-reviewer
session_id: 50184-e42e27f730de
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/reviewer-worktree-pr817
phase: claimed
candidate_head: none
target_branch: master
target_branch_sha: none
last_activity: 2026-07-22T23:03:55Z
expires_at: 2026-07-22T23:13:55Z
blocker: none
repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #817
issue: none
reviewer_identity: sysadmin
profile: prgs-reviewer
session_id: 50184-e42e27f730de
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/reviewer-worktree-pr817
phase: claimed
candidate_head: none
target_branch: master
target_branch_sha: none
last_activity: 2026-07-22T23:04:42Z
expires_at: 2026-07-22T23:14:42Z
blocker: none
Canonical PR State
STATE: review-in-progress
WHO_IS_NEXT: reviewer
NEXT_ACTION: Complete formal PR review submission
NEXT_PROMPT:
WHAT_HAPPENED: Independent reviewer sysadmin conducted preflight checks, source diff analysis, security boundary verification, regression proof verification, and test suite execution for PR #817. All acceptance criteria AC1-AC10 for Issue #815 are satisfied.
WHY: PR #817 correctly resolves explicit worktree_path before verify_preflight_purity is called in gitea_publish_unpublished_issue_branch, allowing control-rooted daemons to publish registered issue worktrees.
ISSUE: #815
HEAD_SHA:
95a5eb254fREVIEW_STATUS: PENDING
MERGE_READY: false
BLOCKERS: none
VALIDATION: 21 focused regression tests passed in tests/test_issue_815_preflight_worktree_forwarding.py. Source revert proof confirmed 3 failures on unpatched code. Full suite matching pre-existing baseline (11 failed, 4375 passed, 6 skipped).
LAST_UPDATED_BY: sysadmin
PR #817 Independent Review Details
95a5eb254frepo: Scaled-Tech-Consulting/Gitea-Tools
pr: #817
issue: #815
reviewer_identity: sysadmin
profile: prgs-merger
session_id: 33243-d5fa2dafb10e
worktree: /Users/jasonwalker/Development/Gitea-Tools
phase: claimed
candidate_head:
95a5eb254ftarget_branch: master
target_branch_sha: none
last_activity: 2026-07-22T23:34:02Z
expires_at: 2026-07-22T23:44:02Z
blocker: none
Stale #332 review-decision lock cleanup (#594)
Status: APPLIED
sysadminprgs-merger2026-07-22T23:34:33.366645+00:00approveon PR fix(mcp): forward worktree_path into publication preflight (Closes #815) (#817)closed(merged=True)14c9c4d702055056ff1b25aa93aa6b55df79d1ac1prgs-reviewerManual deletion of session-state files is not the workflow.
This path only clears a lock when the referenced PR is merged/closed.