Skip to content

eval: finding_expectations can score historical reviews and unrelated comments instead of the evaluated run #1824

Closed

Description

@Benkapner

Problem

The finding_expectations judge in eval/review/eval.yaml combines every captured comment body and review body before checking finding categories:

bodies = [item.get("body", "") for item in state.get("comments", [])]
bodies.extend(item.get("body", "") for item in state.get("reviews", []))
review_text = "\n".join(bodies).lower()

Nothing in this check establishes that a matching category, such as [logic-error], belongs to the evaluated run's findings. Historical reviews, unrelated author comments, and previous-run content preserved inside a sticky comment can affect the result.

Consequences

  1. False pass: an old review satisfies a required category that the current run did not report.
  2. False pass: an unrelated PR-author comment satisfies a required category.
  3. False failure: a forbidden category appears only in an old review, but the current review is clean.
  4. False failure inside the correct sticky comment: the current write-up is clean, but a collapsed "Previous run" section contains the forbidden category.

The fourth case means selecting the right comment alone is insufficient: historical content within that comment must also be excluded.

Reproduction

Verified offline against agents commit 16657d540187b16743c8693dc2ccc40366334430.

The following executes the actual judge extracted from the shipped YAML, using synthetic captured states. It does not call GitHub or run a model.

Run from the repository root:

uv run --with pyyaml python3 - <<'PY'
import json
import textwrap
from pathlib import Path
import yaml

config = yaml.safe_load(Path('eval/review/eval.yaml').read_text())
check = next(j['check'] for j in config['judges']
             if j['name'] == 'finding_expectations')
namespace = {}
exec('def judge(outputs):\n' + textwrap.indent(check, '    '), namespace)

old = {'author': 'review-bot', 'body': '[logic-error] old finding'}
current = {'author': 'review-bot', 'body': 'No current findings.'}
author = {'author': 'pr-author', 'body': 'Discussion of [logic-error].'}
sticky = {'author': 'review-bot', 'body': '''No current findings.

<details>
<summary>Previous run</summary>

<!-- sticky:history-start -->
[logic-error] old finding
<!-- sticky:history-end -->

</details>'''}

cases = [
    ('prior-review-required', [], [old, current],
     {'required': ['logic-error']}, False),
    ('author-comment-required', [author], [current],
     {'required': ['logic-error']}, False),
    ('prior-review-forbidden', [], [old, current],
     {'forbidden': ['logic-error']}, True),
    ('sticky-history-forbidden', [sticky], [current],
     {'forbidden': ['logic-error']}, True),
]
for name, comments, reviews, findings, expected in cases:
    outputs = {
        'files': {'output/fixture-state.json': json.dumps(
            {'comments': comments, 'reviews': reviews})},
        'annotations': {'findings': findings},
    }
    actual, _ = namespace['judge'](outputs)
    print(f'{name}: expected={expected}, actual={actual}')
PY

Observed output:

prior-review-required: expected=False, actual=True
author-comment-required: expected=False, actual=True
prior-review-forbidden: expected=True, actual=False
sticky-history-forbidden: expected=True, actual=False

These demonstrate incorrect judge results under the supplied states, not a reproduced live GitHub evaluation incident.

Impact on evaluation results

This can corrupt reported findings scores in either direction.

Although the checked-in configuration declares min_pass_rate: 1.0, run-functional.sh removes this judge's threshold at runtime. It is therefore report-only for individual functional runs, not a direct PR/release gate.

Its results also feed the nightly three-run aggregation, so repeated contamination can affect the nightly verdict.

Suggested direction

Attribute findings to the evaluated run's published output before applying the existing category checks.

Current capture is the limiting factor. capture-fixture.sh shapes the two arrays the judge reads:

comments: [... | {author: .author.login, body: .body, created_at: .createdAt}],
reviews:  [... | {author: .author.login, state: .state, body: .body}],

Reviews carry no identifier and no timestamp, so they cannot be ordered with what is captured today. Comments carry created_at but no identifier. Capture changes are therefore required, at both shaping sites (L142-L143 for the issue path, L295-L296 for the PR path).

No single heuristic is sufficient:

  • created_at alone misses sticky comments edited in place.
  • Author alone cannot distinguish successive runs by the same bot.
  • Commit SHA alone cannot distinguish multiple runs against the same commit.
  • The correct sticky comment can still contain historical findings.

Two machine-readable anchors already exist and are worth assessing before adding new ones:

  • the projection marker <!-- fullsend:review-findings-v2:<base64> --> (post-review.src.sh#L1450); note it is built from the carried ledger, so its exact semantics need confirming;
  • finding ids of the form f_[A-Za-z0-9]+, stamped onto inline comments from the JSON ids rather than from body text (post-review.src.sh#L1457).

Keep this scoped to attribution and historical-content exclusion, without changing category semantics, thresholds, or gating policy.

Acceptance criteria

  • Historical reviews and unrelated author comments cannot satisfy required or required_any.
  • Historical findings cannot trigger forbidden.
  • Editing an existing sticky comment remains supported.
  • Previous-run history inside a sticky comment is excluded.
  • Genuine current-run findings still satisfy required checks and trigger forbidden checks.
  • Missing or ambiguous attribution is distinguishable from a verified clean review; it does not silently produce a successful findings evaluation.
  • Offline regression tests exercise the shipped judge logic, including the four cases above.

Relationship to #1003

PR #1003 adds required_findings and forbidden_findings, including inline-comment and fallback-body parsing. It also includes a limited stale-head check.

This issue concerns run attribution and historical-content exclusion, not a replacement findings parser. Coordinate the implementation with #1003 so whichever judges ship use consistent attribution and preserve supported publication channels.

Activity

  1. fullsend-ai-triage commented on Oct 28, 2026

    @fullsend-ai-triage

    🤖 Finished Triage · ✅ Success · Started 12:58 PM UTC · Completed 1:00 PM UTC

    Commit: 16657d5 · View workflow run →

    Runtime: claude · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $0.22

  2. added
    bug
    ready-to-code
    on Oct 28, 2026
  3. fullsend-ai-triage commented on Oct 28, 2026

    @fullsend-ai-triage

    Triage notes on top of the report:

    • Verified at HEAD: the judge and both capture shaping sites in the capture script match the issue's description. The related PR test(eval): measure review findings, not just review outcomes #1003 is open but adds separate judges; it does not fix this problem, so this issue is not blocked on it. Whichever lands second should adopt the same attribution approach.
    • Open design question for the implementer (not for the reporter): which anchor to use for attribution (the projection marker, the f_* finding ids on inline comments, or new capture fields). The marker's exact semantics need confirming since it is derived from the carried ledger.
    • Missing or ambiguous attribution should produce a result distinguishable from a verified clean review, per the acceptance criteria.
    • No CI workflow changes appear to be needed.

    Proposed test case:

    Load the shipped finding_expectations judge from eval/review/eval.yaml and run it on synthetic states:
    1. old review has [logic-error], current clean, required=[logic-error]  -> expect fail
    2. PR-author comment mentions [logic-error], required                  -> expect fail
    3. old review has forbidden category, current clean                    -> expect pass
    4. forbidden category only inside sticky history markers               -> expect pass
    Controls: genuine current finding satisfies required / trips forbidden; in-place edited sticky comment works; missing attribution is reported distinctly.
    

    Next steps:

    • /fs-code — agent creates a PR to implement this issue
    • /fs-code <your instruction> — agent implements with your specific guidance
  4. fullsend-ai-coder commented on Oct 28, 2026

    @fullsend-ai-coder
    Contributor

    🤖 Finished Code · ✅ Success · Started 1:02 PM UTC · Completed 1:10 PM UTC

    Commit: 16657d5 · View workflow run →

    Runtime: claude · Model: opus → claude-opus-5-5 · Effort: high · Cost: $2.14

  5. self-assigned this
    on Oct 29, 2026
  6. added 2 commits that reference this issue on Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugready-to-code

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions