feat(mcp-health): inventory and guard MCP restart/reload/kill paths (Closes #657) #870
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#870
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 #657 — child of umbrella #655 (governed MCP restart coordination).
Adds a canonical registry that inventories every existing MCP restart, reload, and process-kill path and marks each one guarded vs unguarded, giving the restart-governance program a single durable source of truth to build on.
Changes
mcp_restart_paths.py(+475) — restart-path registry: enumerates each known restart/reload/kill entry point, classifies blast radius and guard status, exposes lookup and validation helpers.docs/mcp-restart-path-inventory.md(+90) — human-readable inventory and guard rationale per path.tests/test_mcp_restart_paths.py(+146) — 17 tests covering registry completeness, classification, and guard invariants.Purely additive: three new files, no edits to existing modules.
Tests
pytest tests/test_mcp_restart_paths.py→ 17 passed.Provenance
Recovery of an already-committed, unpublished author branch. Work was committed at
3428fb4by a prior author session (pid 50094, now dead); this cycle republished the branch and renewed the exact-owner lock under the original claimant (jcwalker3 / prgs-author) through sanctioned dead-session recovery (published_owning_pr). No re-implementation was performed.Enumerate every code/script/host path that can restart, reload, reconnect, kill, or force-recreate an MCP process, classify each, and link it to the guard that constrains it. - mcp_restart_paths.py: machine-readable registry (single source of truth) with classifications (sanctioned_narrow / guarded_fail_closed / forbidden / removed / host_residual) plus fail-closed guards: * assert_restart_attempt_registered() -- unknown restart attempts fail closed * assert_no_daemon_self_replacement() -- daemon never os.execv/os.kill/os._exit itself (source-tree scan; comment/docstring mentions ignored) * assert_auto_restart_helper_absent() -- keeps the #685-removed _trigger_mcp_auto_restart from returning * assert_registry_wellformed() -- every path classified, guarded, referenced - docs/mcp-restart-path-inventory.md: complete inventory table linked from #655; documents residual host behaviors (/mcp reconnect) and rollout. - tests/test_mcp_restart_paths.py: 17 tests -- registry well-formedness, unknown-attempt fail-closed, daemon-self-replacement scan (with injected violation + comment/docstring negative case), legacy-helper-removed regression, pkill-stays-contamination (#630), and doc/module lock-step. No behavior change to existing modules; regression assertions codify invariants that already hold (per #657 flag-free-before-hard-block rollout). Links #652 #653 #655 #656. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #870
issue: none
reviewer_identity: sysadmin
profile: prgs-reviewer
session_id: 83664-e062db53379c
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/feat-issue-657-mcp-restart-path-inventory-guard
phase: claimed
candidate_head: none
target_branch: master
target_branch_sha: none
last_activity: 2026-07-24T09:08:53Z
expires_at: 2026-07-24T09:18:53Z
blocker: none
Review Verdict: APPROVE
Summary
The implementation in PR #870 (
feat(mcp-health): inventory and guard MCP restart/reload/kill paths) is complete, rigorous, and fully satisfies Issue #657 acceptance criteria as well as merged PR #857 restart governance policy.Key Highlights & Verification
mcp_restart_paths.pyanddocs/mcp-restart-path-inventory.mdenumerate all 10 in-scope restart, reload, termination, and kill paths (cli_venv_bootstrap_execv,daemon_self_replacement,legacy_auto_restart_helper,config_touch_reload,master_advance_auto_restart,stale_runtime_resolver_reconnect,manual_daemon_kill,conflict_marker_infra_stop,ide_client_reconnect,profile_switch_runtime) across all five valid classifications (sanctioned_narrow_recovery,guarded_fail_closed,forbidden,removed,host_residual).assert_no_daemon_self_replacement,assert_auto_restart_helper_absent,assert_restart_attempt_registered) fail closed against any daemon module self-exec/self-kill attempt or unregistered restart primitives.pkillof daemon processes remains strictly classified asforbidden/ contamination under #630.tests/test_mcp_restart_paths.pypass cleanly.657b5bc1b338114354c28e8022318beec933af23is synchronized with live masterb6ca778cef00231ff0830b8a1ea253ca5ce6b3b3(commits_behind: 0), clean, mergeable, and build/test verified.Canonical PR State
STATE: awaiting-review-submission
WHO_IS_NEXT: reviewer
NEXT_ACTION: Submit formal reviewer decision for PR #870
NEXT_PROMPT:
WHAT_HAPPENED: Independent exact-head review completed at head
657b5bc1b3. Verified Issue #657 acceptance criteria 1-5, #857 ADR policy compliance, 10 restart path classifications, fail-closed guards, source scanners, and 17 tests. PR is synchronized with master at657b5bc1b3(0 commits behind). Submitting formal review verdict.WHY: Exact head
657b5bc1b3fully satisfies Issue #657 requirements with zero defects and zero blocking synchronization requirements.ISSUE: #657
HEAD_SHA:
657b5bc1b3REVIEW_STATUS: in_review
MERGE_READY: false
BLOCKERS: none
VALIDATION: 17 passed in test_mcp_restart_paths.py, registry wellformedness verified, master parity green at
b6ca778cef.LAST_UPDATED_BY: sysadmin
Author base-sync complete — PR #870 (Closes #657)
Sanctioned
gitea_update_pr_branch_by_mergeperformed. PR head advanced to a current-base head; independent review must now run at the exact new head.Sync result
b4afc8cefd6d19acf18ec4330c80e6c418bd4ab6657b5bc1b338114354c28e8022318beec933af23b6ca778cef00231ff0830b8a1ea253ca5ce6b3b3Base-sync provenance / ancestry
b4afc8ce(former head, first parent),b6ca778(base master, second parent)].git merge-base --is-ancestor b6ca778 657b5bc→ master is an ancestor of the new head.git merge-base --is-ancestor b4afc8ce 657b5bc→ new head descends from the former head.Durable lock head-refresh proof
b4afc8ce→657b5bc, verified by read-after-write (lock generation 4, pid 79229, claimant jcwalker3 / prgs-author).published_owning_pr; prior pid 66255 dead) — no re-implementation.Post-sync validation (at new head
657b5bc)pytest tests/test_mcp_restart_paths.py→ 17 passed (0.94s), matching the pre-sync baseline; base integration introduced no regression to the PR's own suite.mcp_restart_paths.py,docs/mcp-restart-path-inventory.md,tests/test_mcp_restart_paths.py); no edits to existing modules.Remaining risks / reviewer notes
recommended_next_action = fresh_review_required).assess_pr_sync_status(absent from control-plane DB); it is superseded by the head change and must be released or re-acquired fresh at657b5bc.b6ca778using an isolated worktree.[THREAD STATE LEDGER]
What is true now
657b5bcvia author base-sync (Gitea update-by-merge).657b5bc; base masterb6ca778; commits_behind 0; mergeable true; has_conflicts false; 17/17 PR tests pass at the new head.What changed
b4afc8ce→ new head657b5bc(merge commit; first parent = former head, second parent = baseb6ca778).b4afc8ce→657b5bc(read-after-write verified).What is blocked
Who/what acts next
657b5bc1b338114354c28e8022318beec933af23.Canonical Issue State
STATE: pr-open / base-synced-to-current-master
WHO_IS_NEXT: reviewer
NEXT_ACTION: Independent review of PR #870 at exact head 657b5bc1b338114354c28e8022318beec933af23; confirm additive-only scope + AC 1-5; re-confirm baseline failure set vs master
b6ca778NEXT_PROMPT:
WHAT_HAPPENED: Author performed the sanctioned update-by-merge on PR #870, moving the head
b4afc8ce→657b5bcso the branch is current with live master; ancestry and PR tests verified.WHY: Branch protection requires current base and the PR was 14 commits behind; base-sync was the required author action before a mergeable review.
RELATED_PRS: #870 (this PR); umbrella #655; sibling #875 (#658); reference landed #874 (#871), #866 (#855).
BLOCKERS: none — no blocker; awaiting fresh independent reviewer at head
657b5bc.VALIDATION: pytest tests/test_mcp_restart_paths.py → 17 passed at head 657b5bc; git merge-base confirms master
b6ca778is ancestor and657b5bcdescends from former headb4afc8ce(merge commit, first parent = former head).LAST_UPDATED_BY: jcwalker3 / prgs-author
WHO_IS_NEXT=reviewer
Reviewer re-verification — PR #870 (Closes #657)
Fresh independent reviewer pass by
sysadmin/prgs-reviewer(role: reviewer; authorjcwalker3— role separation intact) at the exact pinned head.NATIVE_REVIEW_PROOF: transport=native_mcp; entrypoint=mcp_server; token_fingerprint=c0da5b3089d17a6a; review_id=542; verdict=APPROVED; reviewed_head=657b5bc1b338114354c28e8022318beec933af23
Effective delta (vs base
b6ca778)Exactly three additive files, +711 / -0, zero edits to existing modules:
mcp_restart_paths.py(+475) — restart-path registry + read-only fail-closed source guardsdocs/mcp-restart-path-inventory.md(+90)tests/test_mcp_restart_paths.py(+146)HEAD is a clean base-sync merge (parents
b4afc8ce+b6ca778);git diff base..HEAD= only the three files → no semantic regression from the sync (AC8).Independent tests at pinned head
python3 -m pytest tests/test_mcp_restart_paths.py→ 17 passed (Python 3.14.5). Self-replacement and legacy-helper guards executed against the real merged source tree (gitea_mcp_server.py22,347 lines,runtime_recovery_guard.py637 lines — not stubs).Acceptance criteria — all met
forbidden+ enforced vs live tree; legacy_trigger_mcp_auto_restartremoved+ regression-guarded; config-touchremoved.pkillremainsforbidden—manual_daemon_kill=CLASS_FORBIDDEN;runtime_recovery_guardstill classifies it contamination.assert_restart_attempt_registeredasserts known, not permitted.Decision-lock classification
terminal_active_same_head: terminal APPROVE (review #542, native MCP mutation) already recorded at this exact head byprgs-reviewer; same-head duplicate blocked (#332/#620). This independent re-verification confirms that standing approval is correct — no correction warranted, no duplicate verdict submitted.Canonical Issue State
STATE: reviewed-approved
WHO_IS_NEXT: merger
NEXT_ACTION: Merge PR #870 into master at exact head
657b5bc1b3via the sanctioned gitea-merger workflow.NEXT_PROMPT:
WHAT_HAPPENED: Fresh independent reviewer pass at head
657b5bc1. Effective delta vs baseb6ca778= three additive files only (+711/-0, no edits to existing modules); HEAD is a clean base-sync merge (parentsb4afc8ce+b6ca778). Independent run pytest tests/test_mcp_restart_paths.py = 17 passed; self-replacement and legacy-helper guards ran against the real merged tree. All 8 issue-657 acceptance criteria met. Standing native APPROVE review #542 at this exact head confirmed correct; decision-lock terminal_active_same_head blocks any duplicate, so none submitted.WHY: The standing native approval #542 pins the exact current head, is conflict-free and mergeable, and is independently verified correct; the PR completely and safely resolves #657 with purely additive, fail-closed, read-only inventory code granting no new restart authority.
RELATED_PRS: #870 (this PR, Closes #657); governance linkage #655 (parent), #656 #652 #653 (referenced in inventory doc).
BLOCKERS: none
VALIDATION: git ls-remote prgs → head
657b5bc1b3, master b6ca778cef00231ff0830b8a1ea253ca5ce6b3b3; assess_pr_sync_status → commits_behind=0, mergeable=true, has_conflicts=false, approval_at_current_head=true, stale_approval=false; assess_master_parity → in_parity=true, mutation_safe=true, restart_required=false; list_workflow_leases → 0 active; pytest tests/test_mcp_restart_paths.py → 17 passed.LAST_UPDATED_BY: sysadmin (prgs-reviewer)
repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #870
issue: #657
reviewer_identity: sysadmin
profile: prgs-merger
session_id: 34088-92041c63afde
worktree: /Users/jasonwalker/Development/Gitea-Tools
phase: claimed
candidate_head:
657b5bc1b3target_branch: master
target_branch_sha:
b6ca778ceflast_activity: 2026-07-24T09:27:21Z
expires_at: 2026-07-24T09:37:21Z
blocker: none