feat: isolate MCP workspace binding across role namespaces (Closes #510) #512
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#512
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 #510
Summary
Isolates MCP workspace binding per role namespace so
GITEA_AUTHOR_WORKTREEcannot poison reviewer, merger, or reconciler workspace purity checks.Changes
namespace_workspace_binding.py— role-scoped resolution (GITEA_AUTHOR_WORKTREE,GITEA_REVIEWER_WORKTREE,GITEA_MERGER_WORKTREE,GITEA_RECONCILER_WORKTREE), foreign-binding detection, canonical error messages with binding source and remediationgitea_mcp_server.py— namespace-aware preflight/workspace guards;_verify_role_mutation_workspacefor reviewer/merger mutations;worktree_pathon merge/review toolsdocs/llm-workflow-runbooks.md— namespace binding table, reconnect procedure, CTH guidancetests/test_namespace_workspace_binding.py— acceptance criteria coverage#274 / #475 preserved
branches/worktrees (#274)Validation
Worktree
/Users/jasonwalker/Development/Gitea-Tools/branches/issue-510-workspace-binding-isolation@f1ad665f1ad665242to3d11e1f12brepo: Scaled-Tech-Consulting/Gitea-Tools
pr: #512
issue: #510
reviewer_identity: sysadmin
profile: prgs-reviewer
session_id: 99141-ac1abd572f02
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-pr512-submit
phase: claimed
candidate_head:
3d11e1f12btarget_branch: master
target_branch_sha: none
last_activity: 2026-07-08T08:25:43Z
expires_at: 2026-07-08T10:25:43Z
blocker: none
Review report — PR #512 / issue #510
Verdict: APPROVED @
3d11e1f12b659bf28e8dde06e1ca73268786197bIdentity / profile proof
gitea-reviewerprgs-reviewersysadmin(user_id 4)review_prallowedSelf-review proof
jcwalker3sysadmin— not self-review (self_author: false)PR gate proof
3d11e1f12b659bf28e8dde06e1ca73268786197b(matches expected)feat/issue-510-workspace-binding-isolationbranches/review-pr512-submit(detached @ head; author worktrees untouched)Scope check (7 files, +776/-47)
namespace_workspace_binding.py— role-scoped env resolution; foreign-binding detection; actionable errorsgitea_mcp_server.py— namespace-aware preflight;_verify_role_mutation_workspace(task=...)wired for review/merge/lease paths; #502 task mismatch preservedtests/test_namespace_workspace_binding.py— AC coverage for cross-namespace isolationtests/test_mcp_server.py— preflight error format updatesdocs/llm-workflow-runbooks.md,.env.example,author_mutation_worktree.pycommentReview focus findings
GITEA_AUTHOR_WORKTREEignored for reviewer/merger/reconciler; per-role env vars used.task="review_pr"/task="merge_pr"through_verify_role_mutation_workspace→verify_preflight_purity.branches/worktree; dirty active workspace still fails closed; non-author merger/reconciler may use clean control checkout.gitea_heartbeat_reviewer_pr_leasestill callsverify_preflight_purity(task="review_pr")directly; acceptable because namespace-scoped resolution already applies at that layer.Validation
py_compile(changed Python)test_merge_blocked_on_stale_approval_head)git diff --check prgs/master...HEADwould_perform: true@ pinned headMutation ledger
gitea_whoami(read)gitea_resolve_task_capability(task=review_pr)(read)gitea_view_pr/gitea_check_pr_eligibility(read)gitea_acquire_reviewer_pr_lease(lease @branches/review-pr512-submit)gitea_dry_run_pr_review(action=approve)(dry-run)gitea_mark_final_review_decision(action=approve)(session state)gitea_submit_pr_review(action=approve)(live review mutation)Merger handoff (pinned)
After merge, re-test PR #487 merge using merger namespace with clean
GITEA_MERGER_WORKTREEor clean control checkout — do not bind viaGITEA_AUTHOR_WORKTREE.repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #512
issue: #510
reviewer_identity: sysadmin
profile: prgs-reconciler
session_id: 99141-ac1abd572f02
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-pr512-submit
phase: released
candidate_head:
3d11e1f12btarget_branch: master
target_branch_sha:
c54ac0d4delast_activity: 2026-07-08T08:42:27Z
expires_at: 2026-07-08T10:42:27Z
blocker: none
[RECONCILER RESULT] Post-merge moot lease cleanup — PR #512 / issue #510
Identity / profile proof
prgs-reconcilersysadminScaled-Tech-Consulting/Gitea-Toolsbranches/reconcile-pr512-moot@af938064cd7558872af888c41eef64380ff0a111MCP / #515 behavior
prgs/masterincludesgitea_cleanup_post_merge_moot_lease(#527).Lease IDs inspected
claimedprgs-reviewerreleasedprgs-reconciler#515 reconciliation
c54ac0d4...); issue #510 closed.cleanup_allowed=false— #6761 terminal.Cleanup mutation performed
None.
Skipped
Conclusion: Moot lease already resolved; #6724 superseded by #515 newest-terminal logic.