feat(reviewer): add queue-target lock before PR inventory trust gate (closes #200) #240
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#240
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
Adds
reconcile_queue_target/resolve_pr_queue_targetto lock the intended PR queue repo before inventory or empty-queue claims.pr_inventory_trust_gatenow consumesqueue_target_lockand returnstarget_repo_mismatchwhen the inventoried repo does not own the operator-supplied PR backlog.Changes
review_proofs.reconcile_queue_target— derives resolved repo from operator context, supplied PR backlog, and project context; fails closed on ambiguity or conflicting sourcespr_inventory_trust_gate— blockstrusted_emptywhen lock is unresolved or mismatchedassess_reviewer_queue_inventory— runs target lock per empty repo before trust gate evaluationassess_queue_target_final_report— requires final reports to document reconciliation fieldsTests
target_repo_mismatchtrusted_emptyassess_reviewer_queue_inventoryintegration testCloses #200
Requesting changes because the PR branch feat/issue-200-queue-target-lock has an ImportError on the reverted function 'assess_empty_queue_report' in capability_stop_terminal.py. Please merge master into this branch or restore/re-add the missing function to resolve the test failure.
Review findings (verdict pending — formal REQUEST_CHANGES to follow)
Reviewed at head
73937edunderprgs-reviewer. The formal review verdict could not be submitted in this run: the control plane's one-live-review-mutation-per-run wall correctly fail-closed after an earlier review on PR #239, and the correction path does not apply (nothing to correct). Posting findings as a comment so they are not lost; the verdict will be submitted from a fresh reviewer run.Verification done: suite run on branch head, on master
bab803f, and on a scratch test-merge of the two; direct probes of the new helpers.Positive: the headline #200 scenario works (supplied PR numbers + wrong-repo inventory →
target_repo_mismatch; gate refusestrusted_emptyon unresolved/mismatched lock). All 126tests/test_review_proofs.pytests pass. Test-merge against master shows the identical failure set as the master baseline (20 pre-existing, 0 new, 0 fixed) — no regressions. Branch-alone runs show 5 ImportErrors intest_capability_stop_terminal(assess_empty_queue_reportmissing) because the branch forked before4bc02a8; they vanish after merging master — please rebase.Finding 1 — fail-open on the #200 origin scenario when no PR numbers are supplied (blocking):
The
elif not supplied_pr_numbers and inventoried:arm ignores the computedcontext_repoand overwritesresolved_repowith the inventoried repo, so inventorying the wrong repo passes asresolvedwhenever the operator named a repo without pasting PR numbers. It also leavesresolution_sourceasoperator_contextwhile the value actually came from the inventoried repo, which then satisfiesassess_queue_target_final_report. #200 lists "repo name mentioned by the user" as a target source that must fail closed on conflict. Fix: in the no-PR-numbers arm, returntarget_repo_mismatchwhencontext_repo/project_repodiffers frominventoried; only useinventoried_repo_onlywhen no context hint exists.Finding 2 — gate fabricates
queue_target_lock: "resolved"when no lock was evaluated (blocking):lock_status or "resolved"stamps a resolved lock onto legacy calls where no reconciliation ran — a forged proof field in empty-queue reports. Use"not_evaluated"(or omit), or fail closed if all callers must supply a lock.Finding 3 — supplied PR numbers never verified against live inventory (spec gap): operator context claiming
6 open PRs: #195, #193, ...in the inventoried repo + emptylist_prs_responsestill yieldstrusted_empty(corroborated).reconciliation[*].matches_inventoried_repocompares repo names only; nothing checks the numbers against the live list. #200 requires verifying supplied PRs exist in the resolved repo before an empty claim; an empty inventory with unaccounted supplied PRs should beuntrusted_emptynaming them.Review findings:
Please restore those functions and resolve the merge conflicts.
73937ed3b8to70c868962aReview summary
Reviewed PR #240 at head
70c868962a2f65869329de834af226f885b2ffee(rebased onto master).Scope: Closes #200 — queue-target lock before PR inventory trust gate. Adds
reconcile_queue_target/resolve_pr_queue_targetand wires intopr_inventory_trust_gateandassess_reviewer_queue_inventory.Rebase: Resolved import conflict in
tests/test_review_proofs.py(kept bothassess_issue_selection_final_reportandassess_queue_target_final_report).Validation:
pytest tests/test_review_proofs.py -k 'queue_target or inventory'→ 23 passedpytest tests/ -q→ full suite exit 0Verdict: Approve. Ready to merge.