Add hard queue-target resolution wall before PR inventory or empty-queue claims #202

Closed
opened 2026-07-05 15:13:46 -05:00 by jcwalker3 · 1 comment
Owner

Problem:
Reviewer agents can check the wrong repository queue and then report "no open PRs," even when the intended review backlog has open PRs. This creates a false stop condition and hides actionable PRs from the operator.

Observed failure:
The agent repeatedly reported that Scaled-Tech-Consulting/mcp-control-plane had zero open PRs and concluded that there was nothing to review. However, the active review backlog is Scaled-Tech-Consulting/Gitea-Tools, which currently has six open PRs:

  • #195 — Add fail-closed PR inventory wall when list_prs returns an unexpected empty queue
  • #193 — Raise reviewer A-bar: capability, sweep, live-state, and role-boundary proofs
  • #192 — Add role-boundary proofs for reviewer queue workflows
  • #190 — Fix MCP registration and naming for Jenkins/GlitchTip servers and add discoverability coverage
  • #187 — Harden author-run reporting and mutation capability proof
  • #181 — Add fail-closed branch-identity proofs for author commit/push workflow

Required wall:
Before any PR inventory, review selection, or empty-queue report, the workflow must resolve and lock the intended queue target.

The queue target must be derived from explicit operator context, including:

  • repo name mentioned by the user;
  • PR numbers/titles supplied by the user;
  • current working project context;
  • previous handoff target;
  • remote/owner/repo configured for the active task.

If these sources conflict, the agent must fail closed with a target-resolution blocker. It must not silently inventory a different repo.

Required behavior:

  • If the operator provides PR numbers or PR titles, the agent must verify those PRs exist in the resolved repo before claiming the queue is empty.
  • If the agent inventories mcp-control-plane but the supplied PRs are in Gitea-Tools, the result must be target_repo_mismatch, not trusted_empty.
  • Empty-queue claims are forbidden unless the queue target has first been resolved and locked.
  • The final report must include the locked queue target: remote, owner, repo, source of target resolution, and whether user-provided PRs were reconciled.

Acceptance criteria:

  • Add a test where the user supplies open Gitea-Tools PRs but the agent inventories mcp-control-plane; expected result: target_repo_mismatch.
  • Add a test where list_prs returns empty for the wrong repo; expected result: blocked, not "no open PRs."
  • Add a test where the user says "currently we have 6 open PRs" and provides PR numbers; expected result: the workflow must reconcile those PR numbers before stopping.
  • Add a test where repo context is ambiguous between mcp-control-plane and Gitea-Tools; expected result: fail closed and require target clarification or explicit operator target.
  • Empty-queue reports must include queue_target_lock.status == resolved.
  • pr_inventory_trust_gate must consume the queue target lock result; it cannot return trusted_empty if the repo target is unresolved or contradicted by operator context.

Suggested implementation:
Add a queue_target_lock or resolve_pr_queue_target helper that runs before pr_inventory_trust_gate. The trust gate should refuse to evaluate empty inventory unless the target lock is resolved and consistent with operator-provided PR context. review_proofs.resolve_repos_from_user_reference (added for #184 via PR #185) already maps user repo references to canonical repos — the target lock should build on it, adding the operator-PR reconciliation, conflict fail-close, and lock-status output.

Related:

  • #194 — false-empty PR queue investigation: covers multi-repo inventory duty for ambiguous "PRs or issues" questions; this issue adds the upstream target-resolution/lock wall for explicitly-targeted and conflicting-context cases.
  • PR #195 / #196pr_inventory_trust_gate helper and its live-path enforcement: this lock runs before that gate and becomes one of its required inputs (trusted_empty impossible without a resolved, reconciled target).
  • #184 / PR #185 — repo-name disambiguation (resolve_repos_from_user_reference) is the existing partial mechanism this wall completes.
  • #197 — hard-stop purity: a target_repo_mismatch blocker report must also follow the terminal-report rules there.
Problem: Reviewer agents can check the wrong repository queue and then report "no open PRs," even when the intended review backlog has open PRs. This creates a false stop condition and hides actionable PRs from the operator. Observed failure: The agent repeatedly reported that `Scaled-Tech-Consulting/mcp-control-plane` had zero open PRs and concluded that there was nothing to review. However, the active review backlog is `Scaled-Tech-Consulting/Gitea-Tools`, which currently has six open PRs: * #195 — Add fail-closed PR inventory wall when list_prs returns an unexpected empty queue * #193 — Raise reviewer A-bar: capability, sweep, live-state, and role-boundary proofs * #192 — Add role-boundary proofs for reviewer queue workflows * #190 — Fix MCP registration and naming for Jenkins/GlitchTip servers and add discoverability coverage * #187 — Harden author-run reporting and mutation capability proof * #181 — Add fail-closed branch-identity proofs for author commit/push workflow Required wall: Before any PR inventory, review selection, or empty-queue report, the workflow must resolve and lock the intended queue target. The queue target must be derived from explicit operator context, including: * repo name mentioned by the user; * PR numbers/titles supplied by the user; * current working project context; * previous handoff target; * remote/owner/repo configured for the active task. If these sources conflict, the agent must fail closed with a target-resolution blocker. It must not silently inventory a different repo. Required behavior: * If the operator provides PR numbers or PR titles, the agent must verify those PRs exist in the resolved repo before claiming the queue is empty. * If the agent inventories `mcp-control-plane` but the supplied PRs are in `Gitea-Tools`, the result must be `target_repo_mismatch`, not `trusted_empty`. * Empty-queue claims are forbidden unless the queue target has first been resolved and locked. * The final report must include the locked queue target: remote, owner, repo, source of target resolution, and whether user-provided PRs were reconciled. Acceptance criteria: * Add a test where the user supplies open Gitea-Tools PRs but the agent inventories mcp-control-plane; expected result: `target_repo_mismatch`. * Add a test where `list_prs` returns empty for the wrong repo; expected result: blocked, not "no open PRs." * Add a test where the user says "currently we have 6 open PRs" and provides PR numbers; expected result: the workflow must reconcile those PR numbers before stopping. * Add a test where repo context is ambiguous between `mcp-control-plane` and `Gitea-Tools`; expected result: fail closed and require target clarification or explicit operator target. * Empty-queue reports must include `queue_target_lock.status == resolved`. * `pr_inventory_trust_gate` must consume the queue target lock result; it cannot return `trusted_empty` if the repo target is unresolved or contradicted by operator context. Suggested implementation: Add a `queue_target_lock` or `resolve_pr_queue_target` helper that runs before `pr_inventory_trust_gate`. The trust gate should refuse to evaluate empty inventory unless the target lock is resolved and consistent with operator-provided PR context. `review_proofs.resolve_repos_from_user_reference` (added for #184 via PR #185) already maps user repo references to canonical repos — the target lock should build on it, adding the operator-PR reconciliation, conflict fail-close, and lock-status output. Related: * #194 — false-empty PR queue investigation: covers multi-repo inventory duty for ambiguous "PRs or issues" questions; this issue adds the upstream target-resolution/lock wall for explicitly-targeted and conflicting-context cases. * PR #195 / #196 — `pr_inventory_trust_gate` helper and its live-path enforcement: this lock runs before that gate and becomes one of its required inputs (`trusted_empty` impossible without a resolved, reconciled target). * #184 / PR #185 — repo-name disambiguation (`resolve_repos_from_user_reference`) is the existing partial mechanism this wall completes. * #197 — hard-stop purity: a `target_repo_mismatch` blocker report must also follow the terminal-report rules there.
Author
Owner

Duplicate — closing. This issue is an exact-title triple with #200 and #201 ("Add hard queue-target resolution wall before PR inventory or empty-queue claims"), filed by three parallel author sessions within minutes; #200 (lowest number) is the canonical copy. This copy (#202) was created by this session after a duplicate search whose issue list was fetched before #200/#201 landed — a time-of-check/time-of-use failure, now tracked as its own wall in #207 (pre_create_issue_duplicate_gate, enforced inside gitea_create_issue).

Unique content from this copy worth preserving (also noted on #200): the suggested implementation should build on review_proofs.resolve_repos_from_user_reference (#184 / PR #185), and a target_repo_mismatch blocker report must follow the #197 terminal-report rules.

Closed by its authoring session under jcwalker3 / prgs-author; capability proof: gitea_resolve_task_capability(close_issue)allowed_in_current_session: true. #200 and #201 are left untouched for operator/triage consolidation (#201 is also a duplicate of #200).

Duplicate — closing. This issue is an exact-title triple with #200 and #201 ("Add hard queue-target resolution wall before PR inventory or empty-queue claims"), filed by three parallel author sessions within minutes; #200 (lowest number) is the canonical copy. This copy (#202) was created by this session after a duplicate search whose issue list was fetched before #200/#201 landed — a time-of-check/time-of-use failure, now tracked as its own wall in #207 (`pre_create_issue_duplicate_gate`, enforced inside `gitea_create_issue`). Unique content from this copy worth preserving (also noted on #200): the suggested implementation should build on `review_proofs.resolve_repos_from_user_reference` (#184 / PR #185), and a `target_repo_mismatch` blocker report must follow the #197 terminal-report rules. Closed by its authoring session under `jcwalker3 / prgs-author`; capability proof: `gitea_resolve_task_capability(close_issue)` → `allowed_in_current_session: true`. #200 and #201 are left untouched for operator/triage consolidation (#201 is also a duplicate of #200).
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

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