fix(scope): wire author bootstrap scope into workflow scope guard #941
Closed
opened 2026-07-26 04:03:35 -05:00 by jcwalker3
·
2 comments
No Branch/Tag Specified
master
fix/issue-941-scope-guard-bootstrap-wiring
docs/issue-930-remote-mcp-coupling-inventory
fix/issue-927-pytest-config
feat/issue-708-mcp-namespace-attachment
fix/issue-892-author-bootstrap-deadlock
fix/issue-686-detect-reject-manual-mcp
feat/issue-707-cross-project-boundaries
fix/issue-690-review-profile-switch-guard
fix/issue-704-prevent-env-workspace-bindings
fix/issue-700-durable-walls
fix/issue-672-mcp-config-drift
fix/issue-689-deterministic-mcp-namespace
fix/issue-678-codex-mcp-reconnect
feat/issue-649-sentry-console-correlation
feat/issue-666-concurrent-mcp-restart-tests
feat/issue-659-maintenance-drain-mode
feat/issue-648-notifications-console
fix/issue-670-direct-master-incident
feat/issue-644-console-recovery
feat/issue-650-providers-insights
feat/issue-669-scoped-component-recovery
docs/issue-668-mcp-ha-rolling-restart
feat/issue-667-console-restart-controls
feat/issue-665-restart-audit
feat/issue-664-break-glass-restart
feat/issue-645-linkage-console
feat/issue-643-request-preview-initiate
fix/issue-897-permission-stale-runtime-classification
feat/issue-641-runtime-session-view
feat/issue-663-restart-classes
feat/issue-661-drain-proof-hard-gate
fix/issue-854-semantic-container-exclusion
issue-640
fix/issue-682-starlette-httpx2
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#941
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.
Follow-up defect discovered after PR #926 merged (
8c1d22a658ecb5715e3f4db6eb7ebb408830c101).Problem
PR #926 implemented the canonical
task_scope=author_issue_bootstrappermission for the clean-control-checkout bootstrap and wired it into the branches-only and anti-stomp decisions.A third enforcement path remains unwired in
workflow_scope_guard.py.The guard's clean-root author branch uses
_cib.is_create_issue_task(mutation_task)instead of the canonicalbootstrap_permits_control_checkout(...)decision and its validated task-scope evidence.The actual operation uses the task name:
That task is not one of the create-issue task literals. Consequently, the workflow raises
workflow_scope_guard.ProductionGuardErrorwith reasonmissing_issue_worktreebeforeassess_author_issue_bootstrapcan evaluatetask_scope=author_issue_bootstrap.This leaves the #892 bootstrap deadlock partially present and prevents issue #931 from receiving a sanctioned author worktree.
Reproduction evidence
Repository state at reproduction
masterSHA:8c1d22a658ecb5715e3f4db6eb7ebb408830c101prgs/master, control checkout HEAD, MCPstartup_head,daemon_start_head,local_head, andcurrent_headall reported that SHA.in_parity:true,stale:false,live_stale:false,restart_required:false,mutation_safe:true.git status --porcelain --untracked-files=all.jcwalker3, profileprgs-author, roleauthor, namespacegitea-author.Canonical operation and task literal
gitea_bootstrap_author_issue_worktreebootstrap_author_issue_worktree(gitea_mcp_server.py:10157)required_operation_permission=gitea.branch.create,allowed_in_current_session:true,restart_required:false,stop_required:false, noblocker_kind.Failure form 1 — default arguments (dry run)
Arguments:
issue_number=931,assignment_id,lease_id,expected_base_sha=8c1d22a658ecb5715e3f4db6eb7ebb408830c101,dry_run=true.Failure form 2 — explicit
branch_nameandworktree_path(dry run)Arguments added:
branch_name=issue-931,worktree_path=<repo>/branches/issue-931-transport-bind-seam. Preceded by its owngitea_whoamiandgitea_resolve_task_capabilitywith the identicalworktree_path.Byte-identical refusal to form 1, including the
missing_issue_worktreereason and the sameProductionGuardErrorclass. Supplying the optional path arguments does not change the outcome, because the guard raises before path binding is considered.Reason code
missing_issue_worktree(workflow_scope_guard.py:48,BLOCKER_MISSING_WORKTREE).Decision path in
workflow_scope_guard.pyThe clean-root author branch at approximately lines 333-344 reads:
The exemption test is a task-name allowlist:
bootstrap_author_issue_worktreeis absent fromCREATE_ISSUE_TASKS, so the author bootstrap always takes theelsearm.workflow_scope_guard.pydoes not consult the canonical predicatePR #926 modified
create_issue_bootstrap.bootstrap_permits_control_checkoutandauthor_issue_bootstrap.assess_author_issue_bootstrap, and wired the two guards named in its own description (the #274 branches-only enforcer and the #604 anti-stomp preflight).workflow_scope_guardholds an independent copy of the clean-root author decision that never routes through that predicate, so the #926 waiver is unreachable on this path.Control-plane state released
A temporary author allocation was created to reproduce the defect and was released through the sanctioned path:
asn-bd6f939293414a51—status: releasedlease-e44a6485417b489f—status: released,released_at 2026-07-26T08:54:38Z,prior_status: activegitea_release_workflow_leaseby owning sessionprgs-author-14609-a7c703a4; verified by re-inspection.No #931 repository artifacts were created
8c1d22a658ecb5715e3f4db6eb7ebb408830c101, working tree clean.*931*.refs/heads/*931*onprgs.branches/for issue 931.inventory_complete:truewith no such entry.status:ready, unassigned.Acceptance criteria
workflow_scope_guarduses the canonical bootstrap authorization decision rather than maintaining a separate task-name allowlist for this case.author_issue_bootstrapoperation may proceed from a clean control checkout far enough to create and bind its issue-backed worktree.bootstrap_author_issue_worktreecall path through every applicable guard, not only the central helper in isolation.Non-goals
Blocking relationship
Issue #931 is blocked by this issue. #931 cannot obtain a sanctioned author worktree until this guard path is wired, and every documented substitute path is forbidden.
No sanctioned MCP capability exists for an author session to create a durable dependency edge directly:
gitea_list_dependency_edgesis read-only and never creates an edge, and edges are derived by the allocator from aDepends on:declaration in the body of the dependent issue. Recording this edge durably therefore requires editing the body of issue #931, which is outside the scope of this issue-creation task and was not performed. The blocking relationship is stated here explicitly instead, with no fallback mutation path used.Origin
This defect is the residue of #892, which PR #926 closed. #892 covered the four-door bootstrap deadlock; #926 fixed two of the three enforcement paths. This issue covers the third.
Canonical Issue State
STATE: in-progress — author worktree created and bound under a one-time operator-authorized bootstrap exception; implementation not yet started.
WHO_IS_NEXT: author
NEXT_ACTION: Write the failing real-path regression for
gitea_bootstrap_author_issue_worktree, then wireworkflow_scope_guardto the canonicalbootstrap_permits_control_checkoutdecision, validate, commit, push, and open the PR for #941.NEXT_PROMPT:
WHAT_HAPPENED: The canonical bootstrap for this issue is blocked by the defect this issue repairs.
gitea_bootstrap_author_issue_worktreefailed closed withWorkflow scope guard (#683) [missing_issue_worktree]: author source/test mutation from the stable control checkout is forbidden; bind an issue-backed worktree under branches/ first(workflow_scope_guard.ProductionGuardError). Every other sanctioned worktree-producing route requires a worktree that does not yet exist:gitea_lock_issuerefuses with the #274 "worktree path does not exist" branch,gitea_publish_unpublished_issue_branchrequiresworktree_pathon an already registered clean worktree,gitea_recover_dirty_orphaned_issue_worktreerequiressource_worktree_path, andgitea_rebind_dirty_same_claimant_author_sessionrequiresworktree_path.gitea_create_issue_commentwas also refused from the stable control checkout before the worktree existed, withDurable author worktree resolution blocked (#618): author mutation blocked: workspace is the stable control checkout; author mutation requires an explicit validated worktree_path or a worktree derived, which is why this record is posted immediately after worktree creation and binding rather than before it. Under a one-time operator authorization scoped to issue #941 alone, exactly one local branch and one local worktree were created with a singlegit worktree add -bfrom the verified live master SHA, then bound throughgitea_lock_issue. No existing worktree was reused or modified, the stable control checkout was not edited, and no remote branch was created manually.WHY: Issue #941 is recursively blocked by the guard path it must repair, so no sanctioned route could produce its worktree. The operator authorized a single narrowly scoped local bootstrap to break the recursion, on the condition that every subsequent Gitea mutation remains MCP-mediated.
RELATED_PRS: none yet for #941. Prior context: PR #926 (merged, closed #892) wired the canonical bootstrap decision into the #274 branches-only and #604 anti-stomp guards but not into
workflow_scope_guard. PR #940 delivered #930.BLOCKERS: none currently blocking author progress. Issue #931 remains blocked by #941 until this correction is reviewed, merged, deployed, and commissioned.
VALIDATION: Base SHA
8c1d22a658ecb5715e3f4db6eb7ebb408830c101agreed across control checkout HEAD, liveprgs/master, MCPstartup_head,daemon_start_head,local_head, andcurrent_head. Parity reportedin_parity:true,stale:false,live_stale:false,restart_required:false,mutation_safe:true. Control checkout clean undergit status --porcelain --untracked-files=all, and still clean and onmasterafter the exception. Fleet: exactly five MCP servers, one per PRGS profile, all client-managed under a single client, with no duplicate profile processes and no unsupportedGITEA_*worktree overrides. Mutation resolver green forcomment_issue,lock_issue, andbootstrap_author_issue_worktree. Identityjcwalker3, profileprgs-author, roleauthor, namespacegitea-author. Branchfix/issue-941-scope-guard-bootstrap-wiringand worktree/Users/jasonwalker/Development/Gitea-Tools/branches/issue-941-scope-guard-bootstrap-wiringdid not exist locally or remotely beforehand; worktree head is the base SHA and the worktree was clean at creation.gitea_lock_issuereturnedadoption_decision: NO_MATCH,competing_branch_check: clear, and lock proofacquired issue #941; branch fix/issue-941-scope-guard-bootstrap-wiring; owner prgs-author; freshness live; no competing live lock. Claimasn-15133423bf614c11/lease-ecf79c663f354894under sessionprgs-author-14609-c5ebad14was obtained through the canonical allocator using a read-only preview followed by an apply pinned to candidate-set fingerprintcff68d1a0929ef9c834ae91ba921244cf663a68d9c848398409fc1182cb3e367, with issue #931 explicitly excluded from the candidate set. No test or source file has been edited yet.LAST_UPDATED_BY: author / jcwalker3 / prgs-author / session prgs-author-14609-c5ebad14
Scope and expiry of the authorization
The authorization covered only: repository
Scaled-Tech-Consulting/Gitea-Tools, issue #941, one #941-specific branch, one #941-specific worktree under the canonicalbranches/directory, the exact verified live master SHA, and immediate registration and binding through the sanctioned author workflow.It did not cover reusing or borrowing any existing worktree, editing the stable control checkout, creating a worktree for #931 or another issue, direct Gitea API access, manual push, manual PR creation, credential access, weakening any guard, or treating this as a general-purpose worktree escape hatch.
The exception is now expired. It was consumed exactly once, by the single
git worktree add -brecorded above. Issue #931 receives no assignment, lease, worktree, branch, commit, or PR from this session.Canonical Issue State
STATE: ready-for-review — PR #942 is open against master at head
a09c485fc0eba75b35986a1833dba986be6c2101,mergeable: true.WHO_IS_NEXT: reviewer
NEXT_ACTION: Independently review PR #942 at exact head
a09c485fc0eba75b35986a1833dba986be6c2101against the #941 acceptance criteria. Do not self-review or self-merge.NEXT_PROMPT:
WHAT_HAPPENED: Implemented and published the #941 correction.
workflow_scope_guard.assess_root_source_mutationnow accepts a server-derivedbootstrap_assessmentand, in the clean-root author case, consultscreate_issue_bootstrap.bootstrap_permits_control_checkoutinstead of the module-local task-name allowlist;assess_production_mutation_guardsforwards it;_enforce_issue_scope_guardaccepts and threads the identical assessment the #274 and #604 guards already consume, and derives the pre-ownership issue-lock waiver from that one canonical decision rather than a second task-name allowlist;verify_preflight_puritypasses the already-computed assessment at both call sites. A second instance of the defect was found during implementation: after themissing_issue_worktreeblock cleared, the bootstrap task failed onmissing_issue_scopebecauserequire_lockalso keyed onis_create_issue_task. Both were corrected the same way. The worktree was created under the one-time operator authorization recorded in comment 17385; that authorization was consumed exactly once and is expired.WHY: PR #926 closed #892 by teaching the canonical predicate to accept
task_scope=author_issue_bootstrapand wiring it into the two guards its description named. A third enforcement path inworkflow_scope_guardkept an independent copy of the decision keyed on a task-name allowlist that never containedbootstrap_author_issue_worktree, so the waiver was unreachable andgitea_bootstrap_author_issue_worktreeraisedProductionGuardError(missing_issue_worktree)beforeassess_author_issue_bootstrapwas consulted. That left the #892 deadlock partially present and blocked #931.RELATED_PRS: PR #942 (open, this correction, Closes #941). PR #926 (merged, closed #892, wired only the #274 and #604 guards). PR #940 (merged, delivered #930).
BLOCKERS: none blocking review. Issue #931 stays blocked until PR #942 is independently approved, merged, deployed, and the fleet restarted and commissioned, because the running servers execute the pre-fix guard until then.
VALIDATION: New regression
tests/test_issue_941_scope_guard_bootstrap_wiring.py, 24 tests, drives the real enforcer throughverify_preflight_purity->_enforce_issue_scope_guard->workflow_scope_guard. Pre-fix on unmodified code: 5 failed, 19 passed, withProductionGuardError: Workflow scope guard (#683) [missing_issue_worktree]. Post-fix: 24 passed in 1.92s. Focused sweep across the 941, 892, 683, 757, create-issue-bootstrap, author-issue-bootstrap, anti-stomp, root-checkout-guard, and 618 suites: 218 passed, 47 subtests passed. Full suite from the branches worktree: 28 failed, 5525 passed, 6 skipped, 994 subtests passed in 147.74s; the failure count matches the standing repository baseline of 28, and the four failures touching these guards were each re-run on unmodified master8c1d22a658ecb5715e3f4db6eb7ebb408830c101and fail identically there (4 failed in 2.92s, no local changes). A full-suite baseline run on unmodified master was still executing when the PR was opened; that comparison is verified only for those four failures until the run is posted. Diff is 3 files, +408 / -2, with no secret-like strings and no unrelated changes. Control checkout remained clean on master at8c1d22a658ecb5715e3f4db6eb7ebb408830c101throughout. Commita09c485fc0eba75b35986a1833dba986be6c2101was published throughgitea_commit_files; PR #942 throughgitea_create_pr; no manual push and no manual PR creation.LAST_UPDATED_BY: author / jcwalker3 / prgs-author / session prgs-author-14609-c5ebad14
Reviewer handoff pin
masterat8c1d22a658ecb5715e3f4db6eb7ebb408830c101fix/issue-941-scope-guard-bootstrap-wiringa09c485fc0eba75b35986a1833dba986be6c2101a09c485)workflow_scope_guard.py,gitea_mcp_server.py,tests/test_issue_941_scope_guard_bootstrap_wiring.pytrueasn-15133423bf614c11, leaselease-ecf79c663f354894, author sessionprgs-author-14609-c5ebad14Any advance of the head invalidates this pin; re-pin before recording a verdict. Issue #931 received no assignment, lease, worktree, branch, commit, or PR from this session and was explicitly excluded from the allocator candidate set.