Skip to content

fix(advisor): stop unproductive outer review-and-fix loops #9774

Closed

Description

@cjagwani

Problem

The PR Review Advisor now treats material maintainability defects as first-class blockers and directs fixes toward smaller source-and-test designs. The remaining risk is outside a single review pass: an author or fixing agent can cycle through repeated review-and-fix revisions, rename symptoms of the same root problem, or grow the pull request while attempting to satisfy the reviewer.

That loop consumes reviewer capacity and can make the final change harder to maintain even when every individual response appears locally reasonable.

This issue complements #8240 and #9631. It does not reopen the first-pass reduction rules that #9631 delivered.

Goal

Make repeated advisor runs recognize stable root findings, measure whether revisions make material progress, and stop with a clear human-review handoff when an automated fix loop is no longer converging.

Measurement before behavior changes

Build a sanitized corpus from recent advisor-eligible pull-request revision sequences and report:

  • consecutive advisor runs per pull request;
  • stable root findings across revisions;
  • findings that reappear with changed wording or location;
  • findings resolved, superseded, or replaced by an independent current defect;
  • source-and-test additions and deletions between reviewed heads;
  • revisions that add a mechanism without reducing the root design problem;
  • terminal outcome: clean, human decision, abandoned, or merged with an accepted limitation.

The corpus report must contain no repository credentials, private URLs, or untrusted pull-request text beyond the minimum redacted fixture needed for a regression case.

Proposed convergence contract

  • Give each material root finding a stable identity across consecutive reviewed heads.
  • Count progress only when the root finding closes, the complete source-and-test design materially shrinks, or checked-in evidence proves that the finding is superseded.
  • Do not reset the convergence history merely because a symptom moves, wording changes, or another abstraction is added.
  • Keep independently evidenced correctness, security, authorization, and scope findings eligible.
  • After two consecutive reviewed revisions with the same actionable root and no material progress, stop issuing another automated fix instruction for that root and request human maintainer judgment.
  • A new independent defect may be reported, but it must not silently reset the stalled root's history.
  • Record the convergence decision and reason in the advisor artifact and rendered summary.

The two-revision threshold is a proposed initial contract. The baseline corpus should confirm it before activation or recommend a different fixed value with evidence.

Acceptance criteria

  • A checked-in, sanitized baseline report measures recent multi-revision advisor sequences and records the selected fixed threshold.
  • Root finding identity survives file movement, symptom wording changes, and follow-on machinery that does not resolve the original design problem.
  • Advisor artifacts record the prior reviewed head, stable root IDs, progress classification, consecutive no-progress count, and terminal stop reason.
  • A shrinking fix clears or advances the root without triggering escalation.
  • Two consecutive no-progress revisions produce one human-review handoff rather than another fix instruction.
  • A net-growing revision that adds a mechanism without resolving the root counts as no progress.
  • A genuinely independent current defect remains reportable after another root stalls.
  • Superseded and refreshed-base-only overlap do not consume the retry budget.
  • Workflow reruns for the same head are idempotent and do not increment the count.
  • Tests cover shrinking resolution, repeated root, symptom churn, net growth, independent findings, superseded overlap, and same-head reruns.
  • Documentation explains the convergence fields and the human-review handoff.

Non-goals

Activity

  1. added theissue type on Aug 20, 2026
  2. added
    area: project-management
    on Aug 20, 2026
  3. cjagwani commented on Aug 20, 2026

    @cjagwani
    CollaboratorAuthor

    Initial convergence baseline

    I sampled 28 successful primary-lane advisor artifacts from seven pull requests with multiple reviewed heads since August 19. This is a targeted convergence corpus, not a claim about every advisor run.

    Observations

    • 13 of 28 reviewed heads produced at least one finding; 15 were clean.
    • At least two sequences repeated the same semantic root under changed finding titles.
    • In feat(messaging): support Google Chat on Hermes over keyless Pub/Sub REST pull #9393, the missing conditional Hermes Google Chat plugin-load regression appeared on three consecutive reviewed heads as Test conditional Google Chat adapter loading, then Cover the Hermes Google Chat plugin load gate twice. The current per-run IDs could not identify those as one root.
    • In fix(skills): bound automated review remediation #9679, five successful reviewed heads stayed within the same three files while the pull-request diff grew from 77 additions / 4 deletions to 167 additions / 25 deletions. Net size grew from +73 to +142 lines. Four related blocker passes covered approval counting, ordered filtering, repair-scope routing, and blocker eligibility; one intermediate head was reported clean.
    • In ci(docs): maintain cumulative release documentation PR #9762, two different correctness blockers appeared on successive heads before the third head was clean. The convergence design therefore must preserve genuinely independent findings rather than suppress everything after one root stalls.
    • Successful same-head analysis was counted once. Edited-event runs that the workflow skipped, cancelled superseded runs, and failed analysis runs were excluded.

    Current implementation gap

    The checked-in advisor assigns canonical finding IDs by array position on every run (F-001, F-002, and public PRA-1, PRA-2). The sticky comment records the current head and run metadata, then replaces its previous body. It does not carry a stable root identity, prior reviewed head, progress classification, or no-progress count into the next run.

    Threshold recommendation

    Keep the proposed two-consecutive-no-progress threshold for a shadow-mode implementation. The #9393 sequence demonstrates that a third restatement can occur without root identity, while #9762 demonstrates why independent findings must remain eligible.

    Before activation, shadow mode should classify a larger time window and report false joins and false splits. Activation should require deterministic fixtures for:

    1. the same root with changed wording and line location;
    2. a root resolved by a shrinking change;
    3. a new independent defect after another root stalls;
    4. a same-head rerun;
    5. refreshed-base-only overlap;
    6. a clean pass followed by a newly introduced defect.

    No behavior change is proposed until the issue receives the repository's required maintainer decision and validation plan.

  4. cjagwani commented on Aug 20, 2026

    @cjagwani
    CollaboratorAuthor

    I expanded the shadow baseline from the initial 28 runs / 7 PRs to every available successful multi-head primary-advisor artifact since August 19:

    • 69 reviewed heads across 17 PRs
    • 34 heads with findings; 35 clean
    • 6 clean -> finding transitions

    The larger corpus makes two boundaries clearer.

    First, a clean head must not reset all prior history: later independent findings are real and remain eligible. Second, the outer loop still needs a semantic-root history that survives title, line, and nearby-code changes.

    The strongest sequence is PR #9593. Across 7 successful reviewed heads, the advisor produced 6 consecutive security blockers in the same 2 files before a clean result:

    1. verify that the recorded broker PID owns the port;
    2. handle an unavailable listener-ownership probe;
    3. do not signal a PID that fails ownership;
    4. bind reuse to broker-instance identity;
    5. require listener ownership before stale-process termination;
    6. revalidate ownership after the health probe.

    These are not identical messages, but they form one serial remediation root. The exact-base diff grew from 707 additions / 643 deletions (net +64) on the first reviewed head to 1,132 additions / 660 deletions (net +472) on the last, a +408-line net increase while the advisor discovered the chain one head at a time.

    Other repeat evidence:

    This supports keeping the bound semantic rather than keyed only by title or file:

    1. Persist a root's history across wording, line, and nearby-code changes.
    2. Count progress when the root is closed or its risk/reproduction/validation materially changes.
    3. Count no progress when the same root reappears on a new head with only presentation/location changes and no materially new evidence.
    4. After 2 consecutive no-progress repeats for one root, stop automated fixing for that root and hand it to a human; continue to report genuinely independent new roots.
    5. Treat same-head reruns as idempotent.
    6. Let a clean head close only the roots evaluated at that head; do not erase history needed to distinguish a later independent root from a recurrence.

    For #8240, I would keep this root ledger and stop policy in the Advisor's independent mechanics. The shared engineering checks can prevent some serial discovery earlier, but they should not own or duplicate the runtime loop state.

    Suggested maintainer decision before implementation: accept the 2-repeat shadow threshold and the semantic-root/progress definitions above, or choose the threshold and counterexample set you want measured first. The next safe slice would be shadow-only telemetry plus fixtures for #9593, #9323, #9393, #9723, and #9679; no production stop behavior until the shadow classification is reviewed.

  5. cjagwani commented on Aug 20, 2026

    @cjagwani
    CollaboratorAuthor

    Manual shadow gold set: stall versus serial discovery

    I reviewed the complete finding bodies and evidence for the repeated candidates, not only title/file similarity. That changes the proposed implementation in one important way: same-root stall count and same-family iteration depth must be separate signals.

    Fixture Manual relation Expected shadow result
    #9393 heads 62d6e5dd -> 3668e10e -> 06b846d9 Same hermes-googlechat-plugin-load-gate root. All three say the conditional plugin import/registry replacement has no checked-in configured/unset regression test. Wording and line move; the missing proof does not materially change. First recurrence: no-progress count 1. Second recurrence: count 2 and recommend human handoff for this root.
    #9323 heads 8e2fd432 -> 395c8db6 Same manual-e2e-latest-head-binding root: both require .head.sha == CHECKOUT_SHA at authorization and pre-execution. The second head also has an independent trusted-branch credential root. One no-progress recurrence; no stop. Keep the independent credential finding eligible.
    #9685 heads 34f05fc4 -> 170e36da Same fork-approval-diagnostic-redaction root: raw GitHub stdout/stderr can expose credentials. The later head also contains three independent findings. One no-progress recurrence; no stop. Keep all independent findings eligible.
    #9593 six finding heads One broker-ownership risk family, but material progress/new subroots: port ownership, unavailable probe semantics, safe signaling, instance identity, stale-process termination, then a post-health TOCTOU recheck. Never increment same-root no-progress merely because category/file/family match. Increment family iteration depth and surface a serial-discovery alert without suppressing a finding.
    #9723 heads 619a12af -> 9b6f0228 Same timeout-ownership objective, but the recommendation moves from reusing the centralized constant to placing it in the active runner. Material progress; no no-progress increment.
    #9679 after clean head ff023829 The later blocker-eligibility rule is not proof that an earlier root remained open; the intermediate clean evaluated the then-current head. New/unknown root remains eligible; a clean result does not erase family history or cause a stop.
    #9762 two finding heads Different behavior, evidence, and files: semantic-version parsing versus assignment-before-read workflow. Independent roots; no join.

    Recommended shadow record per observation:

    root_key
    family_key
    relation = same_root | new_subroot | independent | unknown
    progress = no_progress | material_progress | unknown
    consecutive_no_progress
    family_iteration_depth
    decision_explanation + current evidence references
    

    Fail-safe rules:

    • unknown never suppresses or auto-closes a finding; it requests human classification.
    • Only same_root + no_progress increments the two-repeat stop counter.
    • new_subroot and material_progress reset that root's no-progress counter but continue the family-depth metric.
    • Same-head reruns do not create observations.
    • A clean head closes the roots evaluated on that head; it does not erase family history.

    The current historical corpus has one clear positive stop fixture (#9393), two one-repeat non-stop fixtures, and several critical false-join fixtures. That is enough to test the schema in shadow mode, but not enough to activate production stopping. Activation should require synthetic positive variants plus zero false stops on this gold set.

    This also gives the #8240 split a precise boundary: shared planning/implementation checks may reduce family_iteration_depth; the Advisor alone owns runtime root identity, recurrence counters, and stop/handoff state.

  6. added
    needs: design
    on Aug 20, 2026
  7. added
    area: ci
    on Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: ciarea: project-managementneeds: design

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions