feat(webui): sanctioned restart and graceful reload controls (Closes #642) #863

Merged
sysadmin merged 8 commits from feat/issue-642-sanctioned-restart-controls into master 2026-07-24 07:21:18 -05:00
Owner

Summary

Implements Phase 2 sanctioned restart and graceful reload controls for the MCP Control Plane Web Console. Namespace restarts now run through an authorized, confirmed, audited, capability-gated path instead of manual host process killing (#630).

Closes #642

Changes

  • webui/sanctioned_restart.py — restart/reload operation model for the system.restart_namespace gated action: dry-run intent preview, confirmation-string enforcement, audit emission, and post-restart health verification. Fails closed on unknown auth, missing capability, or ambiguous target namespace.
  • webui/console_authz.py — RBAC entries for the restart capability, with secret redaction preserved.
  • webui/gated_actions.py — registers the restart action in the gated action framework so it cannot be invoked without capability plus confirmation.
  • task_capability_map.py — capability mapping for the restart operation.
  • docs/sanctioned-restart-controls.md — operator documentation for the sanctioned path and the explicit prohibition on pkill recovery.
  • docs/webui-authz-audit.md — audit model updated for restart events.
  • tests/test_webui_sanctioned_restart.py — coverage for authorized preview, unauthorized deny, confirmation enforcement, contamination classification, and audit emission.

Acceptance criteria

  1. Sanctioned restart path documented and implemented behind gates — docs/sanctioned-restart-controls.md plus the gated system.restart_namespace action.
  2. Manual pkill remains forbidden and is classified as contamination — contamination classification retained and covered by tests.
  3. Post-restart mutations require clean health/session proof — post-restart health verification runs before the operation reports success.
  4. Tests cover authorized restart preview, unauthorized deny, and contamination classification.
  5. No raw kill path is exposed at the operator entry point.

Non-goals honored

  • No unrestricted pkill / kill -9 surface.
  • No silent auto-restart loop without audit.
  • Phase 1 health API (#634) is not reimplemented here.

Tests

  • tests/test_webui_sanctioned_restart.py — 41 passed, 12 subtests passed.
  • Affected suites (test_webui_console_authz_audit.py, test_webui_gated_actions.py, test_task_capability_role_invariants.py, test_resolve_task_capability.py, test_webui_architecture_docs.py) — 135 passed, 216 subtests passed.
  • Full suite result and master-baseline classification are posted as a follow-up comment on this PR.

Canonical PR state

STATE: needs-review
WHO_IS_NEXT: reviewer
NEXT_ACTION: Review the gated restart implementation against issue #642 acceptance criteria and the security requirements.
## Summary Implements Phase 2 sanctioned restart and graceful reload controls for the MCP Control Plane Web Console. Namespace restarts now run through an authorized, confirmed, audited, capability-gated path instead of manual host process killing (#630). Closes #642 ## Changes - `webui/sanctioned_restart.py` — restart/reload operation model for the `system.restart_namespace` gated action: dry-run intent preview, confirmation-string enforcement, audit emission, and post-restart health verification. Fails closed on unknown auth, missing capability, or ambiguous target namespace. - `webui/console_authz.py` — RBAC entries for the restart capability, with secret redaction preserved. - `webui/gated_actions.py` — registers the restart action in the gated action framework so it cannot be invoked without capability plus confirmation. - `task_capability_map.py` — capability mapping for the restart operation. - `docs/sanctioned-restart-controls.md` — operator documentation for the sanctioned path and the explicit prohibition on pkill recovery. - `docs/webui-authz-audit.md` — audit model updated for restart events. - `tests/test_webui_sanctioned_restart.py` — coverage for authorized preview, unauthorized deny, confirmation enforcement, contamination classification, and audit emission. ## Acceptance criteria 1. Sanctioned restart path documented and implemented behind gates — `docs/sanctioned-restart-controls.md` plus the gated `system.restart_namespace` action. 2. Manual pkill remains forbidden and is classified as contamination — contamination classification retained and covered by tests. 3. Post-restart mutations require clean health/session proof — post-restart health verification runs before the operation reports success. 4. Tests cover authorized restart preview, unauthorized deny, and contamination classification. 5. No raw kill path is exposed at the operator entry point. ## Non-goals honored - No unrestricted `pkill` / `kill -9` surface. - No silent auto-restart loop without audit. - Phase 1 health API (#634) is not reimplemented here. ## Tests - `tests/test_webui_sanctioned_restart.py` — 41 passed, 12 subtests passed. - Affected suites (`test_webui_console_authz_audit.py`, `test_webui_gated_actions.py`, `test_task_capability_role_invariants.py`, `test_resolve_task_capability.py`, `test_webui_architecture_docs.py`) — 135 passed, 216 subtests passed. - Full suite result and master-baseline classification are posted as a follow-up comment on this PR. ## Canonical PR state ```text STATE: needs-review WHO_IS_NEXT: reviewer NEXT_ACTION: Review the gated restart implementation against issue #642 acceptance criteria and the security requirements. ```
jcwalker3 added 1 commit 2026-07-23 22:21:30 -05:00
Adds a gated `system.restart_namespace` action so operators and workers can
restart or gracefully reload MCP namespaces through an authorized, audited
path instead of manual host process killing (#630).

- webui/sanctioned_restart.py: restart/reload operation model, dry-run
  intent preview, confirmation-string enforcement, audit emission, and
  post-restart health verification. Fails closed on unknown auth, missing
  capability, or ambiguous target namespace.
- webui/console_authz.py: RBAC entries for the restart capability with
  secret redaction preserved.
- webui/gated_actions.py: registers the restart action in the gated action
  framework so it cannot be invoked without capability + confirmation.
- task_capability_map.py: capability mapping for the restart operation.
- docs/sanctioned-restart-controls.md: operator documentation for the
  sanctioned path and the explicit prohibition on pkill recovery.
- docs/webui-authz-audit.md: audit model updated for restart events.
- tests/test_webui_sanctioned_restart.py: authorized preview, unauthorized
  deny, confirmation enforcement, contamination classification, and audit
  emission coverage.

No unrestricted kill path is exposed; manual pkill remains classified as
contamination and continues to block clean claims.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
jcwalker3 added 1 commit 2026-07-23 22:22:42 -05:00
jcwalker3 added 1 commit 2026-07-24 02:07:47 -05:00
jcwalker3 added 1 commit 2026-07-24 05:55:02 -05:00
jcwalker3 added 1 commit 2026-07-24 06:11:05 -05:00
jcwalker3 added 1 commit 2026-07-24 06:16:07 -05:00
Owner

repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #863
issue: #642
reviewer_identity: sysadmin
profile: prgs-reviewer
session_id: 35152-7ef9bafcf3dd
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-pr863-issue-642
phase: claimed
candidate_head: 2a5d6571ec
target_branch: master
target_branch_sha: c33c69b3f3
last_activity: 2026-07-24T11:26:27Z
expires_at: 2026-07-24T11:36:27Z
blocker: none

<!-- mcp-review-lease:v1 --> repo: Scaled-Tech-Consulting/Gitea-Tools pr: #863 issue: #642 reviewer_identity: sysadmin profile: prgs-reviewer session_id: 35152-7ef9bafcf3dd worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-pr863-issue-642 phase: claimed candidate_head: 2a5d6571ec905b34039f134ddffcb3b9b7cdf9c1 target_branch: master target_branch_sha: c33c69b3f3f383f56b530def1789662ad26ea648 last_activity: 2026-07-24T11:26:27Z expires_at: 2026-07-24T11:36:27Z blocker: none
sysadmin approved these changes 2026-07-24 06:26:54 -05:00
Dismissed
sysadmin left a comment
Owner

Canonical PR State

STATE: approved
WHO_IS_NEXT: merger
NEXT_ACTION: Merge PR #863 at head 2a5d6571ec onto master c33c69b3f3f383f56b530def1789662ad26ea648; then reconcile branch/worktree cleanup for feat/issue-642-sanctioned-restart-controls.
NEXT_PROMPT:

Merge PR #863 (Closes #642) as prgs-merger at head 2a5d6571ec905b34039f134ddffcb3b9b7cdf9c1 onto master c33c69b3f3f383f56b530def1789662ad26ea648; approval by sysadmin/prgs-reviewer is valid at this exact head; confirm head unchanged, merge, then reconcile branch/worktree cleanup and close #642; stop.

WHAT_HAPPENED: Independent review at exact PR head 2a5d6571ec in worktree branches/review-pr863-issue-642. Diff vs base c33c69b3 is 7 files / +1304 / -2 additive (sanctioned_restart.py, console_authz, gated_actions, task_capability_map, docs, 41 tests). Multi-gate restart model: capability + namespace-bound confirmation + out-of-band operator env auth + contamination block + host hook required. execute_restart never spawns a process and always reports process_kill_executed=false. Manual pkill classified as contamination. Post-restart clean claims require live client_namespace probe proof. No app.py route yet; registry entries disabled (ACTIVE_PHASE=1, actions phase 2). tests/test_webui_sanctioned_restart.py → 41 passed, 12 subtests; related authz/gated/role suites 97 passed.
WHY: All five #642 acceptance criteria satisfied; no-kill and no-fleet non-goals held; fail-closed on missing hook/auth/confirmation; scope limited to the sanctioned restart surface; focused and related suites green; commits_behind=0 and mergeable with no conflicts — eligible for merge.
ISSUE: 642
HEAD_SHA: 2a5d6571ec
REVIEW_STATUS: approved
MERGE_READY: yes
BLOCKERS: none
VALIDATION: tests/test_webui_sanctioned_restart.py → 41 passed, 12 subtests; related suites (console_authz_audit, gated_actions, task_capability_role_invariants) → 97 passed; git diff --stat c33c69b3...2a5d6571 = 7 files / +1304 / -2; assess_pr_sync_status: behind=0, mergeable=true, has_conflicts=false; Workflow-load helper result: workflow_hash: 263d0a6cb8a6 boundary_status: clean; Live head SHA before approval: 2a5d6571ec905b34039f134ddffcb3b9b7cdf9c1; Pushes occurred during validation: no
LAST_UPDATED_BY: prgs-reviewer (sysadmin)

NATIVE_REVIEW_PROOF: transport=native_mcp; entrypoint=mcp_server; namespace=gitea-reviewer; profile=prgs-reviewer; identity=sysadmin; worktree=branches/review-pr863-issue-642 at 2a5d6571ec905b34039f134ddffcb3b9b7cdf9c1; pid=35152

[THREAD STATE LEDGER]

what is true now

Server-side decision state: formal APPROVE review verdict recorded for PR #863 at head 2a5d6571ec
Local verdict/state: approve decision marked final and posted via gitea_submit_pr_review
Next actor: merger (prgs-merger)
Required action: merge PR #863 at the exact reviewed head
Blocker classification: no blocker
Do not do: do not reuse this verdict if the PR head moves; do not fall back to pkill recovery; do not treat host_action_required as process-kill authorization

what changed

Independent current-head review completed for #642 sanctioned restart controls; 41 focused tests green; no code defects that block merge.

what is blocked

Nothing. PR is eligible for merger action at the pinned head.

who/what acts next

prgs-merger merges at head 2a5d6571ec after confirming head unchanged.

## Canonical PR State STATE: approved WHO_IS_NEXT: merger NEXT_ACTION: Merge PR #863 at head 2a5d6571ec905b34039f134ddffcb3b9b7cdf9c1 onto master c33c69b3f3f383f56b530def1789662ad26ea648; then reconcile branch/worktree cleanup for feat/issue-642-sanctioned-restart-controls. NEXT_PROMPT: ```text Merge PR #863 (Closes #642) as prgs-merger at head 2a5d6571ec905b34039f134ddffcb3b9b7cdf9c1 onto master c33c69b3f3f383f56b530def1789662ad26ea648; approval by sysadmin/prgs-reviewer is valid at this exact head; confirm head unchanged, merge, then reconcile branch/worktree cleanup and close #642; stop. ``` WHAT_HAPPENED: Independent review at exact PR head 2a5d6571ec905b34039f134ddffcb3b9b7cdf9c1 in worktree branches/review-pr863-issue-642. Diff vs base c33c69b3 is 7 files / +1304 / -2 additive (sanctioned_restart.py, console_authz, gated_actions, task_capability_map, docs, 41 tests). Multi-gate restart model: capability + namespace-bound confirmation + out-of-band operator env auth + contamination block + host hook required. execute_restart never spawns a process and always reports process_kill_executed=false. Manual pkill classified as contamination. Post-restart clean claims require live client_namespace probe proof. No app.py route yet; registry entries disabled (ACTIVE_PHASE=1, actions phase 2). tests/test_webui_sanctioned_restart.py → 41 passed, 12 subtests; related authz/gated/role suites 97 passed. WHY: All five #642 acceptance criteria satisfied; no-kill and no-fleet non-goals held; fail-closed on missing hook/auth/confirmation; scope limited to the sanctioned restart surface; focused and related suites green; commits_behind=0 and mergeable with no conflicts — eligible for merge. ISSUE: 642 HEAD_SHA: 2a5d6571ec905b34039f134ddffcb3b9b7cdf9c1 REVIEW_STATUS: approved MERGE_READY: yes BLOCKERS: none VALIDATION: tests/test_webui_sanctioned_restart.py → 41 passed, 12 subtests; related suites (console_authz_audit, gated_actions, task_capability_role_invariants) → 97 passed; git diff --stat c33c69b3...2a5d6571 = 7 files / +1304 / -2; assess_pr_sync_status: behind=0, mergeable=true, has_conflicts=false; Workflow-load helper result: workflow_hash: 263d0a6cb8a6 boundary_status: clean; Live head SHA before approval: 2a5d6571ec905b34039f134ddffcb3b9b7cdf9c1; Pushes occurred during validation: no LAST_UPDATED_BY: prgs-reviewer (sysadmin) NATIVE_REVIEW_PROOF: transport=native_mcp; entrypoint=mcp_server; namespace=gitea-reviewer; profile=prgs-reviewer; identity=sysadmin; worktree=branches/review-pr863-issue-642 at 2a5d6571ec905b34039f134ddffcb3b9b7cdf9c1; pid=35152 [THREAD STATE LEDGER] ### what is true now Server-side decision state: formal APPROVE review verdict recorded for PR #863 at head 2a5d6571ec905b34039f134ddffcb3b9b7cdf9c1 Local verdict/state: approve decision marked final and posted via gitea_submit_pr_review Next actor: merger (prgs-merger) Required action: merge PR #863 at the exact reviewed head Blocker classification: no blocker Do not do: do not reuse this verdict if the PR head moves; do not fall back to pkill recovery; do not treat host_action_required as process-kill authorization ### what changed Independent current-head review completed for #642 sanctioned restart controls; 41 focused tests green; no code defects that block merge. ### what is blocked Nothing. PR is eligible for merger action at the pinned head. ### who/what acts next prgs-merger merges at head 2a5d6571ec905b34039f134ddffcb3b9b7cdf9c1 after confirming head unchanged.
jcwalker3 added 1 commit 2026-07-24 06:55:19 -05:00
jcwalker3 added 1 commit 2026-07-24 07:03:52 -05:00
Owner

repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #863
issue: none
reviewer_identity: sysadmin
profile: prgs-reviewer
session_id: 38653-e955a0f42630
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-pr863-issue-642
phase: claimed
candidate_head: none
target_branch: master
target_branch_sha: none
last_activity: 2026-07-24T12:20:05Z
expires_at: 2026-07-24T12:30:05Z
blocker: none

<!-- mcp-review-lease:v1 --> repo: Scaled-Tech-Consulting/Gitea-Tools pr: #863 issue: none reviewer_identity: sysadmin profile: prgs-reviewer session_id: 38653-e955a0f42630 worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-pr863-issue-642 phase: claimed candidate_head: none target_branch: master target_branch_sha: none last_activity: 2026-07-24T12:20:05Z expires_at: 2026-07-24T12:30:05Z blocker: none
sysadmin approved these changes 2026-07-24 07:20:16 -05:00
Owner

adopted_at: 2026-07-24T12:21:02Z
adopted_by_identity: sysadmin
adopted_by_profile: prgs-merger
adopted_from_session_id: 38653-e955a0f42630
adopted_from_profile: prgs-reviewer
adopted_from_reviewer_identity: sysadmin
adopted_from_comment_id: 15869
adoption_reason: merger-handoff-approved-head

repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #863
issue: none
reviewer_identity: sysadmin
profile: prgs-merger
session_id: 38641-6e9eee683da8
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-pr863-issue-642
phase: adopted
candidate_head: 205207abb0
target_branch: master
target_branch_sha: none
last_activity: 2026-07-24T12:21:02Z
expires_at: 2026-07-24T12:31:02Z
blocker: none

<!-- mcp-review-lease-adoption:v1 --> adopted_at: 2026-07-24T12:21:02Z adopted_by_identity: sysadmin adopted_by_profile: prgs-merger adopted_from_session_id: 38653-e955a0f42630 adopted_from_profile: prgs-reviewer adopted_from_reviewer_identity: sysadmin adopted_from_comment_id: 15869 adoption_reason: merger-handoff-approved-head <!-- mcp-review-lease:v1 --> repo: Scaled-Tech-Consulting/Gitea-Tools pr: #863 issue: none reviewer_identity: sysadmin profile: prgs-merger session_id: 38641-6e9eee683da8 worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-pr863-issue-642 phase: adopted candidate_head: 205207abb09345efc2fb44d1f050bf799bb72592 target_branch: master target_branch_sha: none last_activity: 2026-07-24T12:21:02Z expires_at: 2026-07-24T12:31:02Z blocker: none
sysadmin merged commit 103d0df289 into master 2026-07-24 07:21:18 -05:00
Owner

Stale #332 review-decision lock cleanup (#594)

Status: APPLIED

Manual deletion of session-state files is not the workflow.
This path only clears a lock when the referenced PR is merged/closed.

## Stale #332 review-decision lock cleanup (#594) Status: **APPLIED** - actor: `sysadmin` - profile: `prgs-merger` - timestamp: `2026-07-24T12:21:19.785613+00:00` - last terminal: `approve` on PR #863 - PR state: `closed` (merged=True) - merge_commit_sha: `103d0df28921d95673d4f375b00f01d306c70c70` - prior live_mutations_count: `5` - prior profile_identity: `prgs-reviewer` Manual deletion of session-state files is **not** the workflow. This path only clears a lock when the referenced PR is merged/closed.
Sign in to join this conversation.
No Reviewers
No labels
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Scaled-Tech-Consulting/Gitea-Tools#863