Fix AC20 publication preflight worktree forwarding #815
Closed
opened 2026-07-22 17:05:22 -05:00 by jcwalker3
·
1 comment
No Branch/Tag Specified
master
fix/issue-790-slice-a-heartbeat-policy
feat/issue-628-autonomous-handoffs-orchestration
feat/issue-634-readonly-system-health-api
feat/issue-638-webui-app-shell-phase1
fix/issue-840-cross-role-queue-allocation
feat/issue-822-atomic-install-authority-kernel
feat/issue-633-console-authz-audit-model
feat/issue-636-inventory-api
fix/issue-815-preflight-worktree-forwarding
feat/issue-812-publish-unpublished-commit
feat/issue-635-project-registry-api
feat/issue-798-worker-registry-schema
feat/issue-610-live-remote-parity
docs/issue-632-web-console-architecture
fix/issue-760-exact-owner-renewal
fix/issue-787-kill-segment-separators
chore/issue-681-preserve-review-session-wip
v1.1.0
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
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#815
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.
Problem
gitea_publish_unpublished_issue_branchaccepts an explicitworktree_pathbut does not pass it intoverify_preflight_puritybefore the #618 workspace guard runs. A daemon rooted at the stable control checkout therefore rejects a valid registered issue worktree before the publication assessor can use it.The argument is required on the tool signature — there is no caller-side workaround, and no default that could make the omission benign.
Confirmed source evidence
Verified against master
910b6edbdcf0dec64cdf139b1a1dbac4bd38c1efwithmutation_safe: true. This is not a staleness defect.gitea_mcp_server.py:9105declaresworktree_path: stras a required positional parameter.gitea_mcp_server.py:9176then calls:worktree_pathis absent. The tool does not resolve its workspace until line 9180, four lines after preflight has already run and failed:verify_preflight_puritydeclaresworktree_pathin its second positional slot (gitea_mcp_server.py:1340-1342), and threads it into every downstream workspace-resolution layer:worktree_path_resolve_namespace_mutation_context(worktree_path)_enforce_canonical_repository_root(worktree_path, remote=remote)_enforce_root_checkout_guard(worktree_path)_create_issue_bootstrap_assessment(task, worktree_path)_enforce_branches_only_author_mutation(worktree_path, ...)— the #618 guard_enforce_issue_scope_guard(worktree_path, ...)_run_anti_stomp_preflight(..., worktree_path=worktree_path, ...)Because
Noneis supplied, all seven fall back to the MCP process root._enforce_branches_only_author_mutationreaches_resolve_namespace_mutation_context(None), classifies the workspace as the stable control checkout, and raises before the assessor at line 9215 is ever constructed.The forwarding is otherwise universal
Every other
verify_preflight_puritycall site that has a caller-supplied worktree forwards it — lines 1804, 3783, 4011, 4482, 10485, 12302, 12460, 14468, 14952, 17363, 17505, 18806, 18866 all passworktree_path=. Line 9176 is the sole call site that accepts a worktree argument and drops it.Observed production failure
A recovery worker called the tool with a complete, explicit, valid argument set — registered worktree, full 40-character
expected_head, per-file hashes,dry_run=true— and received the #618 stable-control-checkout refusal:The error text names the exact remedy the caller had already supplied.
Why the existing suite did not catch it
tests/test_issue_812_publish_unpublished_commit.py:115sets:and line 192 patches
mcp_server.PROJECT_ROOTto that sameself.repo. The synthetic "issue worktree" isPROJECT_ROOT, and it is checked out on the issue branch rather than on a stable branch. The two paths are byte-identical, so the fallback resolves to the very worktree the argument names, and the dropped argument is structurally invisible. All 36 existing cases pass while the production topology is never constructed.Production effect
The AC20 tool merged through PR #814 is loaded and runtime parity is healthy, but it cannot publish the preserved #635 branch. The protected branch remains unpublished and exact-owner lock renewal remains blocked.
The capability is therefore unreachable in the only topology it was built for: a long-running daemon rooted at the stable control checkout, publishing a branch that lives in a separate registered worktree under
branches/. Entry point B of #812 stays closed in production despite its implementation having landed.Required acceptance criteria
AC1. The tool must pass the authoritative supplied
worktree_pathintoverify_preflight_purityand every applicable workspace-resolution layer before the #618 guard evaluates the workspace.AC2. Preflight must validate the explicit registered issue worktree rather than falling back to the stable control checkout.
AC3. The fix must not weaken #618 for missing, empty, malformed, unregistered, foreign, or mismatched worktree paths.
AC4. Both dry-run and executing publication paths must use the same validated worktree resolution.
AC5. The author must remain unable to publish from the stable control checkout when no valid explicit issue worktree is supplied.
AC6. Repository, issue, branch, identity, profile, expected HEAD, durable lock ownership, cleanliness, content hashes, remote ancestry, and read-after-write protections from PR #814 must remain intact.
AC7. Add a production-shaped regression test in which:
PROJECT_ROOTrepresents the stable control checkout;PROJECT_ROOT;worktree_path;PROJECT_ROOT.AC8. Add negative regression coverage proving omitted and invalid worktree paths still fail closed.
AC9. The protected
#635worktree, branch, commit, hashes, and durable lock must not be modified while implementing or testing this fix.AC10. Documentation/tool inventory must be regenerated only if the canonical workflow proves the public tool contract changed.
Scope boundary
Narrow. This is an argument-forwarding correction plus the regression coverage that proves the production topology. Explicitly out of scope: any redesign of branch publication, any AC21 implementation, any lock-reclamation change, any role-policy weakening, and any unrelated cleanup or refactoring.
Linkage
910b6edbdcf0. Landed the AC20 tool andbranch_publish.py. Completed work. This issue is a newly discovered production regression in what that PR shipped, tracked separately.feat/issue-635-project-registry-api, worktreebranches/issue-635-project-registry-api, commitb2f6e9a6dc40e9651ef876f322dd0a68bddebfd8. Must not be read into, written to, published, reset, cleaned, or otherwise disturbed by this work. It is the beneficiary of the fix, never its test fixture.org/repothrough author mutation call sites. Prior art for the correction shape, not for this call site.delete_branchanti-stomp preflight. Prior art only.Machine-verifiable retry condition
The defect is resolved when, from a daemon rooted at the stable control checkout on a stable branch, with a distinct registered issue worktree holding a clean unpublished local commit and a durable lock naming the caller:
and the same call with
worktree_pathomitted, blank, unregistered, or resolving to the stable control checkout still fails closed under #618.Canonical issue state
[THREAD STATE LEDGER]
What is true now
Author work unit is complete. PR #817 is in the OPEN state against
master, head95a5eb254f7758b694a26b3f5629558cb88db328, mergeable true, authorjcwalker3, closing #815. The remote branch head is verified equal to the committed head. Full suite: 11 failed / 4375 passed / 6 skipped / 537 subtests — the 11 are the documented pre-existing drift baseline, unchanged in count and identity.status:pr-open.What changed
Commit
95a5eb2onfix/issue-815-preflight-worktree-forwarding:gitea_mcp_server.py(+18 / −2) —gitea_publish_unpublished_issue_branchnow resolvesworkspaceonce and forwards it asverify_preflight_purity(worktree_path=…)before the #618 guard. Root cause: line 9176 dropped the requiredworktree_path, resolved only at line 9180, so preflight fell back to the process root and a control-checkout-rooted daemon refused a valid registered worktree. Sole call site of 14 that dropped its worktree.tests/test_issue_815_preflight_worktree_forwarding.py(new, 21 cases) — a #735-style capture, a faithful no-session-lock production reproduction that fails on the unpatched source, an end-to-end control-rooted publication with no PROJECT_ROOT masking, and negative coverage preserving every #618 and assessor refusal.What is blocked
Nothing is blocked for the author role; the work unit is finished. Merge is pending independent review of PR #817.
Who/what acts next
prgs-reviewer).worktree_pathreachesverify_preflight_puritybefore the #618 guard, that every #618 and assessor refusal is preserved, that the new regression fails on the unpatched source, and thatbranches/issue-635-project-registry-apiwas untouched — then approve and merge, or request changes.Do not do:
branches/issue-635-project-registry-api; it stays atb2f6e9a, remote branch absent, durable lock unmutated.gitea_publish_unpublished_issue_branchagainst #635 while reviewing this PR.docs/mcp-tool-inventory.md; the public tool contract is unchanged.Canonical Issue State
STATE: pr-open
WHO_IS_NEXT: reviewer
NEXT_ACTION: Review PR #817 against #815 AC1-AC10 and merge if clean
NEXT_PROMPT:
WHAT_HAPPENED: Forwarded the required worktree_path into verify_preflight_purity before the #618 guard in gitea_publish_unpublished_issue_branch, added a 21-case regression, committed
95a5eb2, and opened PR #817.WHY: The tool resolved worktree_path only after preflight (line 9176 dropped it, line 9180 resolved it), so preflight fell back to the process root and a control-checkout-rooted daemon refused a valid registered issue worktree before the assessor ran — leaving the #635 branch unpublishable in production despite AC20 having landed.
RELATED_PRS: #817 (this fix, open); #814 (landed AC20); #735 and #733 (same defect class for org/repo, landed).
BLOCKERS: none
VALIDATION: New suite 21 passed / 4 subtests; reverting only the source hunk turns 3 tests red and restoring it turns them green; related canonical suites 123 passed / 100 subtests; full suite 11 failed / 4375 passed / 6 skipped / 537 subtests with the 11 failures identical to 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); #812 remains closed and #635 untouched.
LAST_UPDATED_BY: prgs-author (jcwalker3)
BLOCKED_ROLE: none
NEXT_ELIGIBLE_ROLE: reviewer