feat(guard): harden workflow against unattributed root WIP and pytest-disabled production guards (Closes #683) #684
Merged
sysadmin
merged 1 commits from 2026-07-12 18:58:55 -05:00
fix/issue-683-workflow-guard-hardening 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#684
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.
Summary
Closes #683. Hardens the author/MCP workflow so unattributed root/control-checkout source WIP and pytest-disabled production guards fail closed, without adopting rejected preservation evidence from #681 (
300a4ca).What changed
workflow_scope_guard.py— pure assessor for:blocker_kind+exact_next_action)GITEA_TEST_FORCE_PRODUCTION_GUARDS=1)gitea_mcp_server.pyverify_preflight_purityno longer treats pytest alone as a reason to skip production root/branches/scope when force-on is set_verify_role_mutation_workspacedocuments and preserves no test-mode early-return (rejected300a4capattern)_enforce_issue_scope_guard+ typed block mapping ongitea_create_issue/gitea_create_issue_commenttests/test_issue_683_workflow_scope_guards.pyplus updates so entrypoint tests accept typed blockers without patching production guards awayExplicit non-goals
chore/issue-681-preserve-review-session-wip/300a4ca*.pyunder pytest_verify_role_mutation_workspaceunder test modeValidation
compileallon changed modules: OKmasterthroughoutReviewer notes
Next role
Independent REVIEWER — do not self-review or merge.
Canonical Issue State
STATE:
ready-for-review
WHO_IS_NEXT:
reviewer
NEXT_ACTION:
Independent REVIEWER validates this PR against #683 ACs; do not self-review or merge
NEXT_PROMPT:
WHAT_HAPPENED:
Author shipped #683 hardening in commit
d302602and opened this PR with Closes #683.Implementation summary:
Exact guard locations:
Proof pytest cannot disable production enforcement:
300a4caearly-return and porcelain py filterWHY:
Process hardening for unattributed root WIP and pytest-disabled production guards, owned by #683 and distinct from #681 preservation and #604/#680 product work.
RELATED_PRS:
#684 (this PR); #680 anti-stomp (do not absorb); #681 preserve evidence only
BLOCKERS:
none for independent review
VALIDATION:
d302602LAST_UPDATED_BY:
jcwalker3 / prgs-author / 2026-07-12
repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #684
issue: #683
reviewer_identity: sysadmin
profile: prgs-reviewer
session_id: 44608-96a6d9d79332
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-pr-684
phase: claimed
candidate_head:
d302602567target_branch: master
target_branch_sha:
22698c1b5flast_activity: 2026-07-12T17:21:08Z
expires_at: 2026-07-12T19:21:08Z
blocker: none
[THREAD STATE LEDGER]
What is true now:
22698c1b5f.3fd02a3) and has not been landed on master.What changed:
What is blocked:
Who/what acts next:
d302602.Server-side decision state: PR #684 has no formal review verdict on record; #332 terminal-review lock held by the PR #680 APPROVE in the current MCP run
Local verdict/state: APPROVE-with-notes at head d302602; evidence complete in this comment
Next actor: reviewer
Required action: fresh gitea-reviewer MCP run, re-pin head, then mark_final_review_decision(approve) + gitea_submit_pr_review(approve) referencing this comment
Blocker classification: process/rule blocker
Do not do: do not land PR #684 on master before the formal APPROVE verdict exists on the PR; do not use gitea_cleanup_stale_review_decision_lock while PR #680 remains open; do not delete session-state files by hand; do not re-review from scratch unless head moves off d302602; do not treat this comment as a substitute for the formal verdict.
Canonical Issue State
STATE:
review-evidence-complete — local verdict APPROVE-with-notes at d302602; formal verdict recording deferred to a fresh MCP run (#332 gate)
WHO_IS_NEXT:
reviewer
NEXT_ACTION:
Operator reconnects gitea-reviewer namespace; reviewer records formal APPROVE per NEXT_PROMPT
NEXT_PROMPT:
WHAT_HAPPENED:
Independent reviewer (sysadmin / prgs-reviewer; distinct identity from author jcwalker3 / prgs-author) completed a full review of PR #684 at pinned head
d302602from detached review worktree branches/review-pr-684. Control root stayed clean on master @22698c1throughout.Scope verified: 8 files, all #683 hardening surface; single commit based directly on master (merge-base = master head); no cherry-pick of 300a4ca; no absorption of #604/#680 product work; issue_lock_worktree.py has a 0-line diff (no porcelain *.py filter); no test-mode early-return in _verify_role_mutation_workspace (static grep plus regression test).
Files/entrypoints inspected: workflow_scope_guard.py (full read); gitea_mcp_server.py diff — verify_preflight_purity, _enforce_issue_scope_guard, _session_issue_lock_snapshot, _production_guard_block_from_exc, _verify_role_mutation_workspace, gitea_create_issue (~2081), gitea_create_issue_comment (~8360), _enforce_branches_only_author_mutation (588), _actual_profile_role (244); issue_lock_worktree.read_worktree_git_state; reviewer_worktree.parse_dirty_tracked_files; verify_lock_for_mutation wiring (create_pr, 2553); all 5 changed test files plus new tests/test_issue_683_workflow_scope_guards.py (full read).
Acceptance-criteria verification (all pass):
Exact test results (independent run in branches/review-pr-684):
22698c1in a branches/ worktree): 2596 passed, 6 skipped → delta +19 equals exactly the new #683 tests; no coverage lostFindings (non-blocking; file:line at
d302602):Remaining risks: findings 2 and 3; both fail toward safety (nothing weakened) and neither violates a #683 hard acceptance criterion.
WHY:
All decision rules verified: ownership cannot be spoofed, root diagnostic edits fail closed, pytest cannot disable or conceal production guards, the force-on flag only strengthens test coverage, the failure ledger is safe and correctly ordered, issue creation and canonical comments remain usable without opening a scope bypass, no mutation occurs before the guard, and full-suite parity plus 19 new regression tests hold.
RELATED_PRS:
#684 (this PR — review evidence complete); #680 (open; carries this run's terminal APPROVE verdict; its landing sequence owns that budget); #681 preserve branch is evidence only
BLOCKERS:
#332 one-terminal-review-mutation-per-run gate fail-closed mark_final_review_decision for PR #684 because this MCP server run's terminal review mutation was already consumed by the PR #680 APPROVE verdict (head
3fd02a3). PR #680 remains open, so the stale-lock cleanup tool is not eligible. This durable record satisfies the #683 AC8 pattern (record the workflow/tooling stop before further work). Recovery: fresh gitea-reviewer MCP run, then NEXT_PROMPT.VALIDATION:
d302602unchanged; master22698c1unchangedLAST_UPDATED_BY:
sysadmin / prgs-reviewer / 2026-07-12
repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #684
issue: #683
reviewer_identity: sysadmin
profile: prgs-reviewer
session_id: 76849-6f9103e12ee9
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-pr-684
phase: claimed
candidate_head:
d302602567target_branch: master
target_branch_sha:
22698c1b5flast_activity: 2026-07-12T23:28:56Z
expires_at: 2026-07-13T01:28:56Z
blocker: none
repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #684
issue: #683
reviewer_identity: sysadmin
profile: prgs-reviewer
session_id: 76849-6f9103e12ee9
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-pr-684
phase: released
candidate_head:
d302602567target_branch: master
target_branch_sha:
22698c1b5flast_activity: 2026-07-12T23:51:35Z
expires_at: 2026-07-13T01:51:35Z
blocker: manual-release
repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #684
issue: #683
reviewer_identity: sysadmin
profile: prgs-reviewer
session_id: 76849-c083d5c9e7da
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-pr-684
phase: claimed
candidate_head:
d302602567target_branch: master
target_branch_sha:
22698c1b5flast_activity: 2026-07-12T23:52:05Z
expires_at: 2026-07-13T01:52:05Z
blocker: none
[THREAD STATE LEDGER] PR #684 — formal APPROVE verdict recorded at head
d302602What is true now:
d302602567via the review APId302602)What changed:
d302602and base master22698c1, then recorded this verdictWhat is blocked:
Who/what acts next:
300a4cabranchCanonical PR State
STATE:
approve-verdict-recorded — formal APPROVE at head
d302602567WHO_IS_NEXT:
merger
NEXT_ACTION:
Merge PR #684 into master after re-verifying live head and this verdict
NEXT_PROMPT:
WHAT_HAPPENED:
Independent review completed earlier today at pinned head d302602; canonical evidence in PR comment 10606 (scope verification, all #683 acceptance criteria, focused suite 19 passed, changed suites 30 passed, guard/lease/review/merge suites 155 passed, full suite 2615 passed / 6 skipped, baseline delta +19, compileall OK, four non-blocking findings). Formal verdict recording was deferred through the #584/#672 transport incident and completed in this fresh client-managed reviewer run after operator reconnect (defect capture: #685 resolver contract, #686 duplicate-launch guardrail).
WHY:
All #683 acceptance criteria verified; the four findings are non-blocking and fail toward safety; full-suite parity with the author's report.
ISSUE:
#683
HEAD_SHA:
d302602567REVIEW_STATUS:
formal APPROVE verdict recorded by sysadmin/prgs-reviewer at head d302602567a1fb7842fe5486fa5a49509506ec8b; no blocking change requests on record
MERGE_READY:
true — eligible for merger workflow once this APPROVE verdict is confirmed visible at live head
d302602BLOCKERS:
none
VALIDATION:
d302602unchanged; base master22698c1unchanged; no other reviews on record for this PR22698c1with restart_required=falseLAST_UPDATED_BY:
sysadmin / prgs-reviewer / 2026-07-12
[THREAD STATE LEDGER] PR #684 — formal APPROVE verdict now visible at head d302602; hand off to merger
What is true now:
What changed:
What is blocked:
Who/what acts next:
d302602and this verdict remains visible and undismissed; do not absorb #680/#604 work; do not use the preserved300a4cabranch; reviewer session does not mergeCanonical Issue State
STATE:
approve-verdict-recorded — formal APPROVE visible at head d302602567a1fb7842fe5486fa5a49509506ec8b; merger workflow is next
WHO_IS_NEXT:
merger
NEXT_ACTION:
Run canonical merge workflow for PR #684 (verify verdict at live head, merger lease, merge, post-merge cleanup)
NEXT_PROMPT:
WHAT_HAPPENED:
Independent review evidence (comment 10606) was recorded at pinned head
d302602earlier today; the formal verdict recording was deferred through the #584/#672 transport incident and completed in this fresh client-managed reviewer run after operator reconnect. Read-back proof: approval_visible=true at the exact expected head, review not stale, not dismissed.WHY:
All #683 acceptance criteria verified with full-suite parity; the four review findings are non-blocking and fail toward safety; defect remediation is owned by #685/#686 and does not gate this PR.
RELATED_PRS:
#680 (separate landing sequence; do not absorb)
BLOCKERS:
none
VALIDATION:
LAST_UPDATED_BY:
sysadmin / prgs-reviewer / 2026-07-12
adopted_at: 2026-07-12T23:58:44Z
adopted_by_identity: sysadmin
adopted_by_profile: prgs-merger
adopted_from_session_id: 76849-c083d5c9e7da
adopted_from_profile: prgs-reviewer
adopted_from_reviewer_identity: sysadmin
adopted_from_comment_id: 10670
adoption_reason: merger-handoff-approved-head
repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #684
issue: #683
reviewer_identity: sysadmin
profile: prgs-merger
session_id: 20471-30adf7988c7e
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/merge-pr-684
phase: adopted
candidate_head:
d302602567target_branch: master
target_branch_sha:
22698c1b5flast_activity: 2026-07-12T23:58:44Z
expires_at: 2026-07-13T01:58:44Z
blocker: none
repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #684
issue: #683
reviewer_identity: sysadmin
profile: prgs-merger
session_id: 20471-30adf7988c7e
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/merge-pr-684
phase: released
candidate_head:
d302602567target_branch: master
target_branch_sha:
22698c1b5flast_activity: 2026-07-12T23:59:14Z
expires_at: 2026-07-13T01:59:14Z
blocker: post-merge-moot
Canonical Issue State
STATE: merged — PR #684 landed on master; merge complete
WHO_IS_NEXT: reconciler
NEXT_ACTION: Optional post-merge cleanup: delete source branch
fix/issue-683-workflow-guard-hardening(requiresgitea.branch.delete/ reconciler); remove stalestatus:pr-openfrom closed issue #683 if still present; local worktree prune as operator prefers. Product follow-ups #685 and #686 remain open and are not part of this merge.NEXT_PROMPT:
WHAT_HAPPENED:
Independent MERGER session (sysadmin / prgs-merger) completed a fresh preflight and merged PR #684.
Authorization proof
MERGE PR 684+ expected headd302602567a1fb7842fe5486fa5a49509506ec8bIdentity / separation
sysadmin/prgs-mergerwithgitea.pr.mergejcwalker3— distinct (self-merge blocked)sysadmin/prgs-reviewer— same Gitea user, distinct execution profile/role (prgs-mergervsprgs-reviewer); hard gate is author≠mergerPreflight (passed)
review-merge-prhash da045d1e1f1f)branches/merge-pr-684clean; control root clean on mastergitea_adopt_merger_pr_leasecomment 10691 (from reviewer session 76849-c083d5c9e7da)Merge result
d302602567a1fb7842fe5486fa5a49509506ec8b56f1230a10a21b16226c792a5bcdc4398c97b09aCleanup
WHY: All merge gates passed with operator confirmation; formal APPROVE applied to exact pinned head; Gitea mergeable=true honored required checks.
RELATED_PRS: #684 (this, merged); linked #683 closed; non-blocking #685 #686; do not absorb #680/#604
BLOCKERS: none for this merge. Residual cleanup only: remote source branch may remain; #683 may still show stale
status:pr-openlabel until reconciler/label cleanup.VALIDATION:
git merge-base --is-ancestor d302602 prgs/master→ YESLAST_UPDATED_BY: sysadmin / prgs-merger / MERGER / 2026-07-12
Stale #332 review-decision lock cleanup (#594)
Status: APPLIED
sysadminprgs-reviewer2026-07-13T01:45:12.425430+00:00approveon PR feat(guard): harden workflow against unattributed root WIP and pytest-disabled production guards (Closes #683) (#684)closed(merged=True)56f1230a10a21b16226c792a5bcdc4398c97b09a1prgs-reviewerManual deletion of session-state files is not the workflow.
This path only clears a lock when the referenced PR is merged/closed.