Skip to content

uf.review-pr: manual finalize_review_dispatch payload assembly causes repeated finalizer rejections #906

Closed

Description

@jflowers

Summary

/uf.review-pr still tells the parent agent to deduplicate findings itself
and hand-build a full finalize_review_dispatch payload. The
dispatch-finalize-determinism change (0593cae) moved
/uf.review-council, /uf.triage-issue, and /uf.address-feedback
to a single consolidate_dispatch call with provenance. It did not
move uf.review-pr.md.

Observed (dewey PR #138, session ses_e66b2decfffe6iTzZlb9ktkM5E)

Dispatch 0274aa47-53a2-4715-9dd0-4951382a6f9a: 5 runs succeeded,
4 were skipped, 15 findings. The parent rebuilt the ~50KB payload by hand
three times:

  1. Rejected: payload.runs.N: Unrecognized key: "read_only". The agent
    copied a plan-entry field into the run records.
  2. Rejected: consolidated finding has incorrect contributing run ids /
    run finding is missing from consolidated findings. Following §5's
    "deduplicate by normalized file plus root cause / cross-persona
    grouping", the agent merged the architect finding (vault.go:627) and
    the guard finding (vault.go:625) into one. The finalizer requires an
    exact match between run findings and consolidated findings.
  3. Accepted, only after passing the plugin's 15 consolidated findings
    through unchanged.

This is the same failure class dispatch-finalize-determinism documented
(session ses_eca4843f9ffeKwVLQhSFCRh2Rl: read_only leaking into run
records during manual payload reconstruction).

Root cause

.opencode/commands/uf.review-pr.md
(mirror: internal/scaffold/assets/opencode/commands/uf.review-pr.md):

  • §5 (~L495-505): the parent deduplicates and applies cross-persona
    grouping and compound severity. This conflicts with the finalizer's
    run-finding <-> consolidated-finding correspondence check.
  • §5a (~L507-554): consolidate_dispatch without provenance, used only
    to fetch data.
  • §5b (~L556-574): "Call finalize_review_dispatch with: ...
    deduplicated findings, advisories, run counts, and reason".
  • No bounded retry policy for mechanical rejections.

Proposed fix

  • Replace §5/§5a/§5b with exactly one
    consolidate_dispatch({correlation_id, provenance: {branch, commit, workflow_id: "uf.review-pr"}}) per finalization attempt. Take
    branch/commit from the frozen PR input context head_ref/head_sha,
    as /uf.address-feedback does, because the finalizer checks the commit
    against input_context.head_sha.
  • "Never assemble, restate, or recompute the payload; never call
    finalize_review_dispatch directly."
  • Bounded retry, at most twice, and only for mechanical rejections. Never
    change assessment data on a retry.
  • Keep cross-persona grouping and compound severity for presenting the
    review comment only. They must not touch finalization data.
  • Read proposals and warnings from the same consolidate result.
  • Update the scaffold mirror and add drift/content tests that assert the
    new contract and the absence of the manual-finalize prose. Add a
    CHANGELOG entry.

Also cover: stale dedup prose in uf.review-council.md §3

uf.review-council.md §3 (~L360) still carries "First deduplicate ...
cross-persona grouping" prose left over from the pre-migration wording.
Its §5 finalization is already consolidate-with-provenance, so the prose
is harmless to finalization but misleading — an agent following §3
literally could reintroduce the same rejection. The same change should
tidy §3 so dedup/grouping language is explicitly presentation-only.

Related

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions