fix(mcp): honor the create-issue bootstrap in anti-stomp preflight (Closes #757) #759
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#759
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 #757
Problem
The sanctioned
create_issuebootstrap shipped by #749/#750 was unreachable in production. Two guards assessed one workspace for one task and reached opposite conclusions:wrong_worktree.Production error, reproduced verbatim by the new end-to-end test:
Root cause
Confirmed independently at the filing commit.
create_issueis a declared member of the #604 mutation set, so its worktree check always ran, but it calledassess_author_mutation_worktreedirectly with no bootstrap consultation and no task-sensitivity.create_issue_bootstrapappeared zero times inanti_stomp_preflight.py.The defect was wiring, not policy. The bootstrap decision was computed in one guard and discarded, while the other re-derived a conflicting answer from a lower-level assessor that has no notion of the bootstrap phase. There was no single source of truth for "may this task mutate from this workspace".
Design — one computation site, one interpretation site
create_issue_bootstrap.bootstrap_permits_control_checkout()— the single predicate both guards use to interpret an assessment. Fail-closed by construction: missing, malformed, refused, incomplete, or contradictory evidence returnsFalse, leaving the ordinary block in force. It uses strict identity checks (is not True), so no truthy value can be smuggled in, and it verifies the assessment describes the exact workspace and canonical root being guarded — a stale or foreign assessment cannot be reused._create_issue_bootstrap_assessment()— computes the assessment once per preflight from inspected repository state.verify_preflight_puritythreads that single result into both guards.Safety properties
create_issueauthor mutations keep the branches-only requirement.gitea_*tool exposes one. No caller-controlled boolean can manufacture eligibility.Not waived: dirty-file checks, repository membership, stale runtime, identity/profile, remote/base divergence, detached rejection, task scope, and branches-only enforcement for every other mutation. Root checkout, repo, role, lease, head-SHA, workflow-hash, and contamination checks are evaluated independently and still apply — covered by explicit tests.
Behavior is unchanged for callers that supply no evidence (
review_pr/merge_prsites are untouched). No circular imports:create_issue_bootstrapdepends only on leaf modules.Files changed
create_issue_bootstrap.pybootstrap_permits_control_checkout()predicateanti_stomp_preflight.pywrong_worktreegitea_mcp_server.pytests/test_issue_757_bootstrap_guard_agreement.pytests/test_reconciler_close_workspace_guard.pyTests
New suite covers: the shared predicate (missing / malformed / refused / not-applicable / incomplete / contradictory / truthy-smuggling / wrong-task / foreign-binding / scope tampering); the narrow waiver; that the waiver does not suppress stale-runtime, wrong-repo, or wrong-role blockers; branches/ worktrees unaffected; non-forgeable eligibility; guard agreement across a 10-case workspace-state matrix; and an end-to-end native
gitea_create_issuerun with the #604 gate live.All 38 tests fail against the unfixed sources — verified by reverting the three production files and re-running. The pre-existing #749 e2e test patched
_run_anti_stomp_preflightto a no-op, which is exactly why this defect reached production; the new e2e leaves it running.tests/test_reconciler_close_workspace_guard.pyasserted thatcreate_issuestays blocked on the control checkout. That only held because the bootstrap-blind #604 guard was overriding #750 — it encoded the defect. Re-pointed tolock_issue, which is issue-backed and legitimately still requires abranches/worktree. Its teardown now restores module-level preflight task/role so test order cannot leak resolved state.Validation
bde5c5fbon a fresh clean detached worktree: 3586 passed, 2 failed, 6 skipped, 400 subtestsBoth failures reproduce identically on pristine master and are not caused by this change (
test_issue_702_review_findings_f1_f6F1 worktree recovery;test_reconciler_supersession_closeorg/repo forwarding). The baseline worktree was removed afterward.git diff --checkclean;py_compilepasses on every changed source.repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #759
issue: #757
reviewer_identity: sysadmin
profile: prgs-reviewer
session_id: 88750-2ff610fa236b
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-pr-759-adc61255-independent-20260719T025309
phase: claimed
candidate_head:
adc61255b2target_branch: master
target_branch_sha:
bde5c5fb20last_activity: 2026-07-19T06:55:15Z
expires_at: 2026-07-19T07:05:15Z
blocker: none
Canonical PR State
STATE: approved
WHO_IS_NEXT: merger
NEXT_ACTION: Merge PR #759 at pinned head
adc61255after re-checking open/mergeable state and native merger lease; do not force-mergeNEXT_PROMPT:
WHAT_HAPPENED: Independent reviewer phase completed APPROVE for PR #759 after gates, full diff inspection, focused/affected suites, and baseline reproduction of two pre-existing full-suite failures.
WHY: Design matches #757: single bootstrap assessment site, shared threading into #274 and #604, wrong_worktree-only waiver, fail-closed identity/workspace binding, no public bootstrap tool args, non-create_issue behavior preserved.
ISSUE: 757
HEAD_SHA:
adc61255b2REVIEW_STATUS: APPROVE
MERGE_READY: yes
BLOCKERS: none for this PR; two full-suite failures are baseline on
bde5c5fb(test_issue_702 F1 worktree recovery; test_reconciler_supersession_close org/repo mock)VALIDATION: git diff --check clean; py_compile OK on changed files; pytest tests/test_issue_757_bootstrap_guard_agreement.py 38 passed (26 subtests); expanded affected suites 217 passed (42 subtests); claimed baseline failures reproduced identically on head and pristine
bde5c5fbNATIVE_REVIEW_PROOF: transport=native_mcp; entrypoint=gitea_submit_pr_review; server=gitea-reviewer; profile=prgs-reviewer; identity=sysadmin; head=adc61255b2d7eb65d1670e09e561dbd84b652317; lease_comment=12856
LAST_UPDATED_BY: sysadmin (prgs-reviewer independent review)
Independent review summary
Reviewed head:
adc61255b2Base: master @
bde5c5fb20Author: jcwalker3
Reviewer: sysadmin / prgs-reviewer (identity_match=true)
Parity: in_parity, restart_required=false
Lease: session 88750-2ff610fa236b, comment 12856
Design (no material defects)
_create_issue_bootstrap_assessmentis the single computation site;verify_preflight_puritythreads one assessment into both guards.bootstrap_permits_control_checkoutuses strict is True/is False (no truthy smuggling).Baseline failures (not introduced by this PR)
Reproduced on both head and pristine base
bde5c5fb:Verdict: APPROVE. Do not merge from this review.
Review correction authorization audit (#693)
Status: AUTHORIZED
sysadminprgs-reviewer2026-07-19T16:26:49.230245+00:00472approve#759adc61255b2d7eb65d1670e09e561dbd84b652317adc61255permits missing local, missing remote, and both-missing. Prior APPROVE #472 is mistaken and must be superseded by REQUEST_CHANGES.same_pr_head_only(cannot unlock a different PR)This is not a generic decision-lock unlock. Cross-PR recovery uses isolation (#693) or moot cleanup (#594), never correction.
repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #759
issue: #757
reviewer_identity: sysadmin
profile: prgs-reviewer
session_id: 88750-8d2c3f21d117
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-pr-759-adc61255-independent-20260719T025309
phase: claimed
candidate_head:
adc61255b2target_branch: master
target_branch_sha:
bde5c5fb20last_activity: 2026-07-19T16:27:18Z
expires_at: 2026-07-19T16:37:18Z
blocker: none
Canonical PR State
STATE: changes-requested
WHO_IS_NEXT: author
NEXT_ACTION: Fail closed when local or remote master SHA is missing; require both known and equal before create_issue bootstrap allowance; add production regression tests; supersede mistaken APPROVE #472
NEXT_PROMPT:
WHAT_HAPPENED: Independent re-verification reproduced AC3/AC4 fail-open on exact head
adc61255. Prior APPROVE review #472 is mistaken. Correction authorized via gitea_authorize_review_correction (audit_comment_id 12863). This submission supersedes #472 with REQUEST_CHANGES.WHY: Bootstrap exemption can be granted without proof that the control checkout equals live remote master, violating issue #757 AC3 (live remote base head) and AC4 (stale/remote-divergent remain blocked).
ISSUE: 757
HEAD_SHA:
adc61255b2REVIEW_STATUS: REQUEST_CHANGES
MERGE_READY: no
BLOCKERS: AC3/AC4 SHA-tip fail-open; mistaken approval #472 must not be treated as merge-ready
VALIDATION: Independent probe on
adc61255: missing_local permits=True; missing_remote permits=True; both_missing permits=True; empty strings permits=True; equal_ok permits=True; mismatch permits=False. Source: create_issue_bootstrap.py:145-151; gitea_mcp_server.py:_create_issue_bootstrap_assessment except→None; bootstrap_permits has no SHA equality check; tests lack missing-tip cases.NATIVE_REVIEW_PROOF: transport=native_mcp; entrypoint=gitea_submit_pr_review; server=gitea-reviewer; profile=prgs-reviewer; identity=sysadmin; head=adc61255b2d7eb65d1670e09e561dbd84b652317; supersedes_review=472; correction_audit_comment=12863; lease_comment=12867
LAST_UPDATED_BY: sysadmin (prgs-reviewer correction of #472)
REQUEST_CHANGES — material safety finding
Exact head:
adc61255b2d7eb65d1670e09e561dbd84b652317Supersedes: formal APPROVE review #472 (same head)
Reproduced facts (all true on this head)
create_issue_bootstrap.pycompares SHAs only inside:if remote_tip and local_tip and remote_tip != local_tip:gitea_mcp_server._create_issue_bootstrap_assessmentconverts remote-tip resolution exceptions toremote_master_sha=None.bootstrap_permits_control_checkoutdoes not require recorded, nonempty, equal local/remote SHAs.permits=Truefor missing local HEAD, missing remote tip, and both missing.Required remediation
Approval #472 disposition
gitea_authorize_review_correctionauthorized withoperator_authorized=true(audit comment 12863).Do not merge.
repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #759
issue: #757
reviewer_identity: sysadmin
profile: prgs-reviewer
session_id: 88750-8d2c3f21d117
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-pr-759-adc61255-independent-20260719T025309
phase: released
candidate_head:
adc61255b2target_branch: master
target_branch_sha:
bde5c5fb20last_activity: 2026-07-19T16:27:54Z
expires_at: 2026-07-19T16:37:54Z
blocker: manual-release
Canonical Issue State
STATE: changes-remediated-awaiting-fresh-review
WHO_IS_NEXT: reviewer
NEXT_ACTION: Perform a fresh independent review of PR #759 at new head 9d2c652ae897afee2f6de139f9b85ab2569b5a85; review #473 was recorded against superseded head
adc61255and is now staleNEXT_PROMPT:
WHAT_HAPPENED: Author remediated the AC3/AC4 base-equivalence fail-open identified by review #473 and pushed a second focused commit to the existing branch without force.
WHY: The bootstrap compared SHAs only when both tips existed, so a missing local HEAD, an unknown live master, or a resolver exception granted the control-checkout exemption instead of refusing it.
ISSUE: 757
RELATED_PRS: #759 (this PR, head
9d2c652ae8, open); #750 (landed on master; delivered the create_issue bootstrap this PR makes reachable); #754 (landed on master; dead-session lock recovery assessor used to recover the #757 author lock)HEAD_SHA:
9d2c652ae8PRIOR_HEAD_SHA:
adc61255b2REVIEW_STATUS: awaiting-fresh-independent-review
MERGE_READY: no
BLOCKERS: no author-scope blocker; the new head carries no formal verdict yet
VALIDATION: git diff --check clean; py_compile OK on all three changed files; focused #757 suite 51 passed (31 subtests); affected guard/preflight suites 217 passed (67 subtests); full suite 3637 passed, 2 failed, 6 skipped, 431 subtests, both failures pre-existing baseline on
bde5c5fbLAST_UPDATED_BY: jcwalker3 (prgs-author remediation of review #473)
[THREAD STATE LEDGER]
Server-side decision state: REQUEST_CHANGES review #473 exists, is undismissed, and is marked stale by the server.
has_blocking_change_requests=true,approval_at_current_head=false,latest_approved_head_sha=null,author_pushed_after_request_changes=true. No formal verdict exists at head9d2c652. No server-side state changed by this author session other than the branch push and this comment.Local verdict/state: Author-side remediation is complete; local checks were executed and their results are recorded below. The author records no review verdict; verdicts are reviewer-owned.
Next actor: reviewer
Required action: Perform a fresh independent formal review of PR #759 at exact head
9d2c652ae8from the reviewer namespace.Blocker classification: no blocker
What is true now
9d2c652ae897afee2f6de139f9b85ab2569b5a85; base is master @bde5c5fb20fbf6aec9cd6b802341c43078921d13.9d2c652.adc61255and is now stale; it remains undismissed. Review #472 (APPROVE verdict) remains dismissed and stale.2026-07-19T20:52:20Z.bde5c5fb.What changed
9d2c652pushed fast-forward onto the existing branch.adc61255was not amended and remains its parent.create_issue_bootstrap.py— addednormalize_sha(); the base-equivalence gate now refuses unless both tips are known and equal, with distinct reasons for missing local HEAD, unknown live master, and resolver failure; both normalized tips and a derivedbase_tips_verifiedflag are recorded;bootstrap_permits_control_checkoutre-derives the comparison rather than trusting the flag.gitea_mcp_server.py—_create_issue_bootstrap_assessmentcaptures the resolver exception and forwards it asremote_master_sha_errorinstead of discarding it into a permissiveNone.tests/test_issue_757_bootstrap_guard_agreement.py— two new classes, 16 assertions covering missing local, missing remote, both missing, empty and whitespace tips, mismatch, resolver exception at the assessment site, resolver exception through the realverify_preflight_puritypath, and predicate rejection of stripped tips, a forged flag, and a missing flag.adc61255and pass on9d2c652.What is blocked
9d2c652, and the undismissed REQUEST_CHANGES from #473 remains on record. This is expected and correct.Who/what acts next
A reviewer, operating in the reviewer namespace, performs a fresh independent formal review at head
9d2c652. The author's turn is complete.Do not do:
9d2c652without a fresh independent approval at that exact head.adc61255or9d2c652.branches/fix-issue-757-shared-bootstrapworktree, or thebranches/baseline-bde5c5f-issue-757worktree; none were touched by this work.Detail — findings addressed
if remote_tip and local_tip and remote_tip != local_tipremote_master_sha=Nonepermits=Truefor missing tipspermits=FalseOne shared assessment still serves both the #274 and #604 guards;
_BOOTSTRAP_UNSETis preserved; no MCP tool signature gains a bootstrap argument (AC6); no issue or PR number is special-cased (AC10). The valid non-create_issuelock_issuetest is retained unchanged.Tracking issue #760 was filed separately for the expired-lock exact-owner renewal gap; it is not in this PR's scope.
repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #759
issue: #757
reviewer_identity: sysadmin
profile: prgs-reviewer
session_id: 90364-6d2faa3709ef
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-418
phase: claimed
candidate_head:
9d2c652ae8target_branch: master
target_branch_sha:
bde5c5fb20last_activity: 2026-07-19T17:28:25Z
expires_at: 2026-07-19T17:38:25Z
blocker: none
Canonical PR State
STATE: approved
WHO_IS_NEXT: merger
NEXT_ACTION: Fresh merger session must reassess and merge PR #759 at exact head 9d2c652ae897afee2f6de139f9b85ab2569b5a85; do not force-merge
NEXT_PROMPT:
WHAT_HAPPENED: Independent reviewer (Grok / sysadmin / prgs-reviewer) completed APPROVE at remediated head
9d2c652after full production-code inspection and required validation. Review #473 REQUEST_CHANGES is stale after author remediation and is superseded by this fresh verdict at the new head.WHY: #757 AC3/AC4 fail-open from
adc61255is closed: both local and remote master tips must be known and equal; resolver exceptions fail closed; shared predicate re-derives equality; single assessment serves #274 and #604; wrong_worktree-only waiver; no public bootstrap args; non-create_issue guards preserved.ISSUE: 757
HEAD_SHA:
9d2c652ae8PRIOR_HEAD_SHA:
adc61255b2REVIEW_STATUS: APPROVE
MERGE_READY: yes (merger recheck required)
BLOCKERS: none for this PR; full-suite failures claimed by author as baseline on
bde5c5fbwere not re-run here because focused/affected suites fully passed and author baseline evidence matched prior independent reproduction patternVALIDATION: git diff --check clean; py_compile OK; pytest tests/test_issue_757_bootstrap_guard_agreement.py 51 passed (31 subtests); expanded affected suites (create_issue bootstrap/workspace-guard, anti-stomp, author-mutation-worktree, create_issue, reconciler close workspace) 142 passed (47 subtests); independent probe confirms missing_local/remote/both/resolver fail-closed at
9d2c652and fail-open atadc61255NATIVE_REVIEW_PROOF: transport=native_mcp; entrypoint=gitea_submit_pr_review; server=gitea-reviewer; profile=prgs-reviewer; identity=sysadmin; head=9d2c652ae897afee2f6de139f9b85ab2569b5a85; lease_comment=12902; supersedes_review=473
LAST_UPDATED_BY: sysadmin (prgs-reviewer independent review; LLM=Grok)
Independent review summary
Reviewed head:
9d2c652ae897afee2f6de139f9b85ab2569b5a85Base: master @
bde5c5fb20fbf6aec9cd6b802341c43078921d13Author: jcwalker3 (self-review blocked; identity differs)
Reviewer: sysadmin / prgs-reviewer / reviewer (identity_match=true)
Parity: in_parity, restart_required=false
Lease: session 90364-6d2faa3709ef, comment 12902
Handoff comment: 12892 present
Findings verified (all pass)
_create_issue_bootstrap_assessmentonce inverify_preflight_purity; same object threaded into #274 and #604.remote_master_sha_error; fail-closed (not permissive None).bootstrap_permits_control_checkoutrequiresbase_tips_verifiedand independently re-derives equality from recorded tips.gitea_*tool param exposes bootstrap eligibility._BOOTSTRAP_UNSET— distinguishes unset vs refused assessment; refused not recomputed into permission when threaded.adc61255and fail-closed on 9d2c652; e2e leaves #604 live (does not patch to no-op).Prior reviews
adc61255: dismissed=true, stale=trueadc61255: undismissed, stale=true, author_pushed_after_request_changes=true; not authoritative for9d2c652Verdict: APPROVE. Do not merge from this review session.
repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #759
issue: #757
reviewer_identity: sysadmin
profile: prgs-reviewer
session_id: 90364-6d2faa3709ef
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-418
phase: released
candidate_head:
9d2c652ae8target_branch: master
target_branch_sha:
bde5c5fb20last_activity: 2026-07-19T17:29:15Z
expires_at: 2026-07-19T17:39:15Z
blocker: manual-release
repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #759
issue: #757
reviewer_identity: sysadmin
profile: prgs-merger
session_id: 93874-b75cdb469c9a
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/merge-pr-759-9d2c652
phase: claimed
candidate_head:
9d2c652ae8target_branch: master
target_branch_sha:
bde5c5fb20last_activity: 2026-07-19T17:33:52Z
expires_at: 2026-07-19T17:43:52Z
blocker: none
Stale #332 review-decision lock cleanup (#594)
Status: APPLIED
sysadminprgs-merger2026-07-19T17:34:10.758647+00:00approveon PR fix(mcp): honor the create-issue bootstrap in anti-stomp preflight (Closes #757) (#759)closed(merged=True)854818e65a2741ba0740773fd9593d5e1f3d57513prgs-reviewerManual deletion of session-state files is not the workflow.
This path only clears a lock when the referenced PR is merged/closed.
repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #759
issue: #757
reviewer_identity: sysadmin
profile: prgs-merger
session_id: 93874-b75cdb469c9a
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/merge-pr-759-9d2c652
phase: released
candidate_head:
9d2c652ae8target_branch: master
target_branch_sha:
bde5c5fb20last_activity: 2026-07-19T17:39:43Z
expires_at: 2026-07-19T17:49:43Z
blocker: post-merge-moot