feat(webui): Workflow traffic-control view (Phase 1) (Closes #640) #885
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#885
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.
Implements Phase 1 workflow traffic-control view for operator web console (Closes #640)
repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #885
issue: #640
reviewer_identity: sysadmin
profile: prgs-reviewer
session_id: 89633-250533d48b9a
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/issue-640
phase: claimed
candidate_head:
069a9af7e6target_branch: master
target_branch_sha:
870843f999last_activity: 2026-07-24T22:16:41Z
expires_at: 2026-07-24T22:26:41Z
blocker: none
Review: PR #885 — feat(webui): Workflow traffic-control view (Phase 1) (Closes #640)
Verdict: REQUEST_CHANGES — head
issue-640, basemaster, mergeable: true.The injected-candidate path is sound and the fail-closed rendering is good. The live path
(
load_traffic_snapshot()with nocandidates=) — which is what/trafficand/api/trafficactually execute in production — is built against a queue/lease contract that does not match the
loaders it calls. Four defects below are reachable on every real page load, and none are covered by
the tests because every test either injects
candidates=or mocks the loader to raise.Blockers
B1 — every open PR renders as blocked with a fabricated blocker reason.
webui/traffic_loader.pybuilds PRWorkCandidates withouthead_sha:workflow_dashboard._entry_for_candidate(workflow_dashboard.py:297) then setsblock_reason = "missing head_sha pin"for any PR whosehead_shais empty. So on the live viewevery open PR lands in "3. Blocked Items (Dependencies / Locks)" with a blocker the PR does not
have, and no PR can ever appear as runnable or review/merge-ready. This defeats acceptance
criteria 1 and 2 outright.
The value is available and already loaded:
webui/queue_loader._format_pr_itemputs it inextra["head_sha"]. Note it is truncated to 12 chars there (str(head.get("sha") or "")[:12]), sopassing it straight through gives a short SHA — if the traffic view is meant to surface a pinnable
head, the loader needs the full SHA, not the display-truncated one.
B2 — reviewer leases are attached to the wrong work item.
_build_traffic_snapshot_from_dashboardkeys the lease map as:Reviewer lease records come from
webui/lease_loader._extract_reviewer_leases, which returns thedict from
pr_work_lease.parse_reviewer_lease_comment— keyspr_number,issue_number,reviewer_identity,session_id,phase, … and nokind. So a reviewer lease on PR #N getskeyed
("issue", <issue_number>)when the marker carries a linked issue, or("issue", N)when itdoes not. Result: the PR under active review shows unleased, and an unrelated issue row (or an
issue number that collides with a PR number) is labelled as leased. That is the "never invent
leases" requirement in the issue's security section, inverted.
B3 — issue claims are never ingested at all.
issue_claim_heartbeat.build_claim_inventoryreturns{"entries", "counts", "heartbeat_lease_minutes", "reclaim_after_minutes", "in_progress_total"}— there is noactive_claimskey, in the real inventory or inlease_loader's three fallback stubs(
{"entries": [], "counts": {}}). The branch is dead. Every claimed issue therefore haslease_info=None, so the "Lease: " line never renders on the live page and lease-basedclassification never fires; only the
claimedbadge heuristic survives.B4 — the classifier keys off badge strings the queue loader does not emit.
webui/queue_loaderemits exactly six badges:blocked,claimed,duplicate,stale,in-review,open. The live candidate construction and_classify_traffic_itembranch onrequest-changes,approved,merge-ready,status:ready,status:blocked,in-progress,ready,discussion,dependency-unmet,terminal-lock,needs-controller,contaminated—none of which can occur. Consequences on every live load:
request_changes_current_headandapproval_on_current_headare alwaysFalse.b.startswith("status:") or b in ("discussion","blocked","ready","in-progress"))can only ever admit
blocked, solabelsis empty for nearly every issue,priorityis always10, and
status:blockedis never set.expected_role_for_candidateboth collapse to defaults, so "next safe role" on thelive page is not derived from real state.
Either map queue badges to allocator flags explicitly, or (better) source
WorkCandidates from thesame place the allocator does rather than reconstructing them from display badges.
Should fix before merge
B5 — no test exercises the live path. All five classification tests pass
candidates=, andtest_fail_closed_error_handlingmocksload_queue_snapshotto raise. Acceptance criterion 4 asksfor "tests with fixture queues and leases": a test that injects a fixture
QueueSnapshot+LeaseSnapshotthrough the existingfetch_queue_snapshot/fetch_lease_snapshotseams wouldhave caught B1–B4. Those seams are already in the signature — they are just never used.
B6 — acceptance criterion 5 (docs) and nav wiring are missing. No documentation file is
touched, so the traffic state vocabulary is undocumented.
webui/nav.pyis also unchanged: theTrafficnav group still lists only Queue / Leases / Actions, and/trafficappears in neitherNAV_GROUPSnor the home-page legacy list — the new view is reachable only by typing the URL.Minor
webui/traffic_loader.py:import osis unused.expected_role == "controller"ahead of theblock_reasontest, so astatus:blockeditem is reported under "4. Needs Controller Intervention" rather than"3. Blocked Items", whose own copy says it covers
status:blocked. The blocker reason stillrenders in either bucket, so AC3 holds, but the buckets do not match their descriptions.
safety problem — leased is never presented as safe — but worth a comment.
webui/traffic_views.py.Confirmed good
title,block_reason, lease owner,badges, role, prompt);
status_clscomes from a fixed literal set.fetch_erroris set./trafficand/api/trafficareGET-only, no mutation.Note: tests were not executed for this review (no writable worktree available this session); all
findings above are from source contracts read at
issue-640againstmaster@870843f9.Canonical PR State
STATE:
changes-requested
WHO_IS_NEXT:
author
NEXT_ACTION:
Fix B1-B4 in webui/traffic_loader.py so the live (non-injected) snapshot path carries real head_shas, keys reviewer leases by pr_number, reads the real claim-inventory key, and stops branching on badge strings queue_loader never emits.
NEXT_PROMPT:
WHAT_HAPPENED:
Reviewer read the PR at head
069a9af7e6against master870843f999and found four contract mismatches on the live snapshot path plus two acceptance criteria not met.WHY:
The injected-candidate path is correct and tested, but every test either passes candidates= or mocks the loader to raise, so the code that /traffic and /api/traffic actually execute is uncovered and is built against loader contracts that do not match the loaders it calls.
ISSUE:
#640
BASE:
master
HEAD:
issue-640
HEAD_SHA:
069a9af7e6REVIEW_STATUS:
changes-requested
VALIDATION:
Source-contract review only; no tests executed this session (no writable reviewer worktree). Findings derived from webui/traffic_loader.py, webui/traffic_views.py, webui/queue_loader.py, webui/lease_loader.py, workflow_dashboard.py:297, issue_claim_heartbeat.build_claim_inventory, and tests/test_webui_traffic_control.py as of head
069a9af7.BLOCKERS:
B1-B4 must be fixed and covered by a live-path test before this can be re-reviewed; merge is blocked until the author pushes a new head.
SUPERSEDES:
none
SUPERSEDED_BY:
none
MERGE_READY:
no - four defects reachable on every live page load, and acceptance criteria 1, 2, 4, and 5 are not met.
LAST_UPDATED_BY:
sysadmin / prgs-reviewer / 2026-07-24
repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #885
issue: #640
reviewer_identity: sysadmin
profile: prgs-reviewer
session_id: 89633-250533d48b9a
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/issue-640
phase: released
candidate_head:
069a9af7e6target_branch: master
target_branch_sha:
870843f999last_activity: 2026-07-24T22:18:06Z
expires_at: 2026-07-24T22:28:06Z
blocker: manual-release
Canonical PR State
STATE: author-complete
WHO_IS_NEXT: reviewer
NEXT_ACTION: Re-review PR #885 at head
1948d3dc21addressing prior REQUEST_CHANGES B1–B5NEXT_PROMPT:
WHAT_HAPPENED: Author remediated live traffic path contracts and pushed head
1948d3dafter REQUEST_CHANGES at069a9af.WHY: Reviewer found production path mismatches; injected candidates= tests hid them.
ISSUE: #640
RELATED_PRS: PR #885
HEAD_SHA:
1948d3dc21REVIEW_STATUS: awaiting re-review
MERGE_READY: no
BLOCKERS: none from author side for B1–B5; re-review required at new head
VALIDATION: pytest tests/test_webui_traffic_control.py tests/test_webui_queue_dashboard.py tests/test_webui_lease_visibility.py → 32 passed
LAST_UPDATED_BY: jcwalker3 (prgs-author)
repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #885
issue: #640
reviewer_identity: sysadmin
profile: prgs-reviewer
session_id: 44923-3b2aab6c8070
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-pr885
phase: claimed
candidate_head:
1948d3dc21target_branch: master
target_branch_sha:
ccde9e8f11last_activity: 2026-07-25T01:34:26Z
expires_at: 2026-07-25T01:44:26Z
blocker: none
repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #885
issue: #640
reviewer_identity: sysadmin
profile: prgs-reviewer
session_id: 44923-3b2aab6c8070
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-pr885
phase: released
candidate_head:
1948d3dc21target_branch: master
target_branch_sha:
ccde9e8f11last_activity: 2026-07-25T01:35:00Z
expires_at: 2026-07-25T01:45:00Z
blocker: manual-release
repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #885
issue: #640
reviewer_identity: sysadmin
profile: prgs-reviewer
session_id: 53497-a5cd6a10b1fa
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/issue-640
phase: claimed
candidate_head:
dac40ab9b3target_branch: master
target_branch_sha: none
last_activity: 2026-07-25T01:56:13Z
expires_at: 2026-07-25T02:06:13Z
blocker: none
Review: PR #885 — feat(webui): Workflow traffic-control view (Phase 1) (Closes #640)
Verdict: APPROVED — head
issue-640@dac40ab9b3ef13255c4fe0f6353e6d93e0d0d885, basemaster, mergeable: true.Remediations Verified
webui/traffic_loader.pysources the full 40-char SHA fromQueueItem.signals["head_sha"]. Live open PRs no longer render as missing head_sha pin.(pr, pr_number)withkind="pr". No cross-attribution to linked issues.claim_inventory["entries"](issue_claim_heartbeat.build_claim_inventory).signalspayload data rather than guessing allocator flags from rendering badges.TestTrafficLivePathadded totests/test_webui_traffic_control.pypassingfetch_queue_snapshotandfetch_lease_snapshotseams withoutcandidates=injection.docs/webui-local-dev.mdand/trafficroute registered inwebui/app.pylegacy list andwebui/nav.pyNAV_GROUPS.Test Execution Results
All 46 webui traffic control, shell, queue dashboard, and lease visibility unit tests executed and passed (0 failures).
Canonical PR State
STATE:
approved
WHO_IS_NEXT:
merger
NEXT_ACTION:
Handoff to gitea-merger session for merge.
NEXT_PROMPT:
WHAT_HAPPENED:
Reviewer verified remediations B1–B6 at head
dac40ab9b3and ran webui unit test suite (46 passed).WHY:
All review blockers (B1–B6) are resolved and covered by tests and docs.
ISSUE:
#640
HEAD_SHA:
dac40ab9b3REVIEW_STATUS:
approved
MERGE_READY:
yes
NATIVE_REVIEW_PROOF:
native-mcp-review
BLOCKERS:
none
VALIDATION:
Independent code diff inspection and pytest execution of tests/test_webui_traffic_control.py, tests/test_webui_shell.py, tests/test_webui_queue_dashboard.py, tests/test_webui_lease_visibility.py (46 passed).
LAST_UPDATED_BY:
sysadmin / prgs-reviewer / 2026-07-24
repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #885
issue: #640
reviewer_identity: sysadmin
profile: prgs-reviewer
session_id: 53497-a5cd6a10b1fa
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/issue-640
phase: released
candidate_head:
dac40ab9b3target_branch: master
target_branch_sha: none
last_activity: 2026-07-25T01:57:18Z
expires_at: 2026-07-25T02:07:18Z
blocker: manual-release
repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #885
issue: #640
reviewer_identity: sysadmin
profile: prgs-reviewer
session_id: 90914-eb0509611569
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-pr885
phase: claimed
candidate_head:
dac40ab9b3target_branch: master
target_branch_sha:
ccde9e8f11last_activity: 2026-07-25T02:05:34Z
expires_at: 2026-07-25T02:15:34Z
blocker: none
repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #885
issue: #640
reviewer_identity: sysadmin
profile: prgs-reviewer
session_id: 90914-eb0509611569
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-pr885
phase: released
candidate_head:
dac40ab9b3target_branch: master
target_branch_sha:
ccde9e8f11last_activity: 2026-07-25T02:08:32Z
expires_at: 2026-07-25T02:18:32Z
blocker: manual-release
repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #885
issue: #640
reviewer_identity: sysadmin
profile: prgs-reviewer
session_id: 90914-a466fa5849ee
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-pr885
phase: claimed
candidate_head:
95e4aae287target_branch: master
target_branch_sha:
ccde9e8f11last_activity: 2026-07-25T02:08:45Z
expires_at: 2026-07-25T02:18:45Z
blocker: none
Review: PR #885 — feat(webui): Workflow traffic-control view (Phase 1) (Closes #640)
Verdict: APPROVE at head
95e4aae287902e629b879a39887042a56f2f0757, basemaster@ccde9e8f1183bc9a6672393a9923f304086fb874.This is a fresh review at the current live head. The head moved twice since the B1–B6 remediation was
first examined:
1948d3dc…→dac40ab9…→95e4aae2…. The approval atdac40ab9…(review580) isstale against the live head and is not being relied on; every claim below was re-established at
95e4aae2….Delta inspected
1948d3dc…→dac40ab9…— one commit,docs(webui): update traffic state vocabulary docs and app nav for #640:docs/webui-local-dev.md(+state vocabulary section)webui/app.py(+1 line:/trafficadded to_LEGACY_PAGES)webui/traffic_views.py(trailing-whitespace cleanup, plus one copy correction to the "Blocked Items" description so it matches the actual routing ofstatus:blockedto section 4)dac40ab9…→95e4aae2…— one commit,Merge branch 'master' into issue-640, bringing inmaster through
ccde9e8f1183…(#884 / #682 httpx2 TestClient migration).git diff dac40ab9 95e4aae -- webui/ docs/is empty: this merge changed no file owned by this PR. It touches
requirements.txt,tests/webui_testclient.py, and the httpx2 migration of unrelatedtests/test_webui_*.pyfiles — allalready on master.
B1–B6 re-verified at the current head
head_sha.webui/traffic_loader.py:165readssignals.get("head_sha")and passes itat line 176 with the comment "Full 40-char SHA from head.sha — never the 12-char display value."
webui/queue_loader.py:163puts the untruncated SHA insignals, while the 12-char value at line 158is explicitly marked display-only. PRs no longer render with a fabricated "missing head_sha pin".
kind="pr"(line 170), and reviewerleases are normalized to
pr_number(lines 357–372) withnumber = pr_number if kind == "pr"(line 265). No cross-attribution to a linked issue.
_claim_lease_recordsreads(inventory or {}).get("entries")(line 211) and documents the real
build_claim_inventorycontract. The deadactive_claimsbranchis gone.
WorkCandidates are constructed fromsignals(labels,
mergeable,head_sha) rather than from display badges.request_changes_current_head/approval_on_current_headare deliberately left at their fail-safeFalse, with an explicit comment that the queue loader never fetches review verdicts and that anunproven approval must never route a PR to the merger. That is the correct fail-closed choice.
TestTrafficLivePathdrivesfetch_queue_snapshot/fetch_lease_snapshotwith nocandidates=injection, and covers each earlier defect directly:test_live_pr_uses_full_head_sha_and_is_runnable,test_live_pr_without_head_sha_is_blocked,test_reviewer_lease_keys_by_pr_not_linked_issue,test_claim_inventory_entries_key_marks_issue_leased,and
test_active_claims_key_is_ignored(a canary that the bogus key stays unused).docs/webui-local-dev.mdcarries a"Traffic-control state vocabulary (#640)" section defining all five buckets, and states that
status:blockedroutes toneeds_controller, matching the code.Navigation was already wired and is confirmed present at this head:
webui/nav.pycontainsNavGroup("Traffic", (NavItem("/traffic", "Traffic control"), …)), andwebui/app.pylists/trafficin
_LEGACY_PAGES. The earlier navigation blocker does not apply and is not restated.Validation at the exact head
Focused on the moved delta and affected behavior; the full suite was not re-run.
pytest tests/test_webui_traffic_control.py tests/test_webui_shell.py -qat95e4aae2…→28 passed, 54 subtests passed, exit 0.
dac40ab9…→ 14 passed; shell/nav suite → 14 passed, 54 subtests.95e4aae2…ran from a read-only export of thatcommit.
branches/issue-640was left atdac40ab9…withgit status --porcelainempty before andafter every command.
Merge-state note for the merger
Gitea currently reports
mergeable: false/has_conflicts: truefor this PR, andassess_pr_sync_statusroutesauthor_conflict_remediationon that basis. That server-side flagdisagrees with the repository:
git merge-tree --write-tree ccde9e8f1183… 95e4aae2879…completescleanly (exit 0, tree
4fc9650d889f…), andcommits_behindis now0because the author alreadymerged master in. This looks like the known stale post-sync conflict cache, not a real conflict.
Merger must re-check
mergeableat merge time and must not force anything — if Gitea still reportsa conflict once its cache refreshes, route the author, do not merge.
Author-safety: PR author
jcwalker3!= reviewersysadmin.Canonical PR State
STATE:
approved
WHO_IS_NEXT:
merger
NEXT_ACTION:
Acquire the merger lease and merge PR #885 at head
95e4aae287after merger preflight re-confirms approval_at_current_head and a live mergeable check.NEXT_PROMPT:
WHAT_HAPPENED:
Reviewer re-reviewed PR #885 at the current live head
95e4aae287after the head moved twice, re-verified remediations B1-B6 against the source at that head, and ran the focused webui traffic-control and shell/nav suites (28 passed, 54 subtests).WHY:
All six previously recorded blockers are resolved at the current head, the only change since the verified content is a clean merge of master that touches no file owned by this PR, and the focused suites pass at the exact head.
ISSUE:
#640
BASE:
master
HEAD:
issue-640
HEAD_SHA:
95e4aae287REVIEW_STATUS:
approved
MERGE_READY:
yes - subject to the merger re-confirming the live mergeable flag noted above.
BLOCKERS:
none
SUPERSEDES:
Review 580 (approve at former head
dac40ab9b3, now stale against the live head).SUPERSEDED_BY:
none
VALIDATION:
pytest tests/test_webui_traffic_control.py tests/test_webui_shell.py at head
95e4aae287-> 28 passed, 54 subtests passed, exit 0. Source re-verification of B1-B6 in webui/traffic_loader.py, webui/queue_loader.py, webui/nav.py, webui/app.py, docs/webui-local-dev.md, tests/test_webui_traffic_control.py. git diff dac40ab9..95e4aae -- webui/ docs/ empty. git merge-tree against master clean.NATIVE_REVIEW_PROOF:
transport=native_mcp; entrypoint=mcp_server; pid=90914
LAST_UPDATED_BY:
sysadmin / prgs-reviewer / 2026-07-25
repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #885
issue: #640
reviewer_identity: sysadmin
profile: prgs-reviewer
session_id: 90914-a466fa5849ee
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-pr885
phase: released
candidate_head:
95e4aae287target_branch: master
target_branch_sha:
ccde9e8f11last_activity: 2026-07-25T02:10:03Z
expires_at: 2026-07-25T02:20:03Z
blocker: manual-release
repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #885
issue: #640
reviewer_identity: sysadmin
profile: prgs-merger
session_id: 53504-2faa0a10eb5e
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/issue-640
phase: claimed
candidate_head:
95e4aae287target_branch: master
target_branch_sha: none
last_activity: 2026-07-25T02:10:40Z
expires_at: 2026-07-25T02:20:40Z
blocker: none
Stale #332 review-decision lock cleanup (#594)
Status: APPLIED
sysadminprgs-merger2026-07-25T02:10:58.268020+00:00approveon PR feat(webui): Workflow traffic-control view (Phase 1) (Closes #640) (#885)closed(merged=True)a4c73766f4b0cc32f7c3808688eceeb6fee743354prgs-reviewerManual deletion of session-state files is not the workflow.
This path only clears a lock when the referenced PR is merged/closed.