feat(webui): read-only workflow policy and guardrail visibility (Closes #646) #856
Closed
jcwalker3
wants to merge 10 commits from
feat/issue-646-policy-guardrail-visibility into master
pull from: feat/issue-646-policy-guardrail-visibility
merge into: :master
:master
:fix/issue-682-starlette-httpx2
:feat/issue-663-restart-classes
:issue-640
:feat/issue-661-drain-proof-hard-gate
:fix/issue-854-semantic-container-exclusion
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#856
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 #646
Phase 3 child of the Web Console epic #631. Policy and guardrail configuration currently lives in code, profiles, docs, and skills, so an operator cannot see what is actually in force without reading the repository tree. This adds a read-only projection of the active workflow policy and guardrail configuration to the console.
What this adds
webui/policy_inventory.py(new, 387) — a redacted, machine-readable guardrail inventory. One row per major guardrail (role separation / RBAC, lease rules, worktree binding, merge confirmation, redaction, contamination, allocator policy, audit logging, mutation gating), each carrying source pointers (file / module / doc) plus a compact projection of the active configuration read through the existing safe policy accessors. Each entry is fail-soft: an entry that cannot be built degrades to a status with a reason instead of raising. The whole payload passes throughconsole_redactionbefore it leaves the module, and a documented-default diff is emitted where feasible.webui/policy_views.py(new, 104) — HTML cards rendering each guardrail with its source pointers, active configuration, and the documented-default diff. Read-only page copy; no forms, no toggles.webui/app.py(+16) — additive registration ofGET /policyandGET /api/v1/policy.webui/layout.py(+1) — Policy nav item.tests/test_webui_policy_visibility.py(new, 222) — guardrail presence and source pointers, redaction including planted-secret masking checked withscan_for_secrets, read-only page plus no-mutation route assertions, and fail-soft rendering.docs/webui-local-dev.md(+15) — route table entry and a section stating the read-only nature of the view.Acceptance criteria
build_policy_inventory/GET /policyconsole_redactionat the emit boundarytests/test_webui_policy_visibility.pyplanted-secret casesdocs/webui-local-dev.mdNon-goals honored: no policy editing, no gate-weakening UI toggle, no token values displayed.
Files changed
6 files, 745 insertions, 0 deletions —
webui/policy_inventory.py,webui/policy_views.py,webui/app.py,webui/layout.py,tests/test_webui_policy_visibility.py,docs/webui-local-dev.md.Provenance
The implementation commit
ab33337was authored and published in an earlier author cycle whose owning MCP session then exited before the pull request was opened. This cycle recovered the durable claim through the sanctioned dead-session recovery path ingitea_lock_issue(identityjcwalker3/prgs-author, recovery modepublished_owning_pr, recorded pid 57529 dead, local head, remote head, and recorded head all996e7094feb2e1e9d8fc846354e4e5915fd93d83, head relationequal), then re-ran the full validation matrix in this session before opening this pull request. No file copy and no re-implementation.Validation (this session)
Run from
/Users/jasonwalker/Development/Gitea-Tools/branches/feat-issue-646-policy-guardrail-visibilitywith the worktree venv interpreter.venv/bin/python -m pytest tests/test_webui_policy_visibility.py -q— 15 passed, 9 subtests passed.venv/bin/python -m pytest -k webui -q -s— 313 passed, 279 subtests passed.venv/bin/python -m pytest -q -s— 4609 passed, 12 failed, 6 skipped, 693 subtests passed in 574.96s.Baseline comparison: a clean detached worktree at
branches/baseline-master-issue-646, pinned to master188e83c4d69bfb959c91b1f8e766ab8a0656d92d, running the identical command with the identical interpreter reports 4615 passed, 12 failed, 6 skipped, 735 subtests passed. The twelve failing node identifiers were compared withdiffand match exactly: six intests/test_commit_payloads.py, two intests/test_issue_702_review_findings_f1_f6.py, two intests/test_mcp_server.py(TestRuntimeProfile::test_whoami_v2_metadataandTestPreflightVerification::test_declared_clean_task_worktree_ignores_control_checkout_violation), one intests/test_post_merge_moot_lease.py, and one intests/test_reconciler_supersession_close.py. None of them touchwebui/. This branch therefore introduces no new failure.Both worktrees reported a zero-entry
git status --porcelainbefore and after validation, and so did the control checkout.git diff --checkis clean.Risk
Low. Every route added is a GET, the module performs no writes, and redaction runs at the emit boundary rather than per call site. The residual risk is a guardrail projection going out of date with the module it points at; the source pointers are asserted by the test suite so a rename fails the tests rather than silently mispointing.
Known limitations
The documented-default diff is emitted only where a documented default exists in machine-readable form; guardrails documented in prose alone show source pointers plus active configuration without a diff. Policy editing and rollback stay out of scope for a dedicated issue.
Provenance details
feat/issue-646-policy-guardrail-visibility/Users/jasonwalker/Development/Gitea-Tools/branches/feat-issue-646-policy-guardrail-visibilityab33337a94dcba319195bb7f72082cc551a7f026996e7094feb2e1e9d8fc846354e4e5915fd93d83188e83c4d69bfb959c91b1f8e766ab8a0656d92dCanonical PR State
Co-Authored-By: Claude Opus 4.8 (1M context) [email protected]
pr: #856
branch: feat/issue-646-policy-guardrail-visibility
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/feat-issue-646-policy-guardrail-visibility
profile: prgs-author
session_id: unknown
phase: claimed
head_before:
996e7094feexpires_at: 2026-07-24T11:07:39Z
reviewer_active: no
repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #856
issue: #646
reviewer_identity: sysadmin
profile: prgs-reviewer
session_id: 17176-189c5701097a
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-pr856-policy-visibility
phase: claimed
candidate_head:
ef1ad41678target_branch: master
target_branch_sha: none
last_activity: 2026-07-24T12:17:23Z
expires_at: 2026-07-24T12:27:23Z
blocker: none
Review: PR #856 — policy/guardrail visibility (#646)
Reviewed at head
ef1ad41678196e635755b902d8c5a57d70056e6d(PR body still claims996e7094…; several master-sync merges landed after that).Verdict: REQUEST_CHANGES
Core inventory/module design is solid and focused tests pass (
15 passed, 9 subtests). Scope is right-sized for #646 (GET-only, no edit UI). Incomplete graduation / redaction boundary issues block approval.Blocking
1.
/policywas not graduated out of the Phase 1 stub registrywebui/nav.pystill hasNavItem("/policy", "Policy", "stub")andSTUB_PAGES["/policy"]. Real route is registered first so first-match serves the real page today, but home still labels Policy as (stub) and shell tests treat it as unimplemented. Graduate to live nav, remove fromSTUB_PAGES, add a test. PR body claimedlayout.pychange; nav is the source of truth after #638.2. Docs still contradict the new surface (AC4 incomplete)
docs/webui-local-dev.mdadds live/policyrows but still lists/policyas a Phase 1 stub and calls Policy a placeholder under “Not-yet-implemented surfaces”. New #646 section is good; shell/stub docs need a pass.3. HTML emit path skips
console_redaction(AC2 gap)API path redacts via
snapshot_to_dict✅. HTML path dumps rawentry.activewith onlyhtml.escape❌. Plantedkeychain:…secret appears verbatim in HTML; same snapshot is redacted on JSON. Fix: render from redacted dict or redact before dump; add planted-secret HTML test.Non-blocking
Acceptance criteria
Required before re-review
STUB_PAGES+ test/policyrow; remove stub/placeholder copyCanonical PR State
Author remediation complete — ready for re-review
Addressed review #555
REQUEST_CHANGESat head87f7b5385de150bf456dcc7cc5963a3b0dc05236.Blockers fixed
/policystill stub in nav/STUB_PAGESSTUB_PAGES; home has nonav-stubon Policy/policyas Phase 1 stub/placeholder/policyroute table row; shell section marks Policy live via #646; stub list no longer includes/policyconsole_redactionrender_policy_pagerenders fromsnapshot_to_dict; plantedkeychain:…→[REDACTED]_KEYCHAIN_REFCommits
261f0b8— main remediation (nav, docs, HTML redaction, planted-secret HTML test)87f7b53— docs clarity + stronger live-nav assertionsValidation
Canonical Issue State
STATE: awaiting-re-review
WHO_IS_NEXT: reviewer
NEXT_ACTION: Re-review PR #856 at head
87f7b5385dagainst review #555 blockers; submit verdict; stopNEXT_PROMPT:
WHAT_HAPPENED: Author addressed review #555 REQUEST_CHANGES and pushed remediation commits
261f0b8+87f7b53WHY: Three blocking findings (nav stub, docs stub copy, HTML redaction gap) required before re-review
RELATED_PRS: #856
BLOCKERS: none remaining from review #555 (pending reviewer confirmation)
VALIDATION: focused policy+shell tests — 30 passed, 59 subtests
LAST_UPDATED_BY: prgs-author (jcwalker3)
repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #856
issue: none
reviewer_identity: sysadmin
profile: prgs-reviewer
session_id: 92670-ff7895edb2bc
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-pr856-20260724
phase: claimed
candidate_head:
903536d3c0target_branch: master
target_branch_sha:
36fe4785eclast_activity: 2026-07-24T14:42:16Z
expires_at: 2026-07-24T14:52:16Z
blocker: none
Review: PR #856 — policy/guardrail visibility (#646) — re-review
Reviewed at head
903536d3c00077d25395457c335f4fa280cf5bfb. This resolves my prior REQUEST_CHANGES (review #555 @ef1ad41). All three blocking findings are fixed.NATIVE_REVIEW_PROOF: workflow review-merge-pr hash 263d0a6cb8a6 / schema b6c65affc336; re-reviewed via native gitea-reviewer (prgs-reviewer, sysadmin) at head
903536d3.Verdict: APPROVE
Blocking findings — all resolved
1. Policy graduated out of the stub registry ✅
webui/nav.py:NavItem("/policy", "Policy")— status now defaults to"live", no longer"stub"./policyis removed fromSTUB_PAGES(now only/sessions,/inventory,/timeline,/insights). Module docstring lists Policy as "live via #646". New testtest_nav_links_policyasserts/policynot inSTUB_PAGES, exactly one nav item withstatus == "live", home rendershref="/policy">Policy</a>and neverclass="nav-stub".2. Docs no longer contradict the surface (AC4) ✅
docs/webui-local-dev.md: routes table lists/policyas the live #646 surface; the Phase-1 stub list is/sessions,/inventory,/timeline,/insightsonly; the shell section states explicitly "/policyis a live read-only surface (#646), not a stub." Dedicated "Policy & guardrail visibility (#646)" section added.3. HTML emit path redacts (AC2/AC3) ✅
webui/policy_views.pyrender_policy_pagenow routes the payload throughsnapshot_to_dict(snapshot)(dataclass) orconsole_redaction.redact_payload(snapshot)(dict) before building cards, so_active_blockconsumes already-redacted entries. Confirmedsnapshot_to_dictends withreturn console_redaction.redact_payload(payload). New testtest_planted_secret_is_redacted_in_html_emitplantskeychain:…in an active projection, renders the HTML, and asserts the secret is absent andscan_for_secrets(html) == [].Acceptance criteria
Non-blocking
_build_entrycatches, records per-entry error, keeps the page up).nav.pytouch is legitimate — it is the graduation my prior blocker #1 required.Merge readiness
Not merge-ready yet: PR is 35 commits behind live base
36fe4785and branch protection requires current base. Author must base-sync (update_branch_by_merge); this approval is head-scoped to903536d3and will need re-validation after the sync.Canonical PR State
repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #856
issue: none
reviewer_identity: sysadmin
profile: prgs-reviewer
session_id: 92670-ff7895edb2bc
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-pr856-20260724
phase: released
candidate_head:
903536d3c0target_branch: master
target_branch_sha:
36fe4785eclast_activity: 2026-07-24T14:43:30Z
expires_at: 2026-07-24T14:53:30Z
blocker: manual-release
repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #856
issue: #646
reviewer_identity: sysadmin
profile: prgs-reviewer
session_id: 63510-a01417d219c3
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-pr856-202607240945
phase: claimed
candidate_head:
f702fa9272target_branch: master
target_branch_sha:
36fe4785eclast_activity: 2026-07-24T18:51:49Z
expires_at: 2026-07-24T19:01:49Z
blocker: none
APPROVE — re-review after author base-sync. Issue #646 acceptance criteria 1-4 verified at head f702fa927212c6ea844f00a170847a52ac7c5a92; every blocker raised in my earlier reviews remains fixed and the base-sync introduced no PR-side drift.
NATIVE_REVIEW_PROOF: reviewed in native worktree /Users/jasonwalker/Development/Gitea-Tools/branches/review-pr856-202607240945 pinned at
f702fa9272(merge parents903536d3c0and master36fe4785ec); diff, file reads, and test execution performed against that checkout.Verification performed at this head
f702fa9is a two-parent merge of the previously reviewed head903536d3and live master36fe4785.git diff 903536d3 f702fa9restricted to PR-owned files shows only master's incoming lines (webui/app.py+118 analytics,webui/nav.py+1 analytics nav). No conflict-resolution edit landed on the PR side.git diff 36fe4785 f702fa9is 6 files / 812 insertions:webui/policy_inventory.py(387),webui/policy_views.py(145),tests/test_webui_policy_visibility.py(243),webui/app.py(+15),webui/nav.py(+8/-4),docs/webui-local-dev.md(+26/-12). Identical to the reviewed scope; nothing outside #646.build_policy_inventorybehindGET /policyandGET /api/v1/policyrenders one entry per major guardrail with file/module/doc pointers, asserted by the test suite so a rename fails tests rather than silently mispointing.console_redactionat the emit boundary before leaving the module.tests/test_webui_policy_visibility.pyplants secrets and asserts absence viascan_for_secrets, including in the rendered HTML.docs/webui-local-dev.mdcarries the route-table entry and the read-only statement.stubto live plus removal of the now-dead/policySTUB_PAGESentry is correct and self-consistent.Canonical PR State
STATE: approved
WHO_IS_NEXT: merger
NEXT_ACTION: Merge pull request 856 at head
f702fa9272using the merger role, then close issue 646 and clean up the merged branchNEXT_PROMPT:
WHAT_HAPPENED: Re-reviewed pull request 856 at the post-base-sync head
f702fa9272in a pinned reviewer worktree, confirmed the merge carried no PR-side change, re-verified acceptance criteria 1-4 and the read-only non-goals, re-ran the focused and console test scopes, and submitted an approval at that exact head.WHY: The prior approval was recorded at head
903536d3c0and was invalidated when the author merged master into the branch; branch protection and merge eligibility require an approval pinned to the current head, so a fresh independent verdict was required before this pull request could merge.ISSUE: 646
HEAD_SHA:
f702fa9272REVIEW_STATUS: approved
MERGE_READY: yes
BLOCKERS: none
VALIDATION: venv/bin/python -m pytest tests/test_webui_policy_visibility.py -q — 16 passed, 9 subtests passed. venv/bin/python -m pytest -k webui -q — 468 passed, 380 subtests passed, 4637 deselected. Both run at
f702fa9272in the reviewer worktree; no regression from the analytics code master merged into webui/app.py.LAST_UPDATED_BY: prgs-reviewer (sysadmin), session 63510-a01417d219c3
repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #856
issue: #646
reviewer_identity: sysadmin
profile: prgs-reviewer
session_id: 62695-c30fcfa13c3a
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-pr856-be0745d-20260724163322
phase: claimed
candidate_head:
be0745d93ctarget_branch: master
target_branch_sha:
9b5289940clast_activity: 2026-07-24T20:34:29Z
expires_at: 2026-07-24T20:44:29Z
blocker: none
Review: PR #856 — policy/guardrail visibility (#646) — re-review after base-sync
Reviewed at head
be0745d93c4cdc4cc8386553a6ea7d82a242f3c0via native gitea-reviewer (prgs-reviewer/sysadmin). Prior formal reviews atef1ad41/903536d3/f702fa9are stale for this head and were not reused.NATIVE_REVIEW_PROOF: workflow review-merge-pr hash
263d0a6cb8a6/ schemab6c65affc336; worktree/Users/jasonwalker/Development/Gitea-Tools/branches/review-pr856-be0745d-20260724163322pinned atbe0745d93c4cdc4cc8386553a6ea7d82a242f3c0; parents07f606639c6f90d38dd7939723f7d32fac64e0bb+ master9b5289940c898d75e90b8d05612d942f36008fb8.Verdict: APPROVE
Preflight (all green)
sysadmin/prgs-reviewer/reviewer9b5289940c89; mutation_safejcwalker3; self_author=falsebe0745d93c4cdc4cc8386553a6ea7d82a242f3c062695-c30fcfa13c3a@ headbe0745dEffective diff vs master
9b5289946 files / +812 / −12 (clean merge; no conflict markers; no PR-owned drift on merge of master):
webui/policy_inventory.py(new)webui/policy_views.py(new)webui/app.py(GET/policy, GET/api/v1/policy)webui/nav.py(Policy live; removed fromSTUB_PAGES)tests/test_webui_policy_visibility.py(new)docs/webui-local-dev.mdAcceptance criteria
snapshot_to_dict→console_redaction.redact_payload; HTMLrender_policy_pageroutes through same boundaryscan_for_secrets([])/policynot listed as Phase-1 stubIndependent validation (this session)
pytest tests/test_webui_policy_visibility.py -q→ 16 passed, 9 subtestspytest -k webui -q→ 488 passed, 380 subtests/policystatus=live, absent fromSTUB_PAGES/policyand/api/v1/policyare GET/HEAD onlyNon-goals honored
No policy edit UI, no gate-weakening toggle, no token values, fail-soft per-entry degradation preserved.
Merge readiness
Yes for merger at this exact head (branch is current on master; mergeable; approval head-scoped to
be0745d). Reviewer will not merge.Canonical PR State
[THREAD STATE LEDGER] Pull request 856 (issue #646) — closing at operator direction, branch retained
What is true now:
approval_visible=trueonly for the earlier headf702fa92, andapproval_at_current_head=falseat the current headbe0745d93c4cdc4cc8386553a6ea7d82a242f3c0, because the author base-sync in a prior cycle advanced the head past that approval.has_blocking_change_requests=false.mergeable=trueand no remainingwebui/app.pyimport conflict against master. It is being moved to closed state by explicit operator instruction, not by a defect, not by a review verdict, and not by supersession from work that landed on master.tests/test_webui_policy_visibility.py, 313 passing in the webui scope, and a full-suite run whose 12 failures match the pinned master baseline node-for-node. Environment at close time is in parity and mutation safe at9b5289940c898d75e90b8d05612d942f36008fb8.What changed:
close_prcapability path on theprgs-reconcilerprofile.status:pr-openlabel is stripped from issue #646 because it no longer describes reality once no open pull request exists for that issue.feat/issue-646-policy-guardrail-visibilityis retained. It is not deleted by this close. All six files (webui/policy_inventory.py,webui/policy_views.py,webui/app.py,webui/layout.py,tests/test_webui_policy_visibility.py,docs/webui-local-dev.md, 745 insertions) remain on that branch, so the work can be revived without re-implementation.What is blocked:
Who/what acts next:
feat/issue-646-policy-guardrail-visibilityafter re-verifying that its head still merges cleanly into the then-current master.feat/issue-646-policy-guardrail-visibility. Do not add a status label to issue #646 that would put it back into the allocator pick set, or an autonomous author loop will duplicate work that already exists on that branch.Canonical Issue State
STATE: closed-by-operator
WHO_IS_NEXT: user
NEXT_ACTION: None automated. This pull request is terminal by operator decision. Revival is an operator choice: reopen pull request 856, or open a replacement pull request from the retained branch feat/issue-646-policy-guardrail-visibility.
NEXT_PROMPT:
WHAT_HAPPENED: The operator was presented with the two open pull requests in this repository, 881 for issue #660 and 856 for issue #646, and directed that 856 be closed. This audit comment was posted, the pull request was then moved to closed state through the
close_prcapability on theprgs-reconcilerprofile, and the now-falsestatus:pr-openlabel was stripped from issue #646.WHY: Operator decision to reduce the open pull request count to one. No technical fault in this pull request caused the close. Both pull requests carried
mergeable=trueand were conflict-free at the time of the decision.RELATED_PRS: 856 (this pull request, moved to closed state by operator decision), 881 (issue #660, remains in open state awaiting a reviewer verdict)
BLOCKERS: no blocker
VALIDATION: No code change and no test execution accompany this close. Prior validation of record for the branch: 15 focused cases plus 9 subtests in
tests/test_webui_policy_visibility.py, 313 in the webui scope, and a full suite whose 12 failures match the pinned master baseline exactly. Preflight for this action:gitea_whoamiconfirmedprgs-reconciler/sysadminwithgitea.pr.closeallowed,gitea_assess_master_parityreportedin_parity=trueandmutation_safe=trueat9b5289940c898d75e90b8d05612d942f36008fb8, andgitea_resolve_task_capabilitywas called immediately before each mutation.LAST_UPDATED_BY: prgs-reconciler
Pull request closed