fix: guard remote/repo mismatch vs local git remote (Closes #530) #555
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#555
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 #530.
Bare
remote=prgsresolved to the hardcodedREMOTESdefaultScaled-Tech-Consulting/Timesheetinstead ofScaled-Tech-Consulting/Gitea-Tools, which is what the local git remote points at. That silent divergence caused false 404s (e.g. PR #527 / issue #515 lookups) and risked mutating the wrong repository.Root cause
gitea_auth.pyREMOTES["prgs"]["repo"] = "Timesheet". When noprofiles.jsonoverlay suppliesdefault_repo,_resolve("prgs", ...)with no explicitorg/repoyieldsScaled-Tech-Consulting/Timesheet. The shared default is intentionally left unchanged (theprgsinstance also hostsTimesheet); instead the fix fails closed on a proven mismatch.Fix
remote_repo_guard.py— pureassess_remote_repo_match(...)+format_remote_repo_guard_error(...), mirroring theroot_checkout_guard.pyshape.gitea_mcp_server._resolvevia_enforce_remote_repo_guard, so every read/lookup/mutation tool that resolves a target is covered at one chokepoint.org/reposlug is absent from the local git remote URL and the caller did not pass explicitorg/repo.organdrepoare explicit, skips when the local remote URL is unavailable (best-effort), and is bypassed under pytest unlessGITEA_FORCE_REMOTE_REPO_CHECK=1so the unit suite (which calls tools with bare remotes against mocked APIs) is unaffected.Acceptance criteria
remote=prgsresolving to the wrong repogitea_view_issuefails closed before any API call)remote/org/repoFiles changed
remote_repo_guard.py(new)gitea_mcp_server.py— import +_resolvehook +_enforce_remote_repo_guardtests/test_remote_repo_guard.py(new) — pure-function cases + server-wiring casesskills/llm-project-workflow/templates/{start-issue,review-pr,merge-pr}.mdValidation
The 2 full-suite failures (
test_verify_preflight_blocks_control_checkout_with_test_porcelain,test_pr487_style_merge_binds_clean_merger_workspace) are pre-existing on cleanmaster— verified by running both against the root master checkout, where they fail identically atgitea_mcp_server.py:715. Neither touches remote/repo resolution.LLM Handoff Metadata
repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #555
issue: #530
reviewer_identity: sysadmin
profile: prgs-reviewer
session_id: 34818-d3f66410a126
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-pr555
phase: claimed
candidate_head:
fd2bc018fftarget_branch: master
target_branch_sha:
18e7d7b6e1last_activity: 2026-07-09T02:00:54Z
expires_at: 2026-07-09T04:00:54Z
blocker: none
repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #555
issue: #530
reviewer_identity: sysadmin
profile: prgs-reviewer
session_id: 34818-d3f66410a126
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-pr555
phase: released
candidate_head:
fd2bc018fftarget_branch: master
target_branch_sha:
18e7d7b6e1last_activity: 2026-07-09T02:01:05Z
expires_at: 2026-07-09T04:01:05Z
blocker: manual-release
repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #555
issue: #530
reviewer_identity: sysadmin
profile: prgs-reviewer
session_id: 34818-d3f66410a126
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-pr555-fresh2
phase: claimed
candidate_head:
fd2bc018fftarget_branch: master
target_branch_sha:
18e7d7b6e1last_activity: 2026-07-09T02:04:51Z
expires_at: 2026-07-09T04:04:51Z
blocker: none
repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #555
issue: #530
reviewer_identity: sysadmin
profile: prgs-reviewer
session_id: 34818-d3f66410a126
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-pr555-fresh2
phase: claimed
candidate_head:
fd2bc018fftarget_branch: master
target_branch_sha:
18e7d7b6e1last_activity: 2026-07-09T02:05:33Z
expires_at: 2026-07-09T04:05:33Z
blocker: none
Fresh independent review — PR #555 / Issue #530
Verdict: APPROVE
Live re-verification
fd2bc018ffabcdcd7d6c55af1463687d7d18328b18e7d7b6e18cfb8d3941f3fd780601e5b87f854bjcwalker3— reviewer:sysadmin/prgs-reviewer(not self-review)branches/review-pr555-fresh2Scope
remote_repo_guard.pypure assessmentgitea_mcp_server._resolvevia_enforce_remote_repo_guardGITEA_FORCE_REMOTE_REPO_CHECKtests/test_remote_repo_guard.pyValidation (this session)
git diff --check prgs/master...HEAD: cleanCorrectness
_resolvecovers all toolsNo REQUEST_CHANGES findings.
Next: merger may merge at head
fd2bc018ffabcdcd7d6c55af1463687d7d18328bafter formal APPROVED is visible.adopted_at: 2026-07-09T02:06:52Z
adopted_by_identity: sysadmin
adopted_by_profile: prgs-merger
adopted_from_session_id: 34818-d3f66410a126
adopted_from_profile: prgs-reviewer
adopted_from_reviewer_identity: sysadmin
adopted_from_comment_id: 7343
adoption_reason: merger-handoff-approved-head
repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #555
issue: #530
reviewer_identity: sysadmin
profile: prgs-merger
session_id: 34822-0282f7356d08
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/merge-pr555
phase: adopted
candidate_head:
fd2bc018fftarget_branch: master
target_branch_sha:
18e7d7b6e1last_activity: 2026-07-09T02:06:52Z
expires_at: 2026-07-09T04:06:52Z
blocker: none
repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #555
issue: #530
reviewer_identity: sysadmin
profile: prgs-merger
session_id: 34822-0282f7356d08
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/merge-pr555
phase: released
candidate_head:
fd2bc018fftarget_branch: master
target_branch_sha:
18e7d7b6e1last_activity: 2026-07-09T02:07:54Z
expires_at: 2026-07-09T04:07:54Z
blocker: post-merge-moot